Jobs, Runs & Tasks
Jobs
When this happens, do this.
These are the docs for Trigger.dev v2 which will be deprecated on January 31st, 2025. You probably want the v3 docs.
A Job defines what event triggers it and what should happen when it is run.
For example, you can create a Job that will send an email to a user when they sign up for your app.
Anatomy of a Job
A Job is made up of a few things:
- Metadata
- A Trigger (what event should cause this job to run)
- The Run function (what should happen when this job runs)
Jobs, Triggers, Runs and Tasks
A more complicated Job
When a GitHub issue is modified: If the issue has been labelled “critical” send a Slack message and sync the issue to Linear.
This can be visualized like this:
Events trigger Jobs. Jobs generate a Run for every event. A Run is a single execution of a Job. A Run can have multiple Tasks which are the individual steps of a Run.