Understanding the lifecycle of task run execution in Trigger.dev
yourTask.trigger({ foo: "bar" })
). It represents a single instance of a task being executed and contains the following key information:
maxDuration
.
Crashed: The worker process crashed
during execution (likely due to an Out of Memory error).
Interrupted: In development
mode, when the CLI is disconnected.
System failure: An unrecoverable system
error has occurred.
Expired: The run’s Time-to-Live
(TTL) has passed before it could start executing.
Expired
. This is useful for time-sensitive tasks where immediate execution is important. For example, when you queue many runs simultaneously and exceed your concurrency limits, some runs might be delayed - using TTL ensures they only execute if they can start within your specified timeframe.
Note that dev runs automatically have a 10-minute TTL. In Staging and Production environments, no TTL is set by default.
triggerAndWait()
function triggers a task and then lets you wait for the result before continuing. Learn more about triggerAndWait().
triggerAndWait()
, the batchTriggerAndWait()
function lets you batch trigger a task and wait for all the results Learn more about batchTriggerAndWait().
list()
function to narrow down the results:
run.payload
and run.output
:
retrieve()
and the response will already be typed:
runs.retrieve()
, you can provide the type of the task to correctly type the run.payload
and run.output
: