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://cgc-api.sbgenomics.com/v2/tasks/{task_id}

Request

Example request

PATCH /v2/tasks/08c5da64-1329-ba3e-b014-62a1617bc7db HTTP/1.1
Host: cgc-api.sbgenomics.com
X-SBG-Auth-Token: 3210a98c1db9318fa9d9273156740f74
curl  --data-binary "@modify-task.json" -s -H "X-SBG-Auth-Token: 3210a98c1db9318fa9d9273156740f74" -H "content-type: application/json" -X PATCH "https://cgc-api.sbgenomics.com/v2/tasks/08c5da64-1329-ba3e-b014-62a1617bc7db"

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 CGC 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
"execution_settings"dictionaryDetailed task execution parameters:
instance_type: Possible value is the specific instance type, e.g. "c4.2xlarge;ebs-gp2;2000".
max_parallel_instances - Maximum number of instances running at the same time. Takes any integer value equal to or greater than 1, e.g. "max_parallel_instances": 2.
use_memoization - Set to false by default. Set to true to enable memoization.
use_elastic_disk - Set to true to enable Elastic Disk
"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.
"use_interruptible_instances"booleanThis field can be true or false to enable or disable the use of spot/preemptible instances.

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",
  "use_interruptible_instances": false,
    "execution_settings": {
            "instance_type": "c4.2xlarge;ebs-gp2;2000",
            "max_parallel_instances": 1,
      			"use_memoization": true
        },
  "inputs": {
        "cuffdiff_zip": {
            "class": "File",
            "path": "562785e5c4b00a1d67a8b1aa",
            "name": "example_human_known_indels.vcf"
        }
}

Response

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

Example response body

{
  "href": "https://cgc-api.sbgenomics.com/v2/tasks/08c5da64-1329-ba3e-b014-62a1617bc7db",
 "id": "08c5da64-1329-ba3e-b014-62a1617bc7db",
  "name": "RFranklin, Experiment IV",
  "description": "my draft task",
  "status": "DRAFT",
  "project": "RFranklin/my-project",
  "use_interruptible_instances": false,
  "execution_settings": {
    "instance_type": "c4.2xlarge;ebs-gp2;2000",
    "max_parallel_instances": 1,
    "use_memoization": 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": "562785e5c4b00a1d67a8b1aa",
      "name": "example_human_known_indels.vcf"
    },
    "density_threshold": null,
    "thresholds_off": null
  },
  "outputs": {
    "archive": null,
    "html": null
  }
}
Language