Worker Execution¶
Endpoints
A worker execution is a record of an individual worker's run within a workflow execution, capturing its status, result, and timing details.
The worker execution object¶
What a worker execution object looks like?
{
"id": "wkex_3bNhXpQrLo7TmK2sJfGvWe1cA",
"status": "COMPLETED",
"worker_id": "wrkr_aVFPQTerHF2JaO0hILbp959v7",
"worker_name": "Starter",
"worker_type": "STARTER",
"workflow_execution_id": "wfex_T1eYymTSIptJ4Hyt1Z6p4uGOe",
"workflow_id": "wrkf_P95OLO61oGM5NwFn3W4iMl7rs",
"workflow_name": "File Generator Workflow",
"trigger": "API",
"created": 1632835285,
"updated": 1632835287,
"started": 1632835286,
"duration": 1.54,
"cpu_time": 1.17,
"result": {},
"input_params": {}
}
| Property | Description |
|---|---|
id string |
Unique identifier (UID) for the worker execution. |
status string |
The current status of the worker execution. It can be PREPARING, RUNNING, COMPLETED, FAILED or TIMEOUT. FAILED and TIMEOUT are failures. |
worker_id string |
The unique identifier of the worker that was executed. |
worker_name string |
The name of the worker that was executed. |
worker_type string |
The type of worker. It can be STARTER, BASIC, FORKER, BARRIER, CONDITIONAL, BRIDGE, TRY, CATCH or ENDER. |
workflow_execution_id string |
The unique identifier of the parent workflow execution. |
workflow_id string |
The unique identifier of the workflow. |
workflow_name string |
The name of the workflow. |
trigger string |
The type of trigger that initiated the workflow execution. |
created timestamp |
Time at which the worker execution was created. Measured in seconds since the Unix epoch. |
updated timestamp |
Time at which the worker execution was last updated. Measured in seconds since the Unix epoch. |
started timestamp |
Time at which the worker execution was started. Measured in seconds since the Unix epoch. |
duration number |
Total wall-clock time in seconds for the worker execution. |
cpu_time number |
Total CPU time in seconds consumed by the worker execution. |
result object |
The output data produced by the worker after execution. |
input_params object |
The input parameters passed to the worker. |
version string |
Indicates the worker execution's current version. |
List worker executions¶
Returns the worker executions of one workflow execution, grouped by worker. Each item has execution, an object. A worker that runs in parallel (after a Forker) has "is_parallel_execution": true and executions, an array with one execution per parallel branch, sorted by parallel_index. parallel_index_max is the highest parallel_index in the run, or -1 when nothing runs in parallel.
To list worker executions for a workflow, run the following:
The above call returns the following JSON object:
{
"worker_executions": [
{
"worker_id": "wrkr_aVFPQTerHF2JaO0hILbp959v7",
"worker_name": "Starter",
"is_parallel_execution": false,
"execution": {
"id": "wkex_3bNhXpQrLo7TmK2sJfGvWe1cA",
"worker_id": "wrkr_aVFPQTerHF2JaO0hILbp959v7",
"worker_name": "Starter",
"worker_type": "STARTER",
"status": "COMPLETED",
"created": 1632835285,
"started": 1632835286,
"ended": 1632835287,
"duration": 1.54,
"parallel_index": -1
}
},
...
],
"parallel_index_max": -1
}
HTTP Request
GET /workflows/:id/worker_executions
HTTP Parameters
| Parameter | Description |
|---|---|
id string |
REQUIRED A unique identifier (UID) for the workflow. |
workflow_execution_id string |
REQUIRED The workflow execution whose worker executions you want. If you leave it out or send an invalid id, the API returns an empty list. |
with_result boolean |
optional, default is False When True, the result data of each worker execution will be included. In most cases it has no effect: when the workflow execution has a stored resume, the API returns it as it is. |
Retrieve a worker execution¶
Retrieves the details of a specific worker execution by supplying the worker execution's id.
To retrieve a worker execution, run the following:
The above call returns the following JSON object:
{
"worker_execution": {
"id": "wkex_3bNhXpQrLo7TmK2sJfGvWe1cA",
"status": "COMPLETED",
"worker_id": "wrkr_aVFPQTerHF2JaO0hILbp959v7",
"worker_name": "Starter",
"worker_type": "STARTER",
"workflow_execution_id": "wfex_T1eYymTSIptJ4Hyt1Z6p4uGOe",
"workflow_id": "wrkf_P95OLO61oGM5NwFn3W4iMl7rs",
"workflow_name": "File Generator Workflow",
"trigger": "API",
"created": 1632835285,
"updated": 1632835287,
"started": 1632835286,
"duration": 1.54,
"cpu_time": 1.17,
"result": {},
"input_params": {}
}
}
HTTP Request
GET /workflows/:id/worker_executions
HTTP Parameters
| Parameter | Description |
|---|---|
id string |
REQUIRED A unique identifier (UID) for the workflow. |
worker_execution_id string |
REQUIRED A unique identifier (UID) for the worker execution. |
with_result boolean |
optional, default is True When True, the response includes result and input_params. When False, both are null. |