{"_id":"58c961a2d07a980f006a4179","version":{"_id":"5773dcfc255e820e00e1cd50","__v":27,"project":"5773dcfc255e820e00e1cd4d","createdAt":"2016-06-29T14:36:44.812Z","releaseDate":"2016-06-29T14:36:44.812Z","categories":["5773dcfc255e820e00e1cd51","5773df36904b0c0e00ef05ff","577baf92451b1e0e006075ac","577bb183b7ee4a0e007c4e8d","577ce77a1cf3cb0e0048e5ea","577d11865fd4de0e00cc3dab","578e62792c3c790e00937597","578f4fd98335ca0e006d5c84","578f5e5c3d04570e00976ebb","57bc35f7531e000e0075d118","57f801b3760f3a1700219ebb","5804d55d1642890f00803623","581c8d55c0dc651900aa9350","589dcf8ba8c63b3b00c3704f","594cebadd8a2f7001b0b53b2","59a562f46a5d8c00238e309a","5a2aa096e25025003c582b58","5a2e79566c771d003ca0acd4","5a3a5166142db90026f24007","5a3a52b5bcc254001c4bf152","5a3a574a2be213002675c6d2","5a3a66bb2be213002675cb73","5a3a6e4854faf60030b63159","5c8a68278e883901341de571","5cb9971e57bf020024523c7b","5cbf1683e2a36d01d5012ecd","5dc15666a4f788004c5fd7d7"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"user":"575e85ac41c8ba0e00259a44","githubsync":"","project":"5773dcfc255e820e00e1cd4d","parentDoc":null,"__v":0,"category":{"_id":"577baf92451b1e0e006075ac","__v":0,"project":"5773dcfc255e820e00e1cd4d","version":"5773dcfc255e820e00e1cd50","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-07-05T13:01:06.540Z","from_sync":false,"order":6,"slug":"developer-hub","title":"Developer tools"},"metadata":{"title":"","description":"","image":[]},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-03-15T15:45:38.115Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":12,"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 \nCavatica 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](http://docs.sevenbridges.com/v1.0/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 Cavatica user, you have access to the AWS US East cloud infrastructure, which gives you access to [the instances listed here](doc:list-of-available-amazon-web-services-instances). \n\nTo choose an instance type, simply specify it as a value for the  `sbg:AWSInstanceType` hint\n\n[See the AWS page on instance types for details of these instances' CPU and memory.\n](https://aws.amazon.com/ec2/instance-types/) Please note that only a subset of the instance types listed are available to the scheduling algorithm. In particular, the scheduler will never allocate an instance with very low resources.\n\n###Determining instance types\nAll public tools and workflows have defined requirements for CPU and memory. These are used by the scheduler on Cavatica 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](doc:set-computation-instances#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](doc:set-computation-instances#section-set-the-instance-type-for-a-tool) (either one you have added to Cavatica 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](set-computation-instances#section-set-the-instance-type-for-a-tool). 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 (MB). 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:the-tool-editor) for more information on how to describe a tool. In particular, see how to set a tool's [required resources](http://docs.sevenbridges.com/docs/general-tool-information#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).\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 it to a project. Then, on the **Apps** tab of the project dashboard, click the pencil icon next to the tool to open the workflow editor.\n2. Click the ellipses icon (**. . .**) in the top right corner of the workflow editor, and select **Settings**.\n3. You will see the **Workflow settings** popup window, shown below. Enter the following information:\n **To set the instance type:**\n  * In the field marked **Requirement class** enter `sbg:AWSInstanceType`\n  * In the field marked **Requirement value** enter an instance type from the [list of available instances](doc:list-of-available-amazon-web-services-instances). When you start typing an instance type, you will see automatically generated suggestions in the drop-down box.\n\n **To set the maximum number of instances to be used in parallel:**\n  * Click the plus (**+**) icon to create new empty fields.\n  * In the field marked **Requirement class** enter `sbg:maxNumberOfParallelInstances`.\n  * In the field marked **Requirement value** enter the number of instances to be run in parallel as an integer. In the field on the right, you can set the size of [storage attached to the computation instance](#attached-storage-workflow).\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/ee2dee6-select-instance-workflow.gif\",\n        \"select-instance-workflow.gif\",\n        1226,\n        685,\n        \"#ebeeef\"\n      ],\n      \"caption\": \"Set the instance type for your workflow.\"\n    }\n  ]\n}\n[/block]\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n\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) \nto edit it), or it can be a workflow [you have built yourself](doc:create-a-workflow).\n2. Click the pencil icon to open the workflow in the workflow editor.\n3. In the workflow editor, click the node representing the tool in the workflow whose instance you want to set. Selecting a node will show a green ellipses icon. In the example below, you can see this icon above the **STAR** node in the rna-seq-allignment-star workflow. Note that input and output nodes in a workflow don't represent tools, and you can't set their instances.\n4. Click the green ellipses icon (**. . .**) to see the settings for the node. Click the tab marked **HINTS**.\n5. Then enter the following information:\n **To set the instance type:**\n  * In the field marked **Requirement class** enter `sbg:AWSInstanceType`\n  * In the field marked **Requirement value** enter an instance type from the [list of available instances](doc:list-of-available-amazon-web-services-instances) When you start typing an instance type, you will see automatically generated suggestions in the drop-down box. In the field on the right, you can set the size of [storage attached to the computation instance](#attached-storage-workflow).\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/ac4af80-select-instance-node.gif\",\n        \"select-instance-node.gif\",\n        1086,\n        685,\n        \"#354553\"\n      ],\n      \"caption\": \"Set the instance type for a tool in your workflow (node).\"\n    }\n  ]\n}\n[/block]\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n\n##Set the instance type for a tool\nYou can set the instance type for a tool in [the Tool Editor](doc: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 pencil icon next to the tool to open the tool editor.\n2. Click the ellipses icon (**. . .**) in the top right, and select **Settings**.\n3. You will see the **Tool  settings** popup, shown below. On the Tool Settings pop-up, click the plus icon (**+**).\n4. Then enter the following information:\n **To set the instance type:**\n  * In the field marked **Requirement class** enter `sbg:AWSInstanceType`\n  * In the field marked **Requirement value** enter an instance type from the [list of available instances](doc:list-of-available-amazon-web-services-instances). When you start typing an instance type, you will see automatically generated suggestions in the drop-down box. In the field on the right, you can set the size of [storage attached to the computation instance](#attached-storage-workflow).\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/49d6fce-select-instance-tool.gif\",\n        \"select-instance-tool.gif\",\n        1154,\n        685,\n        \"#344453\"\n      ],\n      \"caption\": \"Set the instance type for your tool\"\n    }\n  ]\n}\n[/block]\n<div align=\"right\"><a href=\"#top\">top</a></div>\n\n### Set attached storage size\n\n<a name=\"attached-storage-workflow\"></a>When setting the `sbg:AWSInstanceType` instance hint, the configuration options are instance type and attached storage size. Attached storage includes EBS 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 **Cavatica will use EBS storage instead of the instance's ephemeral storage**, and EBS costs will be added to the cost of running the computation instance. Read more about [EBS pricing](http://docs.sevenbridges.com/docs/about-pricing#section-amazon-ebs).\n* If you have selected an Amazon EBS-only instance (no storage capacity shown in brackets next to CPU and memory values), set the 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](http://docs.sevenbridges.com/docs/about-pricing#section-amazon-ebs).","excerpt":"","slug":"set-computation-instances","type":"basic","title":"Set computation instances"}

Set computation instances


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. Cavatica 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](http://docs.sevenbridges.com/v1.0/page/multi-instance-scheduling-algorithm) we use to allocate instances to tasks.", "title": "The scheduling algorithm" } [/block] ##Available instance types As a Cavatica user, you have access to the AWS US East cloud infrastructure, which gives you access to [the instances listed here](doc:list-of-available-amazon-web-services-instances). To choose an instance type, simply specify it as a value for the `sbg:AWSInstanceType` hint [See the AWS page on instance types for details of these instances' CPU and memory. ](https://aws.amazon.com/ec2/instance-types/) Please note that only a subset of the instance types listed are available to the scheduling algorithm. In particular, the scheduler will never allocate an instance with very low resources. ###Determining instance types All public tools and workflows have defined requirements for CPU and memory. These are used by the scheduler on Cavatica 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](doc:set-computation-instances#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](doc:set-computation-instances#section-set-the-instance-type-for-a-tool) (either one you have added to Cavatica 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](set-computation-instances#section-set-the-instance-type-for-a-tool). 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 (MB). 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:the-tool-editor) for more information on how to describe a tool. In particular, see how to set a tool's [required resources](http://docs.sevenbridges.com/docs/general-tool-information#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). ###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 it to a project. Then, on the **Apps** tab of the project dashboard, click the pencil icon next to the tool to open the workflow editor. 2. Click the ellipses icon (**. . .**) in the top right corner of the workflow editor, and select **Settings**. 3. You will see the **Workflow settings** popup window, shown below. Enter the following information: **To set the instance type:** * In the field marked **Requirement class** enter `sbg:AWSInstanceType` * In the field marked **Requirement value** enter an instance type from the [list of available instances](doc:list-of-available-amazon-web-services-instances). When you start typing an instance type, you will see automatically generated suggestions in the drop-down box. **To set the maximum number of instances to be used in parallel:** * Click the plus (**+**) icon to create new empty fields. * In the field marked **Requirement class** enter `sbg:maxNumberOfParallelInstances`. * In the field marked **Requirement value** enter the number of instances to be run in parallel as an integer. In the field on the right, you can set the size of [storage attached to the computation instance](#attached-storage-workflow). [block:image] { "images": [ { "image": [ "https://files.readme.io/ee2dee6-select-instance-workflow.gif", "select-instance-workflow.gif", 1226, 685, "#ebeeef" ], "caption": "Set the instance type for your workflow." } ] } [/block] <div align="right"><a href="#top">top</a></div> ##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). 2. Click the pencil icon to open the workflow in the workflow editor. 3. In the workflow editor, click the node representing the tool in the workflow whose instance you want to set. Selecting a node will show a green ellipses icon. In the example below, you can see this icon above the **STAR** node in the rna-seq-allignment-star workflow. Note that input and output nodes in a workflow don't represent tools, and you can't set their instances. 4. Click the green ellipses icon (**. . .**) to see the settings for the node. Click the tab marked **HINTS**. 5. Then enter the following information: **To set the instance type:** * In the field marked **Requirement class** enter `sbg:AWSInstanceType` * In the field marked **Requirement value** enter an instance type from the [list of available instances](doc:list-of-available-amazon-web-services-instances) When you start typing an instance type, you will see automatically generated suggestions in the drop-down box. In the field on the right, you can set the size of [storage attached to the computation instance](#attached-storage-workflow). [block:image] { "images": [ { "image": [ "https://files.readme.io/ac4af80-select-instance-node.gif", "select-instance-node.gif", 1086, 685, "#354553" ], "caption": "Set the instance type for a tool in your workflow (node)." } ] } [/block] <div align="right"><a href="#top">top</a></div> ##Set the instance type for a tool You can set the instance type for a tool in [the Tool Editor](doc: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 pencil icon next to the tool to open the tool editor. 2. Click the ellipses icon (**. . .**) in the top right, and select **Settings**. 3. You will see the **Tool settings** popup, shown below. On the Tool Settings pop-up, click the plus icon (**+**). 4. Then enter the following information: **To set the instance type:** * In the field marked **Requirement class** enter `sbg:AWSInstanceType` * In the field marked **Requirement value** enter an instance type from the [list of available instances](doc:list-of-available-amazon-web-services-instances). When you start typing an instance type, you will see automatically generated suggestions in the drop-down box. In the field on the right, you can set the size of [storage attached to the computation instance](#attached-storage-workflow). [block:image] { "images": [ { "image": [ "https://files.readme.io/49d6fce-select-instance-tool.gif", "select-instance-tool.gif", 1154, 685, "#344453" ], "caption": "Set the instance type for your tool" } ] } [/block] <div align="right"><a href="#top">top</a></div> ### Set attached storage size <a name="attached-storage-workflow"></a>When setting the `sbg:AWSInstanceType` instance hint, the configuration options are instance type and attached storage size. Attached storage includes EBS 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 **Cavatica will use EBS storage instead of the instance's ephemeral storage**, and EBS costs will be added to the cost of running the computation instance. Read more about [EBS pricing](http://docs.sevenbridges.com/docs/about-pricing#section-amazon-ebs). * If you have selected an Amazon EBS-only instance (no storage capacity shown in brackets next to CPU and memory values), set the 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](http://docs.sevenbridges.com/docs/about-pricing#section-amazon-ebs).