Skip to content

Commit f74ca39

Browse files
committed
feat: Add support for Google Batch Ops Agent installation
Add a new configuration option google.batch.installOpsAgent that enables the installation of the Ops Agent on Google Batch instances for enhanced monitoring and logging capabilities. Changes include: - Add installOpsAgent config field to BatchConfig - Update GoogleBatchTaskHandler to set installOpsAgent in allocation policy - Add test coverage for the new configuration option - Update documentation in config.md Signed-off-by: ejseqera <esha.joshi@seqera.io>
1 parent cc0d177 commit f74ca39

File tree

5 files changed

+19
-1
lines changed

5 files changed

+19
-1
lines changed

docs/reference/config.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,9 @@ The following settings are available:
923923
:::
924924
: List of custom mount options for `gcsfuse` (default: `['-o rw', '-implicit-dirs']`).
925925

926+
`google.batch.installOpsAgent`
927+
: Enable the installation of the Ops Agent on Google Batch instances for enhanced monitoring and logging (default: `false`).
928+
926929
`google.batch.logsPath`
927930
: :::{versionadded} 25.11.0-edge
928931
:::

plugins/nf-google/src/main/nextflow/cloud/google/batch/GoogleBatchTaskHandler.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,9 @@ class GoogleBatchTaskHandler extends TaskHandler implements FusionAwareTask {
410410
instancePolicyOrTemplate.setPolicy( instancePolicy )
411411
}
412412

413+
if( batchConfig.installOpsAgent )
414+
instancePolicyOrTemplate.setInstallOpsAgent( true )
415+
413416
allocationPolicy.addInstances(instancePolicyOrTemplate)
414417

415418
// network policy

plugins/nf-google/src/main/nextflow/cloud/google/batch/client/BatchConfig.groovy

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ class BatchConfig implements ConfigScope {
8484
""")
8585
final boolean installGpuDrivers
8686

87+
@ConfigOption
88+
@Description("""
89+
Enable the installation of the Ops Agent on Google Batch instances for enhanced monitoring and logging (default: `false`).
90+
""")
91+
final boolean installOpsAgent
92+
8793
@ConfigOption
8894
@Description("""
8995
The Google Cloud Storage path where job logs should be stored, e.g. `gs://my-logs-bucket/logs`.
@@ -147,6 +153,7 @@ class BatchConfig implements ConfigScope {
147153
cpuPlatform = opts.cpuPlatform
148154
gcsfuseOptions = opts.gcsfuseOptions as List<String> ?: DEFAULT_GCSFUSE_OPTS
149155
installGpuDrivers = opts.installGpuDrivers as boolean
156+
installOpsAgent = opts.installOpsAgent as boolean
150157
logsPath = opts.logsPath
151158
maxSpotAttempts = opts.maxSpotAttempts != null ? opts.maxSpotAttempts as int : DEFAULT_MAX_SPOT_ATTEMPTS
152159
network = opts.network

plugins/nf-google/src/test/nextflow/cloud/google/batch/GoogleBatchTaskHandlerTest.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ class GoogleBatchTaskHandlerTest extends Specification {
158158
getServiceAccountEmail() >> 'foo@bar.baz'
159159
getSubnetwork() >> 'subnet-1'
160160
usePrivateAddress >> true
161+
installOpsAgent >> true
161162
logsPath() >> LOGS_PATH
162163
}
163164
}
@@ -224,6 +225,7 @@ class GoogleBatchTaskHandlerTest extends Specification {
224225
allocationPolicy.getLocation().getAllowedLocations(0) == 'zones/us-central1-a'
225226
allocationPolicy.getLocation().getAllowedLocations(1) == 'zones/us-central1-c'
226227
allocationPolicy.getInstances(0).getInstallGpuDrivers() == true
228+
allocationPolicy.getInstances(0).getInstallOpsAgent() == true
227229
allocationPolicy.getLabelsMap() == [foo: 'bar']
228230
allocationPolicy.getServiceAccount().getEmail() == 'foo@bar.baz'
229231
allocationPolicy.getTagsList() == ['tag1', 'tag2']

plugins/nf-google/src/test/nextflow/cloud/google/batch/client/BatchConfigTest.groovy

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ class BatchConfigTest extends Specification {
4949
retryPolicy: [maxAttempts: 10],
5050
bootDiskImage: 'batch-foo',
5151
bootDiskSize: '100GB',
52-
logsPath: 'gs://my-logs-bucket/logs'
52+
logsPath: 'gs://my-logs-bucket/logs',
53+
installOpsAgent: true
5354
]
5455

5556
when:
@@ -65,6 +66,8 @@ class BatchConfigTest extends Specification {
6566
config.bootDiskSize == MemoryUnit.of('100GB')
6667
and:
6768
config.logsPath == 'gs://my-logs-bucket/logs'
69+
and:
70+
config.installOpsAgent == true
6871
}
6972

7073
}

0 commit comments

Comments
 (0)