Skip to content

Commit e3917b8

Browse files
Add azure batch pool virtualNetwork option (#3723)
Signed-off-by: Ben Sherman <[email protected]> Co-authored-by: Paolo Di Tommaso <[email protected]>
1 parent 10a557c commit e3917b8

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

docs/azure.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ azure.batch.pools.<name>.scaleInterval Specify the interval at which to
418418
azure.batch.pools.<name>.schedulePolicy Specify the scheduling policy for the pool identified with ``<name>``. It can be either ``spread`` or ``pack`` (default: ``spread``).
419419
azure.batch.pools.<name>.privileged Enable the task to run with elevated access. Ignored if `runAs` is set (default: ``false``).
420420
azure.batch.pools.<name>.runAs Specify the username under which the task is run. The user must already exist on each node of the pool.
421+
azure.batch.pools.<name>.virtualNetwork Specify the subnet ID of a virtual network in which to create the pool (requires version ``23.03.0-edge`` or later).
421422
azure.registry.server Specify the container registry from which to pull the Docker images (default: ``docker.io``, requires ``[email protected]``).
422423
azure.registry.userName Specify the username to connect to a private container registry (requires ``[email protected]``).
423424
azure.registry.password Specify the password to connect to a private container registry (requires ``[email protected]``).

plugins/nf-azure/src/main/nextflow/cloud/azure/batch/AzBatchService.groovy

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import com.microsoft.azure.batch.protocol.models.ContainerRegistry
4040
import com.microsoft.azure.batch.protocol.models.ElevationLevel
4141
import com.microsoft.azure.batch.protocol.models.ImageInformation
4242
import com.microsoft.azure.batch.protocol.models.MountConfiguration
43+
import com.microsoft.azure.batch.protocol.models.NetworkConfiguration
4344
import com.microsoft.azure.batch.protocol.models.OutputFile
4445
import com.microsoft.azure.batch.protocol.models.OutputFileBlobContainerDestination
4546
import com.microsoft.azure.batch.protocol.models.OutputFileDestination
@@ -663,7 +664,6 @@ class AzBatchService implements Closeable {
663664
.withCommandLine('bash -c "chmod +x azcopy && mkdir \$AZ_BATCH_NODE_SHARED_DIR/bin/ && cp azcopy \$AZ_BATCH_NODE_SHARED_DIR/bin/" ')
664665
.withResourceFiles(resourceFiles)
665666

666-
667667
final poolParams = new PoolAddParameter()
668668
.withId(spec.poolId)
669669
.withVirtualMachineConfiguration(poolVmConfig(spec.opts))
@@ -674,6 +674,10 @@ class AzBatchService implements Closeable {
674674
.withTaskSlotsPerNode(spec.vmType.numberOfCores)
675675
.withStartTask(poolStartTask)
676676

677+
// virtual network
678+
if( spec.opts.virtualNetwork )
679+
poolParams.withNetworkConfiguration( new NetworkConfiguration().withSubnetId(spec.opts.virtualNetwork) )
680+
677681
// scheduling policy
678682
if( spec.opts.schedulePolicy ) {
679683
final pol = ComputeNodeFillType.fromString(spec.opts.schedulePolicy)

plugins/nf-azure/src/main/nextflow/cloud/azure/config/AzPoolOpts.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ class AzPoolOpts implements CacheFunnel {
6565
String userName
6666
String password
6767

68+
String virtualNetwork
69+
6870
AzPoolOpts() {
6971
this(Collections.emptyMap())
7072
}
@@ -86,6 +88,7 @@ class AzPoolOpts implements CacheFunnel {
8688
this.registry = opts.registry
8789
this.userName = opts.userName
8890
this.password = opts.password
91+
this.virtualNetwork = opts.virtualNetwork
8992
}
9093

9194
@Override
@@ -104,6 +107,7 @@ class AzPoolOpts implements CacheFunnel {
104107
hasher.putBoolean(autoScale)
105108
hasher.putUnencodedChars(scaleFormula ?: '')
106109
hasher.putUnencodedChars(schedulePolicy ?: '')
110+
hasher.putUnencodedChars(virtualNetwork ?: '')
107111
return hasher
108112
}
109113

0 commit comments

Comments
 (0)