Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/reference/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,13 @@ The following settings are available:
:::
: List of custom mount options for `gcsfuse` (default: `['-o rw', '-implicit-dirs']`).

`google.batch.installOpsAgent`
: Enables Ops Agent installation on Google Batch instances for enhanced monitoring and logging (default: `false`). See the [Google Batch documentation](https://docs.cloud.google.com/batch/docs/create-run-job-ops-agent) for details.

: :::{note}
The Ops Agent requires a compatible boot disk image. For Google Batch, use [Batch-debian images](https://docs.cloud.google.com/batch/docs/vm-os-environment-overview#vm-os-image-options) (e.g., `batch-debian`) with `google.batch.bootDiskImage`. The default Container-Optimized OS (`batch-cos`) is not compatible with the Ops Agent.
:::

`google.batch.logsPath`
: :::{versionadded} 25.11.0-edge
:::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,12 @@ class GoogleBatchTaskHandler extends TaskHandler implements FusionAwareTask {
instancePolicyOrTemplate.setPolicy(instancePolicy)
}

if( batchConfig.installOpsAgent ) {
if( !batchConfig.bootDiskImage?.toLowerCase()?.contains('debian') )
log.warn1 "The Ops Agent requires a compatible boot disk image. Set 'google.batch.bootDiskImage' to a batch-debian image."
instancePolicyOrTemplate.setInstallOpsAgent( true )
}

return new InstancePolicyResult(instancePolicyOrTemplate.build(), requiresScratchVolume)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ class BatchConfig implements ConfigScope {
""")
final boolean installGpuDrivers

@ConfigOption
@Description("""
Enable the installation of the Ops Agent on Google Batch instances for enhanced monitoring and logging (default: `false`).
""")
final boolean installOpsAgent

@ConfigOption
@Description("""
The Google Cloud Storage path where job logs should be stored, e.g. `gs://my-logs-bucket/logs`.
Expand Down Expand Up @@ -147,6 +153,7 @@ class BatchConfig implements ConfigScope {
cpuPlatform = opts.cpuPlatform
gcsfuseOptions = opts.gcsfuseOptions as List<String> ?: DEFAULT_GCSFUSE_OPTS
installGpuDrivers = opts.installGpuDrivers as boolean
installOpsAgent = opts.installOpsAgent as boolean
logsPath = opts.logsPath
maxSpotAttempts = opts.maxSpotAttempts != null ? opts.maxSpotAttempts as int : DEFAULT_MAX_SPOT_ATTEMPTS
network = opts.network
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class GoogleBatchTaskHandlerTest extends Specification {
getServiceAccountEmail() >> 'foo@bar.baz'
getSubnetwork() >> 'subnet-1'
usePrivateAddress >> true
installOpsAgent >> true
logsPath() >> LOGS_PATH
}
}
Expand Down Expand Up @@ -226,6 +227,7 @@ class GoogleBatchTaskHandlerTest extends Specification {
allocationPolicy.getLocation().getAllowedLocations(0) == 'zones/us-central1-a'
allocationPolicy.getLocation().getAllowedLocations(1) == 'zones/us-central1-c'
allocationPolicy.getInstances(0).getInstallGpuDrivers() == true
allocationPolicy.getInstances(0).getInstallOpsAgent() == true
allocationPolicy.getLabelsMap() == [foo: 'bar']
allocationPolicy.getServiceAccount().getEmail() == 'foo@bar.baz'
allocationPolicy.getTagsList() == ['tag1', 'tag2']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class BatchConfigTest extends Specification {
retryPolicy: [maxAttempts: 10],
bootDiskImage: 'batch-foo',
bootDiskSize: '100GB',
logsPath: 'gs://my-logs-bucket/logs'
logsPath: 'gs://my-logs-bucket/logs',
installOpsAgent: true
]

when:
Expand All @@ -64,6 +65,8 @@ class BatchConfigTest extends Specification {
config.bootDiskSize == MemoryUnit.of('100GB')
and:
config.logsPath == 'gs://my-logs-bucket/logs'
and:
config.installOpsAgent == true
}

}
Loading