Job Lifecycle
Every job progresses through distinct states from creation to completion:Status States
| Status | Description | Terminal |
|---|---|---|
PENDING | Job created, awaiting scheduling worker | No |
QUEUED | Picked up by execution worker, awaiting container start | No |
RUNNING | Container executing or heartbeat in progress | No |
COMPLETED | Execution succeeded (exit code 0 or status match) | Yes |
FAILED | Execution failed (non-zero exit code or timeout) | Yes |
CANCELED | Job was manually canceled by user | Yes |
Terminal statuses indicate job completion. Jobs in terminal states cannot transition to other states.
Trigger Types
Jobs are created through two distinct mechanisms:AUTOMATIC Trigger
Automatic jobs are scheduled by the scheduling worker based on workflow intervals.
Characteristics:
- Scheduled at fixed intervals defined in the workflow
- Cannot be skipped or paused individually
- Workflow termination stops future automatic jobs
- Execution time may drift slightly due to processing delays
MANUAL Trigger
Manual jobs are created on-demand via API calls.Schedule Manual Job
- Immediate or future scheduled execution
- Can be scheduled even for terminated workflows (if desired)
- Useful for testing, debugging, or ad-hoc executions
- Subject to same validation and execution rules as automatic jobs
Scheduling Mechanism
Scheduling Worker
The scheduling worker is responsible for identifying jobs ready for execution:Execution Worker
The execution worker consumes job messages and executes them:Interval-Based Scheduling
Automatic jobs follow interval-based scheduling patterns:How Intervals Work
Interval Examples
The next job is scheduled based on the scheduled_at time of the previous job, not its completion time. This ensures consistent intervals.
Common Interval Patterns
- High Frequency
- Hourly
- Daily/Weekly
Every Minute
Every 5 Minutes
Scheduled Time Validation
All job scheduling requests validate thescheduled_at timestamp:
Validation Rules
Filtering and Listing Jobs
Retrieve jobs with filters to narrow results:Available Filters
List Jobs with Filters
| Parameter | Values | Description |
|---|---|---|
status | PENDING, QUEUED, RUNNING, COMPLETED, FAILED, CANCELED | Filter by job status |
trigger | AUTOMATIC, MANUAL | Filter by trigger type |
cursor | base64 string | Pagination cursor for next page |
Pagination
Job listings use cursor-based pagination:Response Format
Failure Tracking
Jobs impact workflow health through consecutive failure tracking:Failure Counter Behavior
Job Execution Timeouts
Each workflow type has timeout constraints:HEARTBEAT Timeouts
- Default: 10 seconds
- Maximum: 5 minutes
- Timeout Result: Job status set to
FAILED
CONTAINER Timeouts
- Default: 30 seconds
- Maximum: 1 hour
- Timeout Behavior:
- Container receives stop signal
- 2-second grace period
- Force kill if still running
- Job status set to
FAILED - Logs captured up to timeout
Timeout Configuration
Best Practices
Interval Selection
Choose intervals based on workload requirements. Avoid unnecessarily short intervals that waste resources.
Manual Testing
Use manual triggers to test workflows before relying on automatic scheduling.
Timeout Tuning
Set timeouts slightly higher than expected execution time to account for variability.
Failure Thresholds
Set
max_consecutive_job_failures_allowed to balance between sensitivity and stability.Next Steps
Log Streaming
Access real-time job logs during execution
Analytics
Track job performance and trends