Skip to main content

signaloid-cli tasks watch

Wait for task to reach terminal state.

Synopsis​

signaloid-cli tasks watch --task-id <id> [options]

Options​

OptionDescriptionDefault
--task-id <id>Task ID (required)-
--timeout <sec>Timeout in seconds60

Description​

Monitors a task and waits for it to reach a terminal state (Completed, Cancelled, or Stopped). The command listens for status updates on the real-time WebSocket channel and also checks the task status over the REST API every 10 seconds. The command returns when the task finishes or the timeout ends. The command needs access to the WebSocket endpoint.

This is particularly useful in CI/CD pipelines and automated workflows where you need to wait for task completion before proceeding.

Examples​

Wait for completion:

signaloid-cli tasks watch --task-id tsk_abc123

Custom timeout:

signaloid-cli tasks watch --task-id tsk_abc123 --timeout 300

Use in CI/CD:

if signaloid-cli tasks watch --task-id $TASK_ID --timeout 600; then
echo "Task completed successfully"
signaloid-cli tasks output --task-id $TASK_ID
else
echo "Task failed or timed out"
exit 1
fi

Exit Codes​

CodeDescription
0Task completed successfully
1Task failed, was canceled, stopped, or timed out

Notes​

  • The command receives status updates over the WebSocket channel and checks the status over the REST API every 10 seconds.
  • Default timeout is 60 seconds - adjust based on expected task duration.
  • Returns immediately if task is already in a terminal state.
  • For long-running tasks, consider implementing your own polling loop.

Troubleshooting​

Timeout Issues​

Problem: Task watch times out before task completes.

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, implement custom polling:
    while true; do
    STATUS=$(signaloid-cli tasks status --task-id $TASK_ID | jq -r '.Status')
    if [[ "$STATUS" =~ ^(Completed|Cancelled|Stopped)$ ]]; then
    break
    fi
    sleep 10
    done

See Also​