Google Cloud Batch
This guide assumes you have an existing Google Cloud account. Sign-up for a free account here.
Tower provides integration to Google Cloud via the Batch API.
The guide is split into two parts:
-
How to configure your Google Cloud account to use the Batch API.
-
How to create a Google Cloud Batch compute environment in Tower.
Configure Google Cloud
Create a project
Navigate to the Google Project Selector page and select an existing project or select Create project.
Enter a name for your new project, e.g., "tower-nf".
If you are part of an organization, the location will default to your organization.
Enable billing
See these instructions to enable billing in your Google Cloud account.
Enable APIs
See here to enable the following APIs for your project:
- Batch API
- Compute Engine API
- Cloud Storage API
Select your project from the dropdown menu and select Enable.
Alternatively, you can enable each API manually by selecting your project in the navigation bar and visiting each API page:
Create a service account key
-
In the navigation menu, select IAM & Admin, then Service Accounts.
-
Select the email address of the Compute Engine default service account.
-
Select Keys, then Add key, then Create new key.
-
Select JSON as the key type.
-
Select Create.
A JSON file will be downloaded to your computer. This file contains the credential needed to configure the compute environment in Tower.
You can manage your key from the Service Accounts page.
Create a Cloud Storage bucket
-
In the navigation menu (≡), select Cloud Storage, then Create bucket.
-
Enter a name for your bucket. You will reference this name when creating the compute environment in Tower.
Do not use underscores (_
) in your bucket name. Use hyphens (-
) instead.
-
Select Region for the Location type and select the Location for your bucket. You will reference this location when creating the compute environment in Tower.
-
Select Standard for the default storage class.
-
Select Uniform for the Access control.
The Batch API is available in a limited number of locations. These locations are only used to store metadata about the pipeline operations. The storage bucket and compute resources can be in any region.
-
Select Create.
-
Once the bucket is created, you will be redirected to the Bucket details page.
-
Select Permissions, then + Add.
-
Copy the email address of the Compute Engine default service account into New principals.
-
Select the following roles:
- Storage Admin
- Storage Legacy Bucket Owner
- Storage Legacy Object Owner
- Storage Object Creator
You have created a project, enabled the necessary Google APIs, created a bucket, and created a JSON file with the required credentials. You are now ready to set up a new compute environment in Tower.
Compute environment
The following guide to configure Tower assumes you have (1) a service account key for a Google Cloud account and (2) the name and location of a Cloud Storage bucket.
To create a new compute environment for Google Cloud in Tower:
-
In a workspace, select Compute Environments and then New Environment.
-
Enter a descriptive name for this environment, e.g., "Google Cloud Batch (europe-north1)".
-
Select Google Cloud Batch as the target platform.
-
From the Credentials drop-down, select existing Google credentials, or select + to add new credentials. If you have existing credentials, skip to step 7.
-
Enter a name for the credentials, e.g. "Google Cloud Credentials".
-
Enter the Service account key created previously.
-
Select the Location where you wish to execute pipelines.
-
In the Pipeline work directory field, enter your storage bucket URL, e.g.,
gs://my-bucket
. This bucket should be accessible in the location selected in the previous step. -
Select Enable Wave containers to facilitate access to private container repositories and provision containers in your pipelines using the Wave containers service. See Wave containers for more information.
-
Select Enable Fusion v2 to allow access to your S3-hosted data via the Fusion v2 virtual distributed file system. This speeds up most data operations. The Fusion v2 file system requires Wave containers to be enabled (see above).
-
Enable Spot to use spot instances, which have significantly reduced cost compared to on-demand instances.
-
Apply Resource labels to the cloud resources consumed by this compute environment. Workspace default resource labels are prefilled.
-
Expand Staging options to include optional pre- or post-run Bash scripts that execute before or after the Nextflow pipeline execution in your environment.
-
You can use the Environment variables option to specify custom environment variables for the Head job and/or Compute jobs.
-
Configure any advanced options described below, as needed.
-
Select Create to finalize the compute environment setup.
Jump to the documentation for launching pipelines.
Advanced options
-
Enable Use Private Address to ensure that your Google Cloud VMs aren't accessible to the public internet.
-
Use Boot disk size to control the boot disk size of VMs.
-
Use Head Job CPUs and Head Job Memory to specify the CPUs and memory allocated for head jobs.