Modify a task

/tasks/{task_id}

Change the details of the specified task, including its name, description, and inputs. The task is referred to by its ID, which you can obtain by making the call to list all tasks you can access.

Note that you can only modify tasks with a task status of DRAFT. Tasks which are RUNNING, QUEUED, ABORTED, COMPLETED or FAILEDcannot be modified in order to enable the reproducibility of analyses which have been queued for execution or has initiated executing.

See the section on task inputs for details on how to refer to a task's inputs.

https://api.sb.biodatacatalyst.nhlbi.nih.gov/v2/tasks/{task_id}

Request

Example request

PATCH /v2/tasks/f0b89de2-45b6-789c-12b3-05b832c576c6 HTTP/1.1
Host: api.sb.biodatacatalyst.nhlbi.nih.gov
X-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74
curl  --data-binary "@modify-task.json" -s -H "X-SBG-Auth-Token: 6282d5e2121d43e7900e9d52b15845e7" -H "content-type: application/json" -X PATCH "https://api.sb.biodatacatalyst.nhlbi.nih.gov/v2/tasks/f0b89de2-45b6-789c-12b3-05b832c576c6"

See below for an example of the content of the request, sent here as modify-task.json.

Header Fields

NameDescription
X-SBG-Auth-Token
required
Your authentication token.

Path parameters

NameDescription
task_id
required
The ID of the task you are querying

Query parameters

NameData typeDescription
fieldsstringSelector specifying a subset of fields to include in the response.

Request body

In the body of the request you should enter key-value pairs, as explained below:

KeyDatatype of valueDescription of value
"name"stringThe name of the task
"description"stringThe description of the task
"inputs"dictionarySee the API Overview section on specifying inputs for information on creating input objects.
"batch"BooleanThis is set to false by default. Set to true to create a batch task and specify the batch_input and batch-by as described below.
"batch_input"stringThe ID of the input on which you wish to batch. You would typically batch on the input consisting of a list of files. If this parameter is omitted, the default batching criteria defined for the app will be used.
"batch_by"dictionaryThis specifies the criteria on which to batch. It can be in one of two formats.

1. If you wish to batch per item in the app's input (i.e., typically per file in a list of files) then specify a dictionary with the following format:
{ "type": "ITEM" }

2. If you wish to batch by groups of inputs, you should specify the criteria satisfied by each group. This should be a common metadata value in one, or more, metadata fields.

To do this, specify a dictionary with the following format:

{ "type": "CRITERIA", "criteria": [ "metadata.<field_1>", "metadata.<field_2>" ] }
This will group inputs by shared metadata values for <field_1> and <field_2>, in that order. Arbitrarily many metadata fields may be listed, and the order in which fields are grouped will respect the order of the list.

There are two further things to note if you are editing a batch task:

If you want to change the input on which to batch and the batch criteria, you need to specify the batch_input and batch_by parameters together in the same PATCH request.

If you want to disable batching on a task, set the parameters batch_input and batch_by to the JSON null value, as follows:

{
    "batch_input": null,
    "batch_by" : null    
}

Example request body

{
  "name": "new name for my task",
  "description": "re-describing the task",
  "inputs": {

        "cuffdiff_zip": {
            "class": "File",
            "path": "567890abc8a5136ec6127063",
            "name": "example_human_known_indels.vcf"
        }
}

Response

See a list of response codes that may be contained in the body of the response.

Example response body

{
  "href": "https://api.sb.biodatacatalyst.nhlbi.nih.gov/v2/tasks/f0b89de2-45b6-789c-12b3-05b832c576c6",
 "id": "f0b89de2-45b6-789c-12b3-05b832c576c6",
  "name": "RFranklin, Experiment IV",
  "description": "my draft task",
  "status": "DRAFT",
  "project": "RFranklin/my-project",
  "use_interruptible_instances": true,
  "app": "RFranklin/my-project/new-test-app/0",
  "type": "v2",
  "created_by": "RFranklin",
  "start_time": "2016-01-12T19:20:10Z",
  "inputs": {
    "dispersion_threshold": null,
    "cuffdiff_zip": {
      "class": "File",
      "path": "567890abc3d8130ea4047731",
      "name": "example_human_known_indels.vcf"
    },
    "density_threshold": null,
    "thresholds_off": null
  },
  "outputs": {
    "archive": null,
    "html": null
  }
}