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:
| State | Description |
|---|---|
accepted | Task has been accepted by the system |
initialising | Task is being initialized |
in progress | Task is currently running |
completed | Task finished successfully |
cancelled | Task was cancelled by user |
stopped | Task was stopped by system |
Terminal states: completed, cancelled, stopped
Exit Codes
| Code | Description |
|---|---|
0 | Success (or task completed successfully) |
1 | Error 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:
- Check stderr for error messages:
signaloid-cli tasks output --task-id $TASK_ID --stream stderr - Verify build compiled successfully
- Check runtime arguments are valid
- Ensure sufficient resources are available
Timeout Issues
Problem: Task watch times out.
Solutions:
- Increase timeout value:
signaloid-cli tasks watch --task-id $TASK_ID --timeout 600 - Check task status separately:
signaloid-cli tasks status --task-id $TASK_ID - For long-running tasks, poll status instead of watch
Empty Output
Problem: Task output is empty.
Solutions:
- Verify task completed successfully
- Check stderr for error messages
- Ensure your code writes to stdout
- Verify task used correct stream (stdout vs stderr)
See Also
- signaloid-cli builds - Create and manage builds
- signaloid-cli repos - Manage repositories
- signaloid-cli files - Manage data files
Learn More
- Quick Start Guide - Complete workflow examples