Fix Azure Batch executor scratch directory support#6872
Open
adamrtalbot wants to merge 2 commits intomasterfrom
Open
Fix Azure Batch executor scratch directory support#6872adamrtalbot wants to merge 2 commits intomasterfrom
adamrtalbot wants to merge 2 commits intomasterfrom
Conversation
When process.scratch is enabled, the .command.run script changes to a temporary scratch directory before executing. However, .command.sh and other control files remain in the Azure Batch task working directory, causing 'No such file or directory' errors. Fix by saving the original working directory as NXF_TASK_LAUNCH_DIR in the environment setup (before the scratch cd), then copying task control files (.command.sh, .command.run, .command.in) from that directory to the scratch directory during staging. This uses a local copy instead of re-downloading from Azure Blob Storage, since Azure Batch already downloads these files as resource files to the task working directory. Also fix a bug in AzBatchService.resourceFileUrls() where the .command.in resource file was incorrectly sourced from the .command.sh blob URL instead of the actual stdin file URL. Generated by Claude Code Signed-off-by: adamrtalbot <12817534+adamrtalbot@users.noreply.github.com>
✅ Deploy Preview for nextflow-docs-staging ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
process.scratch = truefailing on Azure Batch with/bin/bash: .command.sh: No such file or directory.command.inresource file incorrectly sourced from.command.shblob URL inAzBatchService.resourceFileUrls()Problem
When
process.scratch = true, the.command.runscript creates a temporary scratch directory andcds into it before executing. However,.command.shand other control files remain in the Azure Batch task working directory (where Azure downloaded them as resource files), sonxf_launch()fails with a "No such file or directory" error.Both AWS Batch and Google Batch handle this by staging
.command.shas an input file. AWS re-downloads from S3 (necessary since only.command.runis bootstrapped). Google uses local filesystem copies via mounted GCS.Fix
Azure Batch already downloads
.command.sh,.command.run, and.command.inas resource files to the task working directory before execution — so re-downloading from blob storage is unnecessary.Instead, this fix:
NXF_TASK_LAUNCH_DIRinAzFileCopyStrategy.getEnvScript()— this runs before the template'scd $NXF_SCRATCH, capturing where the resource files liveAzFileCopyStrategy.getStageInputFilesScript()— aftercd $NXF_SCRATCH, copies.command.sh,.command.run, and.command.infrom the saved directory using a localcp(no network round-trip)The generated staging block:
Bonus fix
AzBatchService.resourceFileUrls()was usingcmdScript(.command.sh's blob URL) as the HTTP source for the.command.inresource file, meaning Azure Batch would download.command.shcontent and save it as.command.in. Fixed to use the correct.command.inblob path.Testing
AzFileCopyStrategyTestassertions for the new staging and env outputnextflow run hellowithprocess.scratch = true