Core Concepts
Jobs
A job is a single unit of work submitted to your deployment. Jobs can run for seconds or hours, making them ideal for:- Video generation
- Batch image processing
- Long-running inference tasks
- Any workload that doesn’t fit the request-response pattern
Job Lifecycle
| Status | Description |
|---|---|
pending | Job is queued, waiting for a worker to claim it |
running | Job has been claimed and is being processed |
done | Job completed successfully |
failed | Job failed with an error |
canceled | Job was canceled before processing started |
Priority
Jobs are processed in strict order of priority first, then submission time. Priority is an integer where higher values are processed first.By default, priority is not considered for autoscaling metrics—the autoscaler scales based on total queue depth regardless of priority. Contact [email protected] for advanced scaling policies that account for priority tiers.
Job State with info
The info field provides persistent state that survives across the job lifecycle. You can:
- Set initial state when submitting a job via the
infoparameter - Update state during processing using
emit()in your Sprocket worker - Preserve state across retries—
infoaccumulates rather than resets
Polling for Job Completion
For jobs that take time to complete, poll the status endpoint until the job reaches a terminal state (done, failed, or canceled).
Best Practices
Use Priority for Tiered Service
Implement different service tiers by assigning priority based on customer type:Track Progress for Long-Running Jobs
For jobs that take more than a few seconds, emit progress updates so clients can show status:Handle All Terminal States
Always check fordone, failed, and canceled when polling:
Store Metadata in info
Use info to store job metadata that you’ll need when the job completes:
Error Codes
| Code | Description |
|---|---|
400 | Invalid request (missing required fields, malformed payload) |
401 | Unauthorized (invalid or missing API key) |
404 | Job or deployment not found |
409 | Cannot cancel job (already running or completed) |
500 | Internal server error |
Related Resources
- Dedicated Containers Overview – Architecture and concepts
- Quickstart – Deploy your first container
- Sprocket SDK – Build queue-integrated workers
- Jig CLI – Deploy and manage containers