runs.subscribeToBatch
Subscribes to all changes for runs in a batch.
This function subscribes to all changes for runs in a batch. It returns an async iterator that yields the a run object whenever a run in the batch is updated. The iterator does not complete on it’s own, you must manually break
the loop when you want to stop listening for updates.
Authentication
This function supports both server-side and client-side authentication. For server-side authentication, use your API key. For client-side authentication, you must generate a public access token with one of the following scopes:
read:batch:<batchId>
read:runs
will provide access to all runs (not recommended for production use)
To generate a public access token, use the auth.createPublicToken
function:
Response
The AsyncIterator yields an object with the following properties:
The run ID.
The task identifier.
The input payload for the run.
The output result of the run.
Timestamp when the run was created.
Timestamp when the run was last updated.
Sequential number assigned to the run.
Current status of the run.
Duration of the run in milliseconds.
Total cost of the run in cents.
Base cost of the run in cents before any additional charges.
Array of tags associated with the run.
Key used to ensure idempotent execution.
Timestamp when the run expired.
Time-to-live duration for the run.
Timestamp when the run finished.
Timestamp when the run started.
Timestamp until which the run is delayed.
Timestamp when the run was queued.
Additional metadata associated with the run.
Error information if the run failed.
Indicates whether this is a test run.
Was this page helpful?