Skip to main content

signaloid-cli tasks

Create and manage computational tasks on Signaloid Cloud Compute Engine.

Synopsis

signaloid-cli tasks <command> [options]

Description

The tasks command group allows you to create computational tasks from builds, monitor their execution, and retrieve results. Tasks run your compiled code with specific inputs and parameters on Signaloid's uncertainty-tracking cores.

Subcommands

  • create - Create a new task from a build
  • list - List all tasks
  • get - Get details about a specific task
  • status - Get task status
  • output - Download task output
  • output-urls - Get URLs to task outputs
  • cancel - Cancel a running task
  • delete - Delete a task
  • watch - Wait for task to reach terminal state

Complete Workflow Example

#!/bin/bash
set -e

# 1. Create a build from source
echo "Creating build..."
BUILD_RESPONSE=$(signaloid-cli builds create:source \
--file main.c \
--lang C)

BUILD_ID=$(echo $BUILD_RESPONSE | jq -r '.BuildID')
echo "Build created: $BUILD_ID"

# 2. Wait for build to complete
echo "Waiting for build..."
signaloid-cli builds watch --build-id $BUILD_ID

# 3. Create task from build
echo "Creating task..."
TASK_RESPONSE=$(signaloid-cli tasks create \
--build-id $BUILD_ID \
--args "--samples 1000")

TASK_ID=$(echo $TASK_RESPONSE | jq -r '.TaskID')
echo "Task created: $TASK_ID"

# 4. Wait for task to complete
echo "Waiting for task..."
if signaloid-cli tasks watch --task-id $TASK_ID --timeout 300; then
echo "Task completed successfully"

# 5. Get output
echo "Retrieving results..."
signaloid-cli tasks output --task-id $TASK_ID --out results.txt

echo "Results saved to results.txt"
else
echo "Task failed"
signaloid-cli tasks output --task-id $TASK_ID --stream stderr
exit 1
fi

Task States

Tasks progress through the following states:

StateDescription
acceptedTask has been accepted by the system
initialisingTask is being initialized
in progressTask is currently running
completedTask finished successfully
cancelledTask was cancelled by user
stoppedTask was stopped by system

Terminal states: completed, cancelled, stopped

Exit Codes

CodeDescription
0Success (or task completed successfully)
1Error or task failed/cancelled/stopped

Tips & Tricks

Poll Task Status

TASK_ID="tsk_abc123"

while true; do
STATUS=$(signaloid-cli tasks status --task-id $TASK_ID | jq -r '.Status')
echo "Status: $STATUS"

if [[ "$STATUS" == "completed" ]]; then
echo "Task completed!"
break
elif [[ "$STATUS" =~ ^(cancelled|stopped)$ ]]; then
echo "Task terminated: $STATUS"
exit 1
fi

sleep 5
done

Batch Task Creation

BUILD_ID="bld_abc123"

# Create 10 tasks with different parameters
for i in {1..10}; do
TASK_ID=$(signaloid-cli tasks create \
--build-id $BUILD_ID \
--args "--sample-size $((i * 100))" | jq -r '.TaskID')

echo "Created task $i: $TASK_ID"
done

Clean Up Old Tasks

# Get tasks older than 30 days
CUTOFF=$(date -d '30 days ago' -u +"%Y-%m-%dT%H:%M:%SZ")

signaloid-cli tasks list --to $CUTOFF | jq -r '.Tasks[].TaskID' | \
while read TASK_ID; do
echo "Deleting task: $TASK_ID"
signaloid-cli tasks delete --task-id $TASK_ID
done

Troubleshooting

"Task failed" Error

Problem: Task enters failed or stopped state.

Solutions:

  1. Check stderr for error messages:
    signaloid-cli tasks output --task-id $TASK_ID --stream stderr
  2. Verify build compiled successfully
  3. Check runtime arguments are valid
  4. Ensure sufficient resources are available

Timeout Issues

Problem: Task watch times out.

Solutions:

  1. Increase timeout value:
    signaloid-cli tasks watch --task-id $TASK_ID --timeout 600
  2. Check task status separately:
    signaloid-cli tasks status --task-id $TASK_ID
  3. For long-running tasks, poll status instead of watch

Empty Output

Problem: Task output is empty.

Solutions:

  1. Verify task completed successfully
  2. Check stderr for error messages
  3. Ensure your code writes to stdout
  4. Verify task used correct stream (stdout vs stderr)

See Also

Learn More