Modify a task

/tasks/{task_id}

For general information on the API, including formatting, parameters, and pagination, please see the API Overview.

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

Request

Example request

PATCH /v2/tasks/bd5e95d9-12b3-789c-45b6-34d8696571a9 HTTP/1.1
Host: cavatica-api.sbgenomics.com
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://cavatica-api.sbgenomics.com/v2/tasks/bd5e95d9-12b3-789c-45b6-34d8696571a9"

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 CAVATICA 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. Includes the instance type setting (instance_type) and/or the maximum number of parallel instances setting (max_parallel_instances):


instance_type: Possible value is the specific instance type, e.g. "instance_type": "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.
"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:

  1. 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.

  2. If you want to disable batching on a task, set batch to false. Or, you can also set the parameters batch_input and batch_by to null.

{
    "batch": false    
}

Example request body

{   "description": "my draft task",
    "name": "RFranklin, Experiment IV",
 		"use_interruptible_instances": false,
    "execution_settings": {
            "instance_type": "c4.2xlarge;ebs-gp2;2000",
            "max_parallel_instances": 1
        },
    "inputs": {
        "cuffdiff_zip": {
            "class": "File",
            "path": "567890abc9b0307bc0414164",
            "name": "example_human_known_indels.vcf"
        }
    }
}

Response

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

Example response body

{
  "href": "https://cavatica-api.sbgenomics.com/v2/tasks/67f68072-45b6-12b3-789c-37be8b0f2f04",
  "id": "67f68072-45b6-12b3-789c-37be8b0f2f04",
  "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": "567890abc8a5136ec6127063",
      "name": "example_human_known_indels.vcf"
    },
    "density_threshold": null,
    "thresholds_off": null
  },
  "outputs": {
    "archive": null,
    "html": null
  }
}
Language