Set execution hints at tool level

In the visual interface

  1. Go to the Apps tab of your project dashboard.
  2. Click the ellipsis icon  corresponding to the tool you want to edit and select Edit. Tool Editor opens. Follow the steps below to set the computation instance for your execution or CPU and memory requirements.

Set the computation instance

  1. Once in the Tool Editor, scroll down to the Hints section.
  2. Click Add a Hint.
  3. In the Class field, select sbg:AWSInstanceType or sbg:GoogleInstanceType, depending on your cloud provider preference (Amazon Web Services or Google Cloud Platform).
  4. In the Value field, select the instance type you find suitable for your tool. 
  5. (Optional) If needed, adjust the value of Attached storage that will be used by your instance during computation.
  6. Click  in the top-right corner to save the changes. You have now configured your tool to explicitly use the specified computation instance.

Set CPU and memory requirements

  1. In the Tool Editor, scroll down to the Computational Requirements section.
  2. In the Memory [MiB] field enter the minimum required amount of memory for the execution of the tool.
  3. In the CPU field enter the minimum required number of CPUs.
  4. Click  in the top-right corner to save the changes. You have now configured the CPU and memory requirements for the tool.

Via the API

To set tool-level instance type, CPU and memory requirements via the API, those values need to be included in the CWL specification of the tool when adding a new app or adding a new revision of an app

Define the instance type

To set the computation instance for your tool, the tool's CWL specification needs to contain the corresponding instance type hint and its value. A hint is represented by a JSON object with the following fields:

KeyDescription
classThe name of the hint to set
valueThe value to assign to this hint

For the instance type, there are two available hints, sbg:AWSInstanceType or sbg:GoogleInstanceType, depending on your cloud provider preference (Amazon Web Services or Google Cloud Platform). The example below shows how to use the instance type hint in your CWL code:

{
  ...
    "hints": [
      {
        "class": "sbg:AWSInstanceType",
        "value": "c4.8xlarge;ebs-gp2;2000"
      }

    ],
  ...
}

The value of the instance hint consists of the following three parts, separated by colons:

  • instance type, e.g. c4.8xlarge
  • attached disk type - ebs-gp2
  • attached disk size in GB

Add CPU and memory requirements

CPU and memory requirements are added in different ways for tools described using the sbg:draft-2 version of CWL and those described in CWL v1.x.

Set CPU and memory requirements for CWL v1.x tools

Tools described using CWL v1.x versions have CPU and memory requirements defined using the following keys:

KeyDescription
ramMinMinimum amount of RAM memory required for tool execution.
coresMinMinimum number of CPUs required for tool execution.

The values specified above are placed in the requirements array in the tool's CWL code, with the first element of the array being "class": "ResourceRequirement". See the details in the example below:

...    
    "requirements": [
        {
            "class": "ResourceRequirement",
            "ramMin": 2048,
            "coresMin": 2
        }
    ],
...

Set CPU and memory requirements for sbg:draft-2 tools

For sbg:draft-2 tools, CPU and memory requirements are set by adding the following hints to the hints array in the CWL specification: 

KeyDescription
sbg:MemRequirementMinimum amount of RAM memory required for tool execution.
sbg:CPURequirementMinimum number of CPUs required for tool execution.

This is an example of how the hints are added to the actual sbg:draft-2 CWL code:

{
...
  "hints": [
    {
      "class": "sbg:CPURequirement",
      "value": "2"
    },
    {
      "class": "sbg:MemRequirement",
      "value": "2048"
    }
  ],
...
}