Task Executor API
Task Executor API is designed to allow implement task executor in any programming language and use it in Aidbox via REST requests with RPC calls.
awf.task/poll
awf.task/poll
Fetches a task in the status ready
from the queue and changes its status to requested
.
Immediately returns an empty array if there are no tasks in the queue.
Either taskDefinitions or workflowDefinitions parameter SHOULD be specified.
Params:
Parameter | Type | Required | Description |
---|---|---|---|
taskDefinitions | string[] | An array of task definitions to include. | |
workflowDefinitions | string[] | An array of workflow definitions to include. In response, decision tasks will be returned for specified workflow if available. | |
maxBatchSize | integer | The number of tasks that can be polled from the queue simultaneously. Default value: 1 |
Result:
Parameter | Type | Description |
---|---|---|
resources | object[] | AidboxTask resources with |
awf.task/long-poll
awf.task/long-poll
Fetches a task in the status ready
from the queue and changes its status to requested
.
Waits for a timeout unless a new task is received. In case of timeout, returns an empty array.
Either taskDefinitions or workflowDefinitions parameter SHOULD be specified.
Params:
Parameter | Type | Required | Description |
---|---|---|---|
taskDefinitions | string[] | An array of task definitions to include. | |
workflowDefinitions | string[] | An array of workflow definitions to include. In response, decision tasks will be returned for specified workflow if available. | |
maxBatchSize | integer | The number of tasks that can be polled from the queue simultaneously. Default value: 1 | |
timeout | integer | A period of time in ms, the period of time during which the tasks can be polled. Default value: 60000 (equal to 1 minute) |
Result:
Parameter | Type | Description |
---|---|---|
resources | object[] | AidboxTask resources with |
awf.task/start
awf.task/start
Changes the status of a task from requested
to in-progress
and start its execution.
The required param of execId
is supposed to be received from the requestawf.task/poll
or awf.task/long-poll
.
Params:
Parameter | Type | Required | Description |
---|---|---|---|
id | string | Identifier of the Task resource. | |
execId | string | Execution id of the task. Used to avoid duplicate task executions. |
Result:
Parameter | Type | Description |
---|---|---|
resource | object | Started AidboxTask resource. |
awf.task/notify
awf.task/notify
Notifies Task Service that a task is still alive.
After receiving notification, Task Service creates AidboxTaskLog resource with values of extra params fields below.
Notification Types:
Notification Type | Description |
---|---|
| Prolongs the |
| Prolongs the |
Params:
Parameter | Type | Required | Description |
---|---|---|---|
id | string | Identifier of the Task resource. | |
execId | string | Execution id of the task. Used to avoid duplicate task executions. | |
notification | string |
Extra Params
Depending on the Notification Types:, the following params are needed.
These parameters with notification type will be recorded in AidboxTaskLog resource after handling API request.
For heartbeat
Notification Type :
heartbeat
Notification Type :Parameter | Type | Required | Description |
---|---|---|---|
message | string | A string message about any additional information. |
For progress
Notification Type :
progress
Notification Type :Parameter | Type | Required | Description |
---|---|---|---|
progress-current | integer | The current value of progress in an integer
(The numerator of | |
progress-total | integer | The total value of progress in an integer
(The dominator of | |
progress-unit | string | The unit for the values of |
Result:
Parameter | Type | Description |
---|---|---|
inProgressTimeoutAt | integer | The renewed |
awf.task/success
awf.task/success
Changes the status of a task from in-progress
to done
, setting the outcome to succeeded
.
Params:
Parameter | Type | Required | Description |
---|---|---|---|
id | string | Identifier of the Task resource. | |
execId | string | Execution id of the task. Used to avoid duplicate task executions. | |
result | object | Result with which task was succeeded. |
Result:
Parameter | Type | Description |
---|---|---|
resource | object | Succeeded AidboxTask resource. |
awf.task/fail
awf.task/fail
Changes the status of a task from in-progress
to done
, setting the outcome to failed
.
Params:
Parameter | Type | Required | Description |
---|---|---|---|
id | string | Identifier of the Task resource. | |
execId | string | Execution id of the task. Used to avoid duplicate task executions. | |
error | object | Error with which task was failed. |
Result:
Parameter | Type | Description |
---|---|---|
resource | object | Failed AidboxTask resource. |
Last updated