The Task Execution Service (TES) API is a standardized schema and API for describing and executing batch execution tasks. A task defines a set of input files, a set of containers and commands to run, a set of output files and some other logging and metadata.
TES servers accept task documents and execute them asynchronously on available compute resources. A TES server could be built on top of a traditional HPC queuing system, such as Grid Engine, Slurm or cloud style compute systems such as AWS Batch or Kubernetes.
This document describes the TES API and provides details on the specific endpoints, request formats, and responses. It is intended to provide key information for developers of TES-compatible services as well as clients that will call these TES services. Use cases include:
Deploying existing workflow engines on new infrastructure. Workflow engines such as CWL-Tes and Cromwell have extentions for using TES. This will allow a system engineer to deploy them onto a new infrastructure using a job scheduling system not previously supported by the engine.
Developing a custom workflow management system. This API provides a common interface to asynchronous batch processing capabilities. A developer can write new tools against this interface and expect them to work using a variety of backend solutions that all support the same specification.
The TES API specification is written in OpenAPI and embodies a RESTful service philosophy. It uses JSON in requests and responses and standard HTTP/HTTPS for information transport. HTTPS should be used rather than plain HTTP except for testing or internal-only purposes.
Is is envisaged that most TES API instances will require users to authenticate to use the endpoints. However, the decision if authentication is required should be taken by TES API implementers.
If authentication is required, we recommend that TES implementations use an OAuth2 bearer token, although they can choose other mechanisms if appropriate.
Checking that a user is authorized to submit TES requests is a responsibility of TES implementations.
If TES API implementation is to be used by another website or domain it must implement Cross Origin Resource Sharing (CORS). Please refer to https://w3id.org/ga4gh/product-approval-support/cors for more information about GA4GH’s recommendations and how to implement CORS.
Provides information about the service, this structure is based on the standardized GA4GH service info structure. In addition, this endpoint will also provide information about customized storage endpoints offered by the TES server.
{- "id": "org.ga4gh.myservice",
- "name": "My project",
- "type": {
- "group": "org.ga4gh",
- "artifact": "tes",
- "version": "1.0.0"
}, - "description": "This service provides...",
- "contactUrl": "mailto:support@example.com",
- "createdAt": "2019-06-04T12:58:19Z",
- "updatedAt": "2019-06-04T12:58:19Z",
- "environment": "test",
- "version": "1.0.0",
- "storage": [
- "file:///path/to/local/funnel-storage",
- "s3://ohsu-compbio-funnel/storage"
], - "tesResources_backend_parameters": [
- "VmSize"
]
}
List tasks tracked by the TES server. This includes queued, active and completed tasks. How long completed tasks are stored by the system may be dependent on the underlying implementation.
name_prefix | string OPTIONAL. Filter the list to include tasks where the name matches this prefix. If unspecified, no task name filtering is done. |
state | string (tesState) Default: "UNKNOWN" Enum: "UNKNOWN" "QUEUED" "INITIALIZING" "RUNNING" "PAUSED" "COMPLETE" "EXECUTOR_ERROR" "SYSTEM_ERROR" "CANCELED" "PREEMPTED" "CANCELING" Example: state=COMPLETE OPTIONAL. Filter tasks by state. If unspecified, no task state filtering is done. |
tag_key | Array of strings OPTIONAL. Provide key tag to filter. The field tag_key is an array of key values, and will be zipped with an optional tag_value array. So the query:
Should be constructed into the structure { "foo1" : "bar1", "foo2" : "bar2"}
Should be constructed into the structure {"foo1" : ""} If the tag_value is empty, it will be treated as matching any possible value. If a tag value is provided, both the tag's key and value must be exact matches for a task to be returned. Filter Tags Match? {"foo": "bar"} {"foo": "bar"} Yes {"foo": "bar"} {"foo": "bat"} No {"foo": ""} {"foo": ""} Yes {"foo": "bar", "baz": "bat"} {"foo": "bar", "baz": "bat"} Yes {"foo": "bar"} {"foo": "bar", "baz": "bat"} Yes {"foo": "bar", "baz": "bat"} {"foo": "bar"} No {"foo": ""} {"foo": "bar"} Yes {"foo": ""} {} No |
tag_value | Array of strings OPTIONAL. The companion value field for tag_key |
page_size | integer <int32> Optional number of tasks to return in one page. Must be less than 2048. Defaults to 256. |
page_token | string OPTIONAL. Page token is used to retrieve the next page of results.
If unspecified, returns the first page of results. The value can be found
in the |
view | string Default: "MINIMAL" Enum: "MINIMAL" "BASIC" "FULL" OPTIONAL. Affects the fields included in the returned Task messages.
|
{- "tasks": [
- {
- "id": "job-0012345",
- "state": "COMPLETE",
- "name": "string",
- "description": "string",
- "inputs": [
- {
- "url": "s3://my-object-store/file1",
- "path": "/data/file1"
}
], - "outputs": [
- {
- "path": "/data/outfile",
- "url": "s3://my-object-store/outfile-1",
- "type": "FILE"
}
], - "resources": {
- "cpu_cores": 4,
- "preemptible": false,
- "ram_gb": 8,
- "disk_gb": 40,
- "zones": "us-west-1",
- "backend_parameters": {
- "VmSize": "Standard_D64_v3"
}, - "backend_parameters_strict": false
}, - "executors": [
- {
- "image": "ubuntu:20.04",
- "command": [
- "/bin/md5",
- "/data/file1"
], - "workdir": "/data/",
- "stdin": "/data/file1",
- "stdout": "/tmp/stdout.log",
- "stderr": "/tmp/stderr.log",
- "env": {
- "BLASTDB": "/data/GRC38",
- "HMMERDB": "/data/hmmer"
}, - "ignore_error": true
}
], - "volumes": [
- "/vol/A/"
], - "tags": {
- "WORKFLOW_ID": "cwl-01234",
- "PROJECT_GROUP": "alice-lab"
}, - "logs": [
- {
- "logs": [
- {
- "start_time": "2020-10-02T10:00:00-05:00",
- "end_time": "2020-10-02T11:00:00-05:00",
- "stdout": "string",
- "stderr": "string",
- "exit_code": 0
}
], - "metadata": {
- "host": "worker-001",
- "slurmm_id": 123456
}, - "start_time": "2020-10-02T10:00:00-05:00",
- "end_time": "2020-10-02T11:00:00-05:00",
- "outputs": [
- {
- "url": "string",
- "path": "string",
- "size_bytes": [
- "1024"
]
}
], - "system_logs": [
- "string"
]
}
], - "creation_time": "2020-10-02T10:00:00-05:00"
}
], - "next_page_token": "string"
}
Create a new task. The user provides a Task document, which the server uses as a basis and adds additional fields.
name | string User-provided task name. |
description | string Optional user-provided description of task for documentation purposes. |
Array of objects (tesInput) Input files that will be used by the task. Inputs will be downloaded and mounted into the executor container as defined by the task request document. | |
Array of objects (tesOutput) Output files. Outputs will be uploaded from the executor container to long-term storage. | |
object (tesResources) Resources describes the resources requested by a task. | |
required | Array of objects (tesExecutor) An array of executors to be run. Each of the executors will run one at a time sequentially. Each executor is a different command that will be run, and each can utilize a different docker image. But each of the executors will see the same mapped inputs and volumes that are declared in the parent CreateTask message. Execution stops on the first error. |
volumes | Array of strings Volumes are directories which may be used to share data between Executors. Volumes are initialized as empty directories by the system when the task starts and are mounted at the same path in each Executor. For example, given a volume defined at (Essentially, this translates to a |
object A key-value map of arbitrary tags. These can be used to store meta-data and annotations about a task. Example:
|
{- "name": "string",
- "description": "string",
- "inputs": [
- {
- "url": "s3://my-object-store/file1",
- "path": "/data/file1"
}
], - "outputs": [
- {
- "path": "/data/outfile",
- "url": "s3://my-object-store/outfile-1",
- "type": "FILE"
}
], - "resources": {
- "cpu_cores": 4,
- "preemptible": false,
- "ram_gb": 8,
- "disk_gb": 40,
- "zones": "us-west-1",
- "backend_parameters": {
- "VmSize": "Standard_D64_v3"
}, - "backend_parameters_strict": false
}, - "executors": [
- {
- "image": "ubuntu:20.04",
- "command": [
- "/bin/md5",
- "/data/file1"
], - "workdir": "/data/",
- "stdin": "/data/file1",
- "stdout": "/tmp/stdout.log",
- "stderr": "/tmp/stderr.log",
- "env": {
- "BLASTDB": "/data/GRC38",
- "HMMERDB": "/data/hmmer"
}, - "ignore_error": true
}
], - "volumes": [
- "/vol/A/"
], - "tags": {
- "WORKFLOW_ID": "cwl-01234",
- "PROJECT_GROUP": "alice-lab"
}
}
{- "id": "string"
}
Get a single task, based on providing the exact task ID string.
id required | string ID of task to retrieve. |
view | string Default: "MINIMAL" Enum: "MINIMAL" "BASIC" "FULL" OPTIONAL. Affects the fields included in the returned Task messages.
|
{- "id": "job-0012345",
- "state": "COMPLETE",
- "name": "string",
- "description": "string",
- "inputs": [
- {
- "url": "s3://my-object-store/file1",
- "path": "/data/file1"
}
], - "outputs": [
- {
- "path": "/data/outfile",
- "url": "s3://my-object-store/outfile-1",
- "type": "FILE"
}
], - "resources": {
- "cpu_cores": 4,
- "preemptible": false,
- "ram_gb": 8,
- "disk_gb": 40,
- "zones": "us-west-1",
- "backend_parameters": {
- "VmSize": "Standard_D64_v3"
}, - "backend_parameters_strict": false
}, - "executors": [
- {
- "image": "ubuntu:20.04",
- "command": [
- "/bin/md5",
- "/data/file1"
], - "workdir": "/data/",
- "stdin": "/data/file1",
- "stdout": "/tmp/stdout.log",
- "stderr": "/tmp/stderr.log",
- "env": {
- "BLASTDB": "/data/GRC38",
- "HMMERDB": "/data/hmmer"
}, - "ignore_error": true
}
], - "volumes": [
- "/vol/A/"
], - "tags": {
- "WORKFLOW_ID": "cwl-01234",
- "PROJECT_GROUP": "alice-lab"
}, - "logs": [
- {
- "logs": [
- {
- "start_time": "2020-10-02T10:00:00-05:00",
- "end_time": "2020-10-02T11:00:00-05:00",
- "stdout": "string",
- "stderr": "string",
- "exit_code": 0
}
], - "metadata": {
- "host": "worker-001",
- "slurmm_id": 123456
}, - "start_time": "2020-10-02T10:00:00-05:00",
- "end_time": "2020-10-02T11:00:00-05:00",
- "outputs": [
- {
- "url": "string",
- "path": "string",
- "size_bytes": [
- "1024"
]
}
], - "system_logs": [
- "string"
]
}
], - "creation_time": "2020-10-02T10:00:00-05:00"
}