Closed kymr closed 6 years ago
{
"name": "encode_task",
"retryCount": 3,
"timeoutSeconds": 1200,
"inputKeys": [
"sourceRequestId",
"qcElementType"
],
"outputKeys": [
"state",
"skipped",
"result"
],
"timeoutPolicy": "TIME_OUT_WF",
"retryLogic": "FIXED",
"retryDelaySeconds": 600,
"responseTimeoutSeconds": 3600
}
field | description | Notes |
---|---|---|
name | Task Type | Unique |
retryCount | No. of retries to attempt when a task is marked as failure | |
retryLogic | Mechanism for the retries | see possible values below |
timeoutSeconds | Time in milliseconds, after which the task is marked as TIMED_OUT if not completed after transiting to IN_PROGRESS status | No timeouts if set to 0 |
timeoutPolicy | Task's timeout policy | see possible values below |
responseTimeoutSeconds | if greater than 0, the task is rescheduled if not updated with a status after this time. Useful when the worker polls for the task but fails to complete due to errors/network failure. | |
outputKeys | Set of keys of task's output. Used for documenting task's output |
{
"name": "encode_and_deploy",
"description": "Encodes a file and deploys to CDN",
"version": 1,
"tasks": [
{
"name": "encode",
"taskReferenceName": "encode",
"type": "SIMPLE",
"inputParameters": {
"fileLocation": "${workflow.input.fileLocation}"
}
},
{
"name": "deploy",
"taskReferenceName": "d1",
"type": "SIMPLE",
"inputParameters": {
"fileLocation": "${encode.output.encodeLocation}"
}
}
],
"outputParameters": {
"cdn_url": "${d1.output.location}"
},
"schemaVersion": 2
}
field | description | Notes |
---|---|---|
name | Name of the workflow | |
description | Descriptive name of the workflow | |
version | Numeric field used to identify the version of the schema. Use incrementing numbers | When starting a workflow execution, if not specified, the definition with highest version is used |
tasks | An array of task definitions as described below. | |
outputParameters | JSON template used to generate the output of the workflow | If not specified, the output is defined as the output of the last executed task |
inputParameters | List of input parameters. Used for documenting the required inputs to workflow | optional |
field | description | Notes |
---|---|---|
name | Name of the task. MUST be registered as a task type with Conductor before starting workflow | |
taskReferenceName | Alias used to refer the task within the workflow. MUST be unique. | |
type | Type of task. SIMPLE for tasks executed by remote workers, or one of the system task types | |
description | Description of the task | optional |
optional | true or false. When set to true - workflow continues even if the task fails. The status of the task is reflected as COMPLETED_WITH_ERRORS | Defaults to false |
inputParameters | JSON template that defines the input given to the task | See "wiring inputs and outputs" for details |
${SOURCE.input/output.JSONPath}
SOURCE | can be either "workflow" or reference name of any of the task |
---|---|
input/output | refers to either the input or output of the source |
JSONPath | JSON path expression to extract JSON fragment from source's input/output |
Consider a task with input configured to use input/output parameters from workflow and a task named loc_task.
{
"inputParameters": {
"movieId": "${workflow.input.movieId}",
"url": "${workflow.input.fileLocation}",
"lang": "${loc_task.output.languages[0]}",
"http_request": {
"method": "POST",
"url": "http://example.com/${loc_task.output.fileId}/encode",
"body": {
"recipe": "${workflow.input.recipe}",
"params": {
"width": 100,
"height": 100
}
},
"headers": {
"Accept": "application/json",
"Content-Type": "application/json"
}
}
}
}
Consider the following as the workflow input
{
"movieId": "movie_123",
"fileLocation":"s3://moviebucket/file123",
"recipe":"png"
}
And the output of the loc_task as the following;
{
"fileId": "file_xxx_yyy_zzz",
"languages": ["en","ja","es"]
}
When scheduling the task, Conductor will merge the values from workflow input and loc_task's output and create the input to the task as follows:
{
"movieId": "movie_123",
"url": "s3://moviebucket/file123",
"lang": "en",
"http_request": {
"method": "POST",
"url": "http://example.com/file_xxx_yyy_zzz/encode",
"body": {
"recipe": "png",
"params": {
"width": 100,
"height": 100
}
},
"headers": {
"Accept": "application/json",
"Content-Type": "application/json"
}
}
}
Link