Skip to content

Commit

Permalink
In Google Batch, support user specified boot images
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthab committed Aug 30, 2024
1 parent 5a37e61 commit f99ec18
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,11 @@ The following settings are available for Google Cloud Batch:
:::
: Define the set of allowed locations for VMs to be provisioned. See [Google documentation](https://cloud.google.com/batch/docs/reference/rest/v1/projects.locations.jobs#locationpolicy) for details (default: no restriction).

`google.batch.bootDiskImage`
: :::{versionadded} 24.08.0-edge
:::
: Set the image URI of the virtual machine boot disk, e.g `batch-debian`. See [Google documentation](https://cloud.google.com/batch/docs/vm-os-environment-overview#vm-os-image-options) for details (default: none).

`google.batch.bootDiskSize`
: Set the size of the virtual machine boot disk, e.g `50.GB` (default: none).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ class GoogleBatchTaskHandler extends TaskHandler implements FusionAwareTask {
instancePolicyOrTemplate.setInstallGpuDrivers(true)
}

if( executor.config.bootDiskImage )
instancePolicy.setBootDisk(AllocationPolicy.Disk.newBuilder().setImage( executor.config.bootDiskImage ))

if( fusionEnabled() && !disk ) {
disk = new DiskResource(request: '375 GB', type: 'local-ssd')
log.debug "[GOOGLE BATCH] Process `${task.lazyName()}` - adding local volume as fusion scratch: $disk"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class BatchConfig {
private GoogleOpts googleOpts
private GoogleCredentials credentials
private List<String> allowedLocations
private String bootDiskImage
private MemoryUnit bootDiskSize
private String cpuPlatform
private int maxSpotAttempts
Expand All @@ -54,6 +55,7 @@ class BatchConfig {
GoogleOpts getGoogleOpts() { return googleOpts }
GoogleCredentials getCredentials() { return credentials }
List<String> getAllowedLocations() { allowedLocations }
String getBootDiskImage() { bootDiskImage }
MemoryUnit getBootDiskSize() { bootDiskSize }
String getCpuPlatform() { cpuPlatform }
int getMaxSpotAttempts() { maxSpotAttempts }
Expand All @@ -72,6 +74,7 @@ class BatchConfig {
result.googleOpts = GoogleOpts.create(session)
result.credentials = result.googleOpts.credentials
result.allowedLocations = session.config.navigate('google.batch.allowedLocations', List.of()) as List<String>
result.bootDiskImage = session.config.navigate('google.batch.bootDiskImage')
result.bootDiskSize = session.config.navigate('google.batch.bootDiskSize') as MemoryUnit
result.cpuPlatform = session.config.navigate('google.batch.cpuPlatform')
result.maxSpotAttempts = session.config.navigate('google.batch.maxSpotAttempts', DEFAULT_MAX_SPOT_ATTEMPTS) as int
Expand Down

0 comments on commit f99ec18

Please sign in to comment.