Skip to content

Commit 9203d17

Browse files
committed
Implement image streaming
1 parent 6444087 commit 9203d17

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

docs/reference/config.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,13 @@ The following settings are available:
971971
: The Google Cloud Storage path where job logs should be stored, e.g. `gs://my-logs-bucket/logs`.
972972
: When specified, Google Batch will write job logs to this location instead of [Cloud Logging](https://cloud.google.com/logging/docs). The bucket must be accessible and writable by the service account.
973973

974+
`google.batch.enableImageStreaming`
975+
: :::{versionadded} 26.02.1-edge
976+
:::
977+
: Enable container image streaming to speed up job start-up (default: `false`). This can reduce latency for large images but comes with some
978+
[limitations](https://docs.cloud.google.com/batch/docs/use-image-streaming).
979+
: Notably, `process.containerOptions` is ignored when image streaming is enabled.
980+
974981
`google.batch.maxSpotAttempts`
975982
: :::{versionadded} 23.11.0-edge
976983
:::

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ class GoogleBatchTaskHandler extends TaskHandler implements FusionAwareTask {
313313
.setImageUri(task.container)
314314
.addAllCommands(cmd)
315315
.addAllVolumes(launcher.getContainerMounts())
316+
.setEnableImageStreaming(batchConfig?.enableImageStreaming ?: false)
316317

317318
def containerOptions = task.config.getContainerOptions() ?: ''
318319
if( fusionEnabled() ) {

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,15 @@ class BatchConfig implements ConfigScope {
9090
""")
9191
final String logsPath
9292

93+
@ConfigOption
94+
@Description("""
95+
Enable container image streaming for faster startup. process.containerOptions
96+
is ignored when image streaming is enabled. See
97+
[documentation](https://docs.cloud.google.com/batch/docs/use-image-streaming)
98+
for a full list of other limitations (default: `false`).
99+
""")
100+
final boolean enableImageStreaming
101+
93102
@ConfigOption
94103
@Description("""
95104
Max number of execution attempts of a job interrupted by a Compute Engine Spot reclaim event (default: `0`).
@@ -148,6 +157,7 @@ class BatchConfig implements ConfigScope {
148157
gcsfuseOptions = opts.gcsfuseOptions as List<String> ?: DEFAULT_GCSFUSE_OPTS
149158
installGpuDrivers = opts.installGpuDrivers as boolean
150159
logsPath = opts.logsPath
160+
enableImageStreaming = opts.enableImageStreaming != null ? opts.enableImageStreaming as boolean : false
151161
maxSpotAttempts = opts.maxSpotAttempts != null ? opts.maxSpotAttempts as int : DEFAULT_MAX_SPOT_ATTEMPTS
152162
network = opts.network
153163
networkTags = opts.networkTags as List<String> ?: Collections.emptyList()

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class BatchConfigTest extends Specification {
3131
then:
3232
!config.getSpot()
3333
and:
34+
!config.enableImageStreaming
35+
and:
3436
config.retryConfig.maxAttempts == 5
3537
config.maxSpotAttempts == 0
3638
config.autoRetryExitCodes == [50001]
@@ -44,6 +46,7 @@ class BatchConfigTest extends Specification {
4446
given:
4547
def opts = [
4648
spot: true,
49+
enableImageStreaming: true,
4750
maxSpotAttempts: 8,
4851
autoRetryExitCodes: [50001, 50003, 50005],
4952
retryPolicy: [maxAttempts: 10],

0 commit comments

Comments
 (0)