-
Notifications
You must be signed in to change notification settings - Fork 630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Azure Batch configurable startTask #4841
Azure Batch configurable startTask #4841
Conversation
…rmanently Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
Additions: - Make Azure Batch pool startTask configurable. - Can be used to modifiy the existing worker node. Use cases: - Install more recent version of AzCopy - Install monitoring software like Azure Insights - Use NVME SSDs for storage - Flash Dragen firmware to FPGA chips Pool specific so you can differentiate between different hardware requirements. Closes nextflow-io#4259 Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
✅ Deploy Preview for nextflow-docs-staging canceled.
|
Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
…eful than them Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
I'm not getting these errors locally and they appear to refer to slurping the Google credentials as JSON. |
I can't reproduce the error locally either. Probably just a flaky google test. I think other PRs have been having a similar issue. The Azure tests are passing which is a good sign, but the integration tests haven't run yet |
Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
@@ -690,7 +690,7 @@ class AzBatchService implements Closeable { | |||
.withFilePath('azcopy') | |||
|
|||
def poolStartTask = new StartTask() | |||
.withCommandLine('bash -c "chmod +x azcopy && mkdir \$AZ_BATCH_NODE_SHARED_DIR/bin/ && cp azcopy \$AZ_BATCH_NODE_SHARED_DIR/bin/" ') | |||
.withCommandLine(startTaskCmd(spec.opts)) | |||
.withResourceFiles(resourceFiles) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder if the startTask
should be added to the default one instead of overriding it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of my use cases was to remove the azcopy install. Adding the installer feels unexpected, leaving it out is simple so problem solving should be easier.
And with Fusion you don't need azcopy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to allow the customisation of the startTask
script, however the control over the azcopy should be left to nextflow.
I've added an option to disable explicitly or implicitly when fusion is enabled. See here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems sensible!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% clear how the two will interact though. We should probably do something like this:
install_azcopy_cmd = "chmod +x azcopy && mkdir \$AZ_BATCH_NODE_SHARED_DIR/bin/ && cp azcopy \$AZ_BATCH_NODE_SHARED_DIR/bin/"
custom_start_cmd. = config.startTask ?: ""
final_start_task = 'bash -c "$custom_start_cmd; $install_azcopy_cmd"'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of, but it should be taken in consideration that that now the azcopy command can be absent. See here
nextflow/plugins/nf-azure/src/main/nextflow/cloud/azure/batch/AzBatchService.groovy
Lines 685 to 695 in 74d7d7a
if( config.batch().getCopyToolInstallMode() != CopyToolInstallMode.node ) | |
return null | |
final resourceFiles = new ArrayList(10) | |
resourceFiles << new ResourceFile() | |
.withHttpUrl(AZCOPY_URL) | |
.withFilePath('azcopy') | |
return new StartTask() | |
.withCommandLine('bash -c "chmod +x azcopy && mkdir \$AZ_BATCH_NODE_SHARED_DIR/bin/ && cp azcopy \$AZ_BATCH_NODE_SHARED_DIR/bin/" ') | |
.withResourceFiles(resourceFiles) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK implemented now: 33969d3
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
Update: Combine azcopy + custom start task:
To omit azcopy and use a start task:
|
// protected String startTaskCmd(AzPoolOpts opts) { | ||
|
||
// def startCmd = [] | ||
|
||
// // If enabled, append azcopy installer to start task command | ||
// // TODO If statement here to handle if this is disabled. | ||
// if( config.batch().getCopyToolInstallMode() != CopyToolInstallMode.node ) | ||
// startCmd << 'chmod +x azcopy && mkdir \$AZ_BATCH_NODE_SHARED_DIR/bin/ && cp azcopy \$AZ_BATCH_NODE_SHARED_DIR/bin/' | ||
|
||
// // Get any custom start task command | ||
// if ( opts.startTask ) { | ||
// startCmd << opts.startTask | ||
// } | ||
|
||
// final startTaskCmd = "bash -c \"${startCmd.join(';')}\"" | ||
// log.debug "Start task command:\n$startTaskCmd" | ||
|
||
// return startTaskCmd | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the commented code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Done now.
plugins/nf-azure/src/main/nextflow/cloud/azure/batch/AzBatchService.groovy
Outdated
Show resolved
Hide resolved
Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
.withFilePath('azcopy') | ||
log.debug "Adding azcopy installer to start task" | ||
|
||
final startTaskCmd = "bash -c \"${startCmd.join('; ')}\"" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if thre's no startTask script and copyToolInstallMode != node? this is going to be empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah correct. It should return null instead of an empty task (though I guess an empty task will work first time).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to add a unit test for createStartTask
to check different conditions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests added: f9708b0
f9708b0
to
b65c7cc
Compare
Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
b65c7cc
to
cd416e4
Compare
Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
95eb558
to
c145e45
Compare
…user. Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
Added ability to run the startTask as root user, necessary for modifying the pool hardware. |
Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
docs/config.md
Outdated
`azure.batch.pools.<name>.startTaskPrivileged` | ||
: Enable the task to run with elevated access. Ignored if `runAs` is set (default: `false`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would make sense to run it always as privileged ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need to if you want to add some basic software to the PATH (azcopy), so I think configurable makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then, I'd ask to have this organised as
azure.batch.pools.<name>.startTask.script
azure.batch.pools.<name>.startTask.privileged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you'd say that. I don't know how, give me some time to work it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's enough to add a small class
class AzStartTask {
String script
boolean unprivilged
AzStartTask(Map opts) { ... todo }
}
and create it using the usual pattern in the config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be merged to this branch from here, once finished adamrtalbot#1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All changes in now. startTask is a map:
azure {
storage {
accountName = "$AZURE_STORAGE_ACCOUNT_NAME"
accountKey = "$AZURE_STORAGE_ACCOUNT_KEY"
}
batch {
location = "$AZURE_LOCATION"
accountName = "$AZURE_BATCH_ACCOUNT_NAME"
accountKey = "$AZURE_BATCH_ACCOUNT_KEY"
autoPoolMode = true
deletePoolsOnCompletion = true
pools {
auto {
startTask {
script = "echo 'HELLO WORLD'"
privileged = true
}
}
}
}
}
Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
plugins/nf-azure/src/main/nextflow/cloud/azure/config/AzPoolOpts.groovy
Outdated
Show resolved
Hide resolved
…ts.groovy Co-authored-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com> Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
Signed-off-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com>
Solved via 27d01e3 |
Thanks @pditommaso! |
Azure Batch: Configurable startTask per pool
Additions:
Pool specific so you can differentiate between different hardware requirements.
Closes #4259
Also spotted a bug with the dev version and the container configuration so fixed it (first commit, can reorganise if we want it in a second PR).Closed with #4854To use it, you can try this config: