Submitting a job
To Submit a job, post the desired job description to the POST endpoint. This guide goes through how to author a job description. The basic structure of that request is documented here.
In the request, the tasks list adds the individual tasks that should be run as part of the job:
{
"name": "My job",
"tasks": [
{
// ... a task ...
},
{
// ... another task ...
}
]
}
Resource handling
Typically a job requires input resources to operate on. Inside each task a list of input resources can be provided.
Using URNs to reference existing resources is the recommended way to specify required resources for a task. Simply add them to the list of inputs in the task:
{
// ... more ...
"inputs": [
{
{
"source": {
"uri": "urn:adsk:fc.scratch:us.prd:resource:@default/name"
},
"target": {
"path": "relative/path/to/where/the/resource/should_be_placed"
}
}
]
}
The URN should be an URN provided by the Resource API.
Specifying the executor
An executor also need to be specify for the task. To do this specify the name of the executor inside the task. Currently only bifrost is supported.
{
// ... more ...
"executor": "bifrost"
}
Adding per-executor specifics
Each individual executor may have their own payload definition for the per executor-specific information in the task description. This information is added to the payload section of the task description.
For instance, Bifrost executor payload
Adding requirements
Requirements may be specified in order to ensure that a minimum number of vCPUs or minimum amount of memory is available when executing the job.
{
// ... more ...
"requirements": {
"cpu": 4,
"memory": "4096"
}
}
The minimum CPU requirement is specified in number of vCPUs. The minimum memory requirement is specified in number of MBs.
Requirements are best effort, the API will attempt to run the job on an instance that meets the minimum requirements.
Note, however, that the number of vCPUs is not a performance guarantee, and that a certain amount of memory may not be available for the job to use, as some memory may be reserved for task management, execution and similar operations. The API may also choose to run the job on an instance that has a superior amount of vCPUs or memory.
Setting limitations
To set a limit on the time a particular job is allowed to run. For instance, to avoid costly mistakes. This can be set using the maxExecutionTimeInSeconds limit:
{
// ... more ...
"limitations": {
"maxExecutionTimeInSeconds": 7200
}
}
If no limit is given, the API will use a default value of one hour, but this may change in the future so do not depend of this being the default.
Putting it all together
{
"method": "POST",
"url": "https://developer.api.autodesk.com/flow/compute/v1/queues/{queueId}/jobs",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {token}"
},
"path": {
"queueId": "@default"
},
"body": {
"tasks": [
{
"executor": "{selectedExecutor}"
"context": {
},
"inputs": [
{
"source": {
"uri": "urn:adsk:fc.scratch:us.prd:resource:@default/{inputResource1}"
},
"target": {
"path": "relative/path/to/where/the/resource/should_be_placed"
}
},
{
"source": {
"uri": "urn:adsk:fc.scratch:us.prd:resource:@default/{inputResource2}"
},
"target": {
"path": "another/relative/path"
}
}
],
"limitations": {
"maxExecutionTimeInSeconds": 7200
},
"payload": {
... selected executor specific payload
},
"requirements": {
"cpu": 4,
"memory": "4096"
}
}
]
}
}