Workflow Spec
Last updated
Last updated
defaults
At the top of the yaml workflow file you can specify default parameters to be used throughout the entire workflow. This includes environment variables, default machine instance configuration.
inputs
The inputs
block allows you to specify versioned dataset to be referenced and consumed by your jobs. Note, you can also collect these in a separate inputs.yaml
file and reference this file when creating a workflow run.
jobs
Jobs are also sometimes referred to as "steps" within the Gradient Workflow. A job is an individual task that executes code (such as a training a machine learning model) and can produce outputs (i.e. versioned datasets).
defaults:
# default environment variables for all jobs, can use any supported
# substitution syntax (named secrets, ephemeral secrets, etc...)
env:
HELLO: secret:hello
# default instance type for all jobs
resources:
instance-type: metal-cpu
{
"cluster": {
"id": "cla7rjbzg"
},
"id": 1,
"spec": {
"defaults": {
"env": {
"HELLO": "secret:hello"
},
"resources": {
"instance-type": "metal-cpu"
}
},
"inputs": {
"data": {
"type": "dataset"
},
"echo": {
"type": "string"
}
},
"jobs": {
"job-1": {
"env": {
"FOOBAR": "test"
},
"inputs": {
"data": "workflow.inputs.data",
"echo": "workflow.inputs.echo"
},
"outputs": {
"data2": {
"type": "dataset",
"with": {
"id": "test-two"
}
},
"echo2": {
"type": "string"
}
},
"uses": "container@v1",
"with": {
"args": [
"bash",
"-c",
"find /inputs/data > /outputs/data2/list.txt; echo ENV $HELLO $FOOBAR > /outputs/echo2"
],
"image": "bash:5"
}
},
"job-2": {
"inputs": {
"data2": "job-1.outputs.data2",
"echo2": "job-1.outputs.echo2"
},
"needs": [
"job-1"
],
"outputs": {
"data3": {
"type": "dataset",
"with": {
"id": "test-three"
}
}
},
"uses": "container@v1",
"with": {
"args": [
"bash",
"-c",
"wc -l /inputs/data2/list.txt > /outputs/data3/summary.txt; cat /inputs/echo2"
],
"image": "bash:5"
}
}
}
},
"status": {
"finished": "2020-12-31T22:50:47.000Z",
"inputs": {
"data": {
"dataset": {
"id": "test-one:qdwlyje"
},
"with": {
"id": "test-one"
}
},
"echo": {
"with": {
"value": "hello world"
}
}
},
"jobs": {
"job-1": {
"finished": "2020-12-31T22:50:33.000Z",
"logId": "wfrjb704734fbbd24348894fa0f0ffb10581",
"outputs": {
"data2": {
"dataset": {
"id": "test-two:zfk5vqx",
"isCommitted": true
}
}
},
"phase": "SUCCEEDED",
"started": "2020-12-31T22:50:30.000Z"
},
"job-2": {
"finished": "2020-12-31T22:50:39.000Z",
"logId": "wfrj2d106a58ee7b4e66b0bd26946a43db5f",
"outputs": {
"data3": {
"dataset": {
"id": "test-three:atef63i",
"isCommitted": true
}
}
},
"phase": "SUCCEEDED",
"started": "2020-12-31T22:50:34.000Z"
}
},
"logId": "wfr31c0dbeae5d347cba4ff3690c9f36888",
"phase": "SUCCEEDED",
"started": "2020-12-31T22:50:25.000Z"
}
}