You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/runs/metadata.mdx
+139-3Lines changed: 139 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,11 @@ sidebarTitle: "Metadata"
4
4
description: "Attach a small amount of data to a run and update it as the run progresses."
5
5
---
6
6
7
-
You can attach up to 4KB (4,096 bytes) of metadata to a run, which you can then access from inside the run function, via the API, and in the dashboard. You can use metadata to store additional, structured information on a run. For example, you could store your user’s full name and corresponding unique identifier from your system on every task that is associated with that user.
7
+
You can attach up to 256KB of metadata to a run, which you can then access from inside the run function, via the API, Realtime, and in the dashboard. You can use metadata to store additional, structured information on a run. For example, you could store your user’s full name and corresponding unique identifier from your system on every task that is associated with that user. Or you could store the progress of a long-running task, or intermediate results that you want to access later.
8
8
9
9
## Usage
10
10
11
-
Add metadata to a run by passing it as an object to the `trigger` function:
11
+
Add metadata to a run when triggering by passing it as an object to the `trigger` function:
Tasks that have been triggered by a parent task (a.k.a. a "child task") can update the metadata of the parent task. This is useful for propagating progress information up the task hierarchy. You can also update the metadata of the root task (root = the initial task that was triggered externally, like from your backend).
404
+
405
+
To update the parent task's metadata, use the `metadata.parent` accessor:
An example of where you might use parent and root updates is in a task that triggers multiple child tasks in parallel. You could use the parent metadata to track the progress of the child tasks and update the parent task's progress as each child task completes:
Metadata is NOT propagated to child tasks. If you want to pass metadata to a child task, you must do so explicitly:
@@ -488,4 +624,4 @@ See the [API reference](/management/runs/retrieve) for more information.
488
624
489
625
## Size limit
490
626
491
-
The maximum size of the metadata object is 4KB. If you exceed this limit, the SDK will throw an error. If you are self-hosting Trigger.dev, you can increase this limit by setting the `TASK_RUN_METADATA_MAXIMUM_SIZE` environment variable. For example, to increase the limit to 16KB, you would set `TASK_RUN_METADATA_MAXIMUM_SIZE=16384`.
627
+
The maximum size of the metadata object is 256KB. If you exceed this limit, the SDK will throw an error. If you are self-hosting Trigger.dev, you can increase this limit by setting the `TASK_RUN_METADATA_MAXIMUM_SIZE` environment variable. For example, to increase the limit to 16KB, you would set `TASK_RUN_METADATA_MAXIMUM_SIZE=16384`.
0 commit comments