signaloid-cli tasks watch
Wait for task to reach terminal state.
Synopsis
signaloid-cli tasks watch --task-id <id> [options]
Options
| Option | Description | Default |
|---|---|---|
--task-id <id> | Task ID (required) | - |
--timeout <sec> | Timeout in seconds | 60 |
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
| Code | Description |
|---|---|
0 | Task completed successfully |
1 | Task 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:
- 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, implement custom polling:
while true; doSTATUS=$(signaloid-cli tasks status --task-id $TASK_ID | jq -r '.Status')if [[ "$STATUS" =~ ^(Completed|Cancelled|Stopped)$ ]]; thenbreakfisleep 10done
See Also
- signaloid-cli tasks status - Get task status
- signaloid-cli tasks output - Download task output
- signaloid-cli tasks create - Create a new task