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 polls the task status at regular intervals and returns when the task finishes or the timeout is reached.

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 cancelled, stopped, or timed out

Notes

  • The command polls status at regular intervals (typically every few seconds)
  • Default timeout is 60 seconds - adjust based on expected task duration
  • Returns immediately if task is already in a terminal state
  • For very 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