Skip to content

Commit 31855cd

Browse files
committed
Couple doc tweeks
1 parent 8d44697 commit 31855cd

File tree

3 files changed

+51
-20
lines changed

3 files changed

+51
-20
lines changed

docs/mint.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@
106106
{
107107
"source": "/realtime",
108108
"destination": "/realtime/overview"
109+
},
110+
{
111+
"source": "/runs-and-attempts",
112+
"destination": "/runs"
109113
}
110114
],
111115
"anchors": [
@@ -138,7 +142,7 @@
138142
]
139143
},
140144
"triggering",
141-
"runs-and-attempts",
145+
"runs",
142146
"apikeys",
143147
{
144148
"group": "Configuration",

docs/realtime/overview.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Trigger.dev Realtime is a set of APIs that allow you to subscribe to runs and ge
88

99
## How it works
1010

11-
The Realtime API is built on top of [Electric SQL](https://electric-sql.com/), an open-source PostgreSQL syncing engine. The Trigger.dev API wraps Electric SQL and provides a simple API to subscribe to runs and get real-time updates.
11+
The Realtime API is built on top of [Electric SQL](https://electric-sql.com/), an open-source PostgreSQL syncing engine. The Trigger.dev API wraps Electric SQL and provides a simple API to subscribe to [runs](/runs) and get real-time updates.
1212

1313
## Usage
1414

docs/runs-and-attempts.mdx renamed to docs/runs.mdx

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: "Runs & attempts"
3-
description: "Understanding the lifecycle of task execution in Trigger.dev"
2+
title: "Runs"
3+
description: "Understanding the lifecycle of task run execution in Trigger.dev"
44
---
55

66
In Trigger.dev, the concepts of runs and attempts are fundamental to understanding how tasks are executed and managed. This article explains these concepts in detail and provides insights into the various states a run can go through during its lifecycle.
@@ -24,37 +24,52 @@ Runs can also find themselves in lots of other states depending on what's happen
2424

2525
### Initial States
2626

27-
<Icon icon="rectangle-history" iconType="solid" color="#FBBF24" size={17} /> **Waiting for deploy**: If a task is triggered before it has been deployed, the run enters this state and waits for the task to be deployed.
27+
<Icon icon="rectangle-history" iconType="solid" color="#FBBF24" size={17} /> **Waiting for deploy**:
28+
If a task is triggered before it has been deployed, the run enters this state and waits for the task
29+
to be deployed.
2830

29-
<Icon icon="clock" iconType="solid" color="#878C99" size={17} /> **Delayed**: When a run is triggered with a delay, it enters this state until the specified delay period has passed.
31+
<Icon icon="clock" iconType="solid" color="#878C99" size={17} /> **Delayed**: When a run is triggered
32+
with a delay, it enters this state until the specified delay period has passed.
3033

31-
<Icon icon="rectangle-history" iconType="solid" color="#878C99" size={17} /> **Queued**: The run is ready to be executed and is waiting in the queue.
34+
<Icon icon="rectangle-history" iconType="solid" color="#878C99" size={17} /> **Queued**: The run is ready
35+
to be executed and is waiting in the queue.
3236

3337
### Execution States
3438

35-
<Icon icon="spinner-third" iconType="duotone" color="#3B82F6" size={17} /> **Executing**: The task is currently running.
39+
<Icon icon="spinner-third" iconType="duotone" color="#3B82F6" size={17} /> **Executing**: The task is
40+
currently running.
3641

37-
<Icon icon="arrows-rotate" iconType="solid" color="#3B82F6" size={17} /> **Reattempting**: The task has failed and is being retried.
42+
<Icon icon="arrows-rotate" iconType="solid" color="#3B82F6" size={17} /> **Reattempting**: The task has
43+
failed and is being retried.
3844

39-
<Icon icon="snowflake" iconType="solid" color="#68BAF2" size={17} /> **Frozen**: Task has been frozen and is waiting to be resumed.
45+
<Icon icon="snowflake" iconType="solid" color="#68BAF2" size={17} /> **Frozen**: Task has been frozen
46+
and is waiting to be resumed.
4047

4148
### Final States
4249

43-
<Icon icon="circle-check" iconType="solid" color="#28BF5C" size={17} /> **Completed**: The task has successfully finished execution.
50+
<Icon icon="circle-check" iconType="solid" color="#28BF5C" size={17} /> **Completed**: The task has successfully
51+
finished execution.
4452

45-
<Icon icon="ban" iconType="solid" color="#878C99" size={17} /> **Canceled**: The run was manually canceled by the user.
53+
<Icon icon="ban" iconType="solid" color="#878C99" size={17} /> **Canceled**: The run was manually canceled
54+
by the user.
4655

47-
<Icon icon="circle-xmark" iconType="solid" color="#E11D48" size={17} /> **Failed**: The task has failed to complete successfully.
56+
<Icon icon="circle-xmark" iconType="solid" color="#E11D48" size={17} /> **Failed**: The task has failed
57+
to complete successfully.
4858

49-
<Icon icon="alarm-exclamation" iconType="solid" color="#E11D48" size={17} /> **Timed out**: Task has failed because it exceeded its `maxDuration`.
59+
<Icon icon="alarm-exclamation" iconType="solid" color="#E11D48" size={17} /> **Timed out**: Task has
60+
failed because it exceeded its `maxDuration`.
5061

51-
<Icon icon="fire" iconType="solid" color="#E11D48" size={17} /> **Crashed**: The worker process crashed during execution (likely due to an Out of Memory error).
62+
<Icon icon="fire" iconType="solid" color="#E11D48" size={17} /> **Crashed**: The worker process crashed
63+
during execution (likely due to an Out of Memory error).
5264

53-
<Icon icon="bolt-slash" iconType="solid" color="#E11D48" size={17} /> **Interrupted**: In development mode, when the CLI is disconnected.
65+
<Icon icon="bolt-slash" iconType="solid" color="#E11D48" size={17} /> **Interrupted**: In development
66+
mode, when the CLI is disconnected.
5467

55-
<Icon icon="bug" iconType="solid" color="#E11D48" size={17} /> **System failure**: An unrecoverable system error has occurred.
68+
<Icon icon="bug" iconType="solid" color="#E11D48" size={17} /> **System failure**: An unrecoverable system
69+
error has occurred.
5670

57-
<Icon icon="trash-can" iconType="solid" color="#878C99" size={17} /> **Expired**: The run's Time-to-Live (TTL) has passed before it could start executing.
71+
<Icon icon="trash-can" iconType="solid" color="#878C99" size={17} /> **Expired**: The run's Time-to-Live
72+
(TTL) has passed before it could start executing.
5873

5974
## Attempts
6075

@@ -150,13 +165,13 @@ You can also replay runs from the dashboard using the same or different payload.
150165

151166
The `triggerAndWait()` function triggers a task and then lets you wait for the result before continuing. [Learn more about triggerAndWait()](/triggering#yourtask-triggerandwait).
152167

153-
![Run with triggerAndWait](/images/run-with-triggerAndWait().png)
168+
![Run with triggerAndWait](</images/run-with-triggerAndWait().png>)
154169

155170
#### batchTriggerAndWait()
156171

157172
Similar to `triggerAndWait()`, the `batchTriggerAndWait()` function lets you batch trigger a task and wait for all the results [Learn more about batchTriggerAndWait()](/triggering#yourtask-batchtriggerandwait).
158173

159-
![Run with batchTriggerAndWait](/images/run-with-batchTriggerAndWait().png)
174+
![Run with batchTriggerAndWait](</images/run-with-batchTriggerAndWait().png>)
160175

161176
### Runs API
162177

@@ -181,6 +196,18 @@ runs.cancel(runId);
181196

182197
These methods allow you to access detailed information about runs and their attempts, including payloads, outputs, parent runs, and child runs.
183198

199+
### Real-time updates
200+
201+
You can subscribe to run updates in real-time using the `subscribeToRun()` function:
202+
203+
```ts
204+
for await (const run of runs.subscribeToRun(runId)) {
205+
console.log(run);
206+
}
207+
```
208+
209+
For more on real-time updates, see the [Realtime](/realtime) documentation.
210+
184211
### Triggering runs for undeployed tasks
185212

186213
It's possible to trigger a run for a task that hasn't been deployed yet. The run will enter the "Waiting for deploy" state until the task is deployed. Once deployed, the run will be queued and executed normally.

0 commit comments

Comments
 (0)