{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","settings":"","params":[],"results":{"codes":[]}},"next":{"description":"","pages":[]},"title":"Set computation instances","type":"basic","slug":"set-computation-instances","excerpt":"<a name=\"top\"></a>","body":"Each tool that is run in a task is executed on a computation instance in the cloud. Instances are virtual computers; different instance types have different allocations of CPU and memory, so are suited for workloads with different computational requirements.\n \nThe CGC uses a scheduling algorithm to select an appropriate computation instance for each tool that is run in a task. The algorithm assigns to each a tool an instance that has sufficient resources to run the tool, and, when running workflows made of multiple tools, is optimized to efficiently pack tools onto instances.\n\nWhile the scheduling algorithm will select a default instance that is suitable for your task, in some cases you might want to override the algorithm to select a specific instance type to run the task on. This page explains how to set the instance type for a task.\n[block:callout]\n{\n  \"type\": \"success\",\n  \"body\": \"To see how tool executions are fitted onto instances, take a look at [the scheduling algorithm](page:multi-instance-scheduling-algorithm) we use to allocate instances to tasks.\",\n  \"title\": \"The scheduling algorithm\"\n}\n[/block]\n##Available instance types\n\nAs a CGC user, you have access to the [AWS US East](doc:list-of-available-amazon-web-services-instances) and [Google Cloud Platform West](doc:list-of-available-google-cloud-platform-instances) cloud infrastructure.\n\nTo choose an instance type, simply specify it as a value for the `sbg:AWSInstanceType` or `sbg:GoogleInstanceType` hint.\n\n### Determining instance types\nAll public tools and workflows have defined requirements for CPU and memory. These are used by the scheduler on the CGC to pick a suitable computation instance for the app to be run on.  You can override this selection in a number of ways:\n\n* You can [set the instance type for an entire workflow](#section-set-the-instance-type-for-a-workflow). This will override any setting that you have made for any given tool in the workflow.\n* You can [set the instance type for any tool](#section-set-the-instance-type-for-a-tool) (either one you have added to the CGC yourself, using the SDK, or a public tool) using the tool editor.  This will override the instance type selected by the scheduler.\n* You can [set the instance type for any tool(s) in a workflow](#section-set-the-instance-type-for-a-tool-in-a-workflow-node-). This will override any setting you have made on the tool editor.\n* You can also set the instance type for a task. This will override any setting you have made on the workflow level, according to the following priority **task** > **workflow** > **node**.\n\n###Choose an instance type that is sufficient for your task\nIf you override the instance type that the scheduling algorithm selects on the basis of the app's required resources, and instead pick your own instance, you may inadvertently select one that doesn't have enough resources to run the app successfully. To make sure you pick a suitable instance, check the required resources of the tool you want to use. To do this, open the tool in the Tool Editor, by clicking the **Edit** button. Note that you can only edit a tool that is in one of your projects.\n\nThe Tool Editor contains fields labelled **CPU** and **Memory**. These contain the number of CPUs and amount of memory deemed necessary for running the tool by the person who wrapped it.\n\nIf you try to set an instance type that fails to meet a tool's required resources, then, wherever possible, you will see a warning notification. However, sometimes a tool's required resources are set dynamically. For instance, the tool may require two times as many CPUs as it has input files, and the number of input files to the tool will depend on the behavior of the tool before it in a pipeline. In this case, it may not be possible to raise an error about insufficient resources before running the app, and you will see an error during its execution.\n\nSee the documentation on [the Tool Editor](doc:about-the-tool-editor) for more information on how to describe a tool. In particular, see how to set a tool's [required resources](create-a-tool#section-computational-resources). For details of how dynamic expressions may be used, see the documentation on [dynamic expressions in tool descriptions](doc:dynamic-expressions-in-tool-descriptions-1).\n\n### Running instances in parallel\nYou can set the maximum number of instances to run in parallel for a workflow. See the instructions below on setting the instance type for an entire workflow for details.\n\n## Set the instance type for a workflow\nYou can set the instance for an entire workflow. This means that all tools in the workflow run on the selected instance type.\n\n1. To set the instance type for a workflow, you should add the workflow to a project. Then, on the **Apps** tab of the project dashboard, click the ellipses icon <i class=\"fa fa-ellipsis-h\" aria-hidden=\"true\"></i> next to the workflow and select **Edit**. Workflow Editor opens.\n2. In the top-right corner of the workflow editor click <i class=\"fa fa-ellipsis-h\" aria-hidden=\"true\"></i> and select **Set Hints**. You will see the **Set Hints** popup window.\n3. Click **Add a Hint** and enter the following information:\n  **To set the instance type:**\n  * In the **Class** field select `sbg:AWSInstanceType` or `sbg:GoogleInstanceType` depending on the cloud provider you want to use.\n  * In the **Value** field select an instance type from the list of available [AWS](doc:list-of-available-amazon-web-services-instances) or [GCP](doc:list-of-available-google-cloud-platform-instances)  instances. In the field on the right, you can set the size of [storage attached to the computation instance](#attached-storage-workflow).\n  * Click **Done**. You have successfully set the instance hint.\n\n **To set the maximum number of instances to be used in parallel:**\n  * Click **Add a Hint** to create new empty fields.\n  * In the **Class** field select `sbg:maxNumberOfParallelInstances`.\n  * In the **Value** field enter the maximum number of instances to be run in parallel as an integer.\n  * Click **Done**. You have successfully set the maximum number of parallel instances.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/f157050-set-computation-instance-cavatica-1.png\",\n        \"set-computation-instance-cavatica-1.png\",\n        798,\n        235,\n        \"#333\"\n      ],\n      \"caption\": \"\"\n    }\n  ]\n}\n[/block]\n## Set the instance type for a tool in a workflow (node)\nYou can set the instance type(s) of individual tools in a workflow. For instance, you might want to use a smaller, cheaper, instance type for most tools in your workflow, but provide one tool with a more powerful instance.\n\nNote that if you are running the tool on its own and not in a workflow, see the instructions on how to [set the instance type for a tool that is not in a workflow](doc:set-computation-instances#section-set-the-instance-type-for-a-tool).\n\n1. Select the workflow that you want to configure. This can be a public workflow (in which case, you must have [copied it to a project](http://docs.sevenbridges.com/docs/copy-public-apps-to-a-project) to edit it), or it can be a workflow [you have built yourself](doc:create-a-workflow-1).\n2. Click the ellipses icon <i class=\"fa fa-ellipsis-h\" aria-hidden=\"true\"></i> next to the workflow and select **Edit**. Workflow Editor opens.\n3. In the workflow editor, click the node representing the tool in the workflow whose instance you want to set. Double-clicking a node will show the object inspector on the right. Note that input and output nodes in a workflow don't represent tools, and you can't set their instances.\n4. In the object inspector, open the **Step** tab.\n5. Scroll to the bottom of the tab's contents and click **Set Hints**. The **Set Hints** popup window opens.\n5. Click **Add a Hint** and enter the following information:\n **To set the instance type:**\n  * In the **Class** field select `sbg:AWSInstanceType` or `sbg:GoogleInstanceType` depending on the cloud provider you want to use.\n  * In the **Value** field select an instance type from the list of available [AWS](doc:list-of-available-amazon-web-services-instances) or [GCP](doc:list-of-available-google-cloud-platform-instances)  instances. In the field on the right, you can set the size of [storage attached to the computation instance](#attached-storage-workflow).\n  * Click **Done**. You have successfully set the instance hint.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/5230662-set-computation-instance-cavatica-2.png\",\n        \"set-computation-instance-cavatica-2.png\",\n        798,\n        259,\n        \"#333\"\n      ],\n      \"caption\": \"\"\n    }\n  ]\n}\n[/block]\n##Set the instance type for a tool\nYou can set the instance type for a tool in [the Tool Editor](doc:about-the-tool-editor). \n1. To set the instance type for a tool, you should add it to a project. Then, on the **Apps** tab of the project dashboard, click the ellipses icon <i class=\"fa fa-ellipsis-h\" aria-hidden=\"true\"></i> next to the tool and select **Edit**. Tool Editor opens.\n2. In the Tool Editor scroll down to the **Hints** section.\n3. Click **Add a Hint** and enter the following information:\n  **To set the instance type:**\n  * In the **Class** field select `sbg:AWSInstanceType` or `sbg:GoogleInstanceType` depending on the cloud provider you want to use.\n  * In the **Value** field select an instance type from the list of available [AWS](doc:list-of-available-amazon-web-services-instances) or [GCP](doc:list-of-available-google-cloud-platform-instances)  instances. In the field on the right, you can set the size of [storage attached to the computation instance](#attached-storage-workflow).\n  * Click **Done**. You have successfully set the instance hint.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/f855aa3-set-computation-instance-cavatica-3.png\",\n        \"set-computation-instance-cavatica-3.png\",\n        798,\n        211,\n        \"#333\"\n      ],\n      \"caption\": \"\"\n    }\n  ]\n}\n[/block]\n\n### Set attached storage size\n\n<a name=\"attached-storage-workflow\"></a>\nWhen setting the `sbg:AWSInstanceType` or `sbg:GoogleInstanceType` instance hint, the configuration options are instance type and attached storage size. Attached storage includes disks that are used by the computation instance as storage capacity during task execution. To set up attached storage, in the field **Attached Storage**, enter the needed storage size:\n* If you have selected an instance that has its own storage (ephemeral storage), the storage size will be displayed in brackets next to the instance name. However, you can still define a different storage size (from 2 GB to 4096 GB) in the **Attached Storage** field, in which case **the CGC will use attached storage instead of the instance's ephemeral storage**, and attached storage costs will be added to the cost of running the computation instance. For AWS instances, read more about [EBS pricing](doc:cloud-infrastructure-pricing#section-amazon-ebs). For GCP instances, learn more about [Persistent disk pricing](https://cloud.google.com/compute/disks-image-pricing#persistentdisk).\n* If you have selected an Amazon EBS-only instance (no storage capacity shown in brackets next to CPU and memory values), you can change attached storage size to any value from 2 GB to 4096 GB in 1 GB increments. Attached storage costs will be added to the compute instance cost, according to the [EBS pricing model](doc:cloud-infrastructure-pricing#section-amazon-ebs) for AWS and [Persistent disk pricing](doc:cloud-infrastructure-pricing#section-compute-costs-google-cloud-platform) for GCP.","updates":["57f5838cba9c822b00d58b80"],"order":3,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5731d28b4245100e00174508","version":{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":true,"is_hidden":false,"is_deprecated":false,"categories":["55faf11ca62ba1170021a9ab","55faf8f4d0e22017005b8272","55faf91aa62ba1170021a9b5","55faf929a8a7770d00c2c0bd","55faf932a8a7770d00c2c0bf","55faf94b17b9d00d00969f47","55faf958d0e22017005b8274","55faf95fa8a7770d00c2c0c0","55faf96917b9d00d00969f48","55faf970a8a7770d00c2c0c1","55faf98c825d5f19001fa3a6","55faf99aa62ba1170021a9b8","55faf99fa62ba1170021a9b9","55faf9aa17b9d00d00969f49","55faf9b6a8a7770d00c2c0c3","55faf9bda62ba1170021a9ba","5604570090ee490d00440551","5637e8b2fbe1c50d008cb078","5649bb624fa1460d00780add","5671974d1b6b730d008b4823","5671979d60c8e70d006c9760","568e8eef70ca1f0d0035808e","56d0a2081ecc471500f1795e","56d4a0adde40c70b00823ea3","56d96b03dd90610b00270849","56fbb83d8f21c817002af880","573c811bee2b3b2200422be1","576bc92afb62dd20001cda85","5771811e27a5c20e00030dcd","5785191af3a10c0e009b75b0","57bdf84d5d48411900cd8dc0","57ff5c5dc135231700aed806","5804caf792398f0f00e77521","58458b4fba4f1c0f009692bb","586d3c287c6b5b2300c05055","58ef66d88646742f009a0216","58f5d52d7891630f00fe4e77","59a555bccdbd85001bfb1442","5a2a81f688574d001e9934f5","5b080c8d7833b20003ddbb6f","5c222bed4bc358002f21459a","5c22412594a2a5005cc9e919","5c41ae1c33592700190a291e","5c8a525e2ba7b2003f9b153c","5cbf14d58c79c700ef2b502e","5db6f03a6e187c006f667fa4","5f894c7d3b0894006477ca01","6176d5bf8f59c6001038c2f7"],"_id":"55faf11ba62ba1170021a9aa","releaseDate":"2015-09-17T16:58:03.490Z","createdAt":"2015-09-17T16:58:03.490Z","project":"55faf11ba62ba1170021a9a7","__v":48},"__v":10,"project":"55faf11ba62ba1170021a9a7","category":{"sync":{"isSync":false,"url":""},"pages":["5626a5d644c87f0d00fe6396","5626a5e4e2ce610d004e3dd8","5626a89ce2ce610d004e3dde","56429a87f49bfa0d002f54e0"],"title":"RUN AN ANALYSIS","slug":"run-an-analysis","order":22,"from_sync":false,"reference":false,"_id":"55faf96917b9d00d00969f48","project":"55faf11ba62ba1170021a9a7","__v":4,"createdAt":"2015-09-17T17:33:29.016Z","version":"55faf11ba62ba1170021a9aa"},"createdAt":"2016-05-10T12:22:35.221Z","githubsync":"","user":"554340dfb7f4540d00fcef1d","parentDoc":null}

Set computation instances

<a name="top"></a>

Each tool that is run in a task is executed on a computation instance in the cloud. Instances are virtual computers; different instance types have different allocations of CPU and memory, so are suited for workloads with different computational requirements. The CGC uses a scheduling algorithm to select an appropriate computation instance for each tool that is run in a task. The algorithm assigns to each a tool an instance that has sufficient resources to run the tool, and, when running workflows made of multiple tools, is optimized to efficiently pack tools onto instances. While the scheduling algorithm will select a default instance that is suitable for your task, in some cases you might want to override the algorithm to select a specific instance type to run the task on. This page explains how to set the instance type for a task. [block:callout] { "type": "success", "body": "To see how tool executions are fitted onto instances, take a look at [the scheduling algorithm](page:multi-instance-scheduling-algorithm) we use to allocate instances to tasks.", "title": "The scheduling algorithm" } [/block] ##Available instance types As a CGC user, you have access to the [AWS US East](doc:list-of-available-amazon-web-services-instances) and [Google Cloud Platform West](doc:list-of-available-google-cloud-platform-instances) cloud infrastructure. To choose an instance type, simply specify it as a value for the `sbg:AWSInstanceType` or `sbg:GoogleInstanceType` hint. ### Determining instance types All public tools and workflows have defined requirements for CPU and memory. These are used by the scheduler on the CGC to pick a suitable computation instance for the app to be run on. You can override this selection in a number of ways: * You can [set the instance type for an entire workflow](#section-set-the-instance-type-for-a-workflow). This will override any setting that you have made for any given tool in the workflow. * You can [set the instance type for any tool](#section-set-the-instance-type-for-a-tool) (either one you have added to the CGC yourself, using the SDK, or a public tool) using the tool editor. This will override the instance type selected by the scheduler. * You can [set the instance type for any tool(s) in a workflow](#section-set-the-instance-type-for-a-tool-in-a-workflow-node-). This will override any setting you have made on the tool editor. * You can also set the instance type for a task. This will override any setting you have made on the workflow level, according to the following priority **task** > **workflow** > **node**. ###Choose an instance type that is sufficient for your task If you override the instance type that the scheduling algorithm selects on the basis of the app's required resources, and instead pick your own instance, you may inadvertently select one that doesn't have enough resources to run the app successfully. To make sure you pick a suitable instance, check the required resources of the tool you want to use. To do this, open the tool in the Tool Editor, by clicking the **Edit** button. Note that you can only edit a tool that is in one of your projects. The Tool Editor contains fields labelled **CPU** and **Memory**. These contain the number of CPUs and amount of memory deemed necessary for running the tool by the person who wrapped it. If you try to set an instance type that fails to meet a tool's required resources, then, wherever possible, you will see a warning notification. However, sometimes a tool's required resources are set dynamically. For instance, the tool may require two times as many CPUs as it has input files, and the number of input files to the tool will depend on the behavior of the tool before it in a pipeline. In this case, it may not be possible to raise an error about insufficient resources before running the app, and you will see an error during its execution. See the documentation on [the Tool Editor](doc:about-the-tool-editor) for more information on how to describe a tool. In particular, see how to set a tool's [required resources](create-a-tool#section-computational-resources). For details of how dynamic expressions may be used, see the documentation on [dynamic expressions in tool descriptions](doc:dynamic-expressions-in-tool-descriptions-1). ### Running instances in parallel You can set the maximum number of instances to run in parallel for a workflow. See the instructions below on setting the instance type for an entire workflow for details. ## Set the instance type for a workflow You can set the instance for an entire workflow. This means that all tools in the workflow run on the selected instance type. 1. To set the instance type for a workflow, you should add the workflow to a project. Then, on the **Apps** tab of the project dashboard, click the ellipses icon <i class="fa fa-ellipsis-h" aria-hidden="true"></i> next to the workflow and select **Edit**. Workflow Editor opens. 2. In the top-right corner of the workflow editor click <i class="fa fa-ellipsis-h" aria-hidden="true"></i> and select **Set Hints**. You will see the **Set Hints** popup window. 3. Click **Add a Hint** and enter the following information: **To set the instance type:** * In the **Class** field select `sbg:AWSInstanceType` or `sbg:GoogleInstanceType` depending on the cloud provider you want to use. * In the **Value** field select an instance type from the list of available [AWS](doc:list-of-available-amazon-web-services-instances) or [GCP](doc:list-of-available-google-cloud-platform-instances) instances. In the field on the right, you can set the size of [storage attached to the computation instance](#attached-storage-workflow). * Click **Done**. You have successfully set the instance hint. **To set the maximum number of instances to be used in parallel:** * Click **Add a Hint** to create new empty fields. * In the **Class** field select `sbg:maxNumberOfParallelInstances`. * In the **Value** field enter the maximum number of instances to be run in parallel as an integer. * Click **Done**. You have successfully set the maximum number of parallel instances. [block:image] { "images": [ { "image": [ "https://files.readme.io/f157050-set-computation-instance-cavatica-1.png", "set-computation-instance-cavatica-1.png", 798, 235, "#333" ], "caption": "" } ] } [/block] ## Set the instance type for a tool in a workflow (node) You can set the instance type(s) of individual tools in a workflow. For instance, you might want to use a smaller, cheaper, instance type for most tools in your workflow, but provide one tool with a more powerful instance. Note that if you are running the tool on its own and not in a workflow, see the instructions on how to [set the instance type for a tool that is not in a workflow](doc:set-computation-instances#section-set-the-instance-type-for-a-tool). 1. Select the workflow that you want to configure. This can be a public workflow (in which case, you must have [copied it to a project](http://docs.sevenbridges.com/docs/copy-public-apps-to-a-project) to edit it), or it can be a workflow [you have built yourself](doc:create-a-workflow-1). 2. Click the ellipses icon <i class="fa fa-ellipsis-h" aria-hidden="true"></i> next to the workflow and select **Edit**. Workflow Editor opens. 3. In the workflow editor, click the node representing the tool in the workflow whose instance you want to set. Double-clicking a node will show the object inspector on the right. Note that input and output nodes in a workflow don't represent tools, and you can't set their instances. 4. In the object inspector, open the **Step** tab. 5. Scroll to the bottom of the tab's contents and click **Set Hints**. The **Set Hints** popup window opens. 5. Click **Add a Hint** and enter the following information: **To set the instance type:** * In the **Class** field select `sbg:AWSInstanceType` or `sbg:GoogleInstanceType` depending on the cloud provider you want to use. * In the **Value** field select an instance type from the list of available [AWS](doc:list-of-available-amazon-web-services-instances) or [GCP](doc:list-of-available-google-cloud-platform-instances) instances. In the field on the right, you can set the size of [storage attached to the computation instance](#attached-storage-workflow). * Click **Done**. You have successfully set the instance hint. [block:image] { "images": [ { "image": [ "https://files.readme.io/5230662-set-computation-instance-cavatica-2.png", "set-computation-instance-cavatica-2.png", 798, 259, "#333" ], "caption": "" } ] } [/block] ##Set the instance type for a tool You can set the instance type for a tool in [the Tool Editor](doc:about-the-tool-editor). 1. To set the instance type for a tool, you should add it to a project. Then, on the **Apps** tab of the project dashboard, click the ellipses icon <i class="fa fa-ellipsis-h" aria-hidden="true"></i> next to the tool and select **Edit**. Tool Editor opens. 2. In the Tool Editor scroll down to the **Hints** section. 3. Click **Add a Hint** and enter the following information: **To set the instance type:** * In the **Class** field select `sbg:AWSInstanceType` or `sbg:GoogleInstanceType` depending on the cloud provider you want to use. * In the **Value** field select an instance type from the list of available [AWS](doc:list-of-available-amazon-web-services-instances) or [GCP](doc:list-of-available-google-cloud-platform-instances) instances. In the field on the right, you can set the size of [storage attached to the computation instance](#attached-storage-workflow). * Click **Done**. You have successfully set the instance hint. [block:image] { "images": [ { "image": [ "https://files.readme.io/f855aa3-set-computation-instance-cavatica-3.png", "set-computation-instance-cavatica-3.png", 798, 211, "#333" ], "caption": "" } ] } [/block] ### Set attached storage size <a name="attached-storage-workflow"></a> When setting the `sbg:AWSInstanceType` or `sbg:GoogleInstanceType` instance hint, the configuration options are instance type and attached storage size. Attached storage includes disks that are used by the computation instance as storage capacity during task execution. To set up attached storage, in the field **Attached Storage**, enter the needed storage size: * If you have selected an instance that has its own storage (ephemeral storage), the storage size will be displayed in brackets next to the instance name. However, you can still define a different storage size (from 2 GB to 4096 GB) in the **Attached Storage** field, in which case **the CGC will use attached storage instead of the instance's ephemeral storage**, and attached storage costs will be added to the cost of running the computation instance. For AWS instances, read more about [EBS pricing](doc:cloud-infrastructure-pricing#section-amazon-ebs). For GCP instances, learn more about [Persistent disk pricing](https://cloud.google.com/compute/disks-image-pricing#persistentdisk). * If you have selected an Amazon EBS-only instance (no storage capacity shown in brackets next to CPU and memory values), you can change attached storage size to any value from 2 GB to 4096 GB in 1 GB increments. Attached storage costs will be added to the compute instance cost, according to the [EBS pricing model](doc:cloud-infrastructure-pricing#section-amazon-ebs) for AWS and [Persistent disk pricing](doc:cloud-infrastructure-pricing#section-compute-costs-google-cloud-platform) for GCP.