-
Notifications
You must be signed in to change notification settings - Fork 643
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
Add support for custom custom root directory to resolve relative paths #3942
Merged
Conversation
This file contains 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
Signed-off-by: Paolo Di Tommaso <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Solves #2661 |
Signed-off-by: Paolo Di Tommaso <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Look @drpatelh! is happening! 😆 |
abhi18av
pushed a commit
to abhi18av/nextflow
that referenced
this pull request
Oct 28, 2023
nextflow-io#3942) this PR introduces the environment variable `NXF_FILE_ROOT` which can be used to define the root path against which relative paths need to be resolved. For example, having defined the following variable `NXF_FILE_ROOT=s3://my-bucket/data`, the use of `file('foo.txt')` will result in the path `s3://my-bucket/data/foo.txt/` This behaviour applies to file path resolved via the Nextflow built-in functions `file`, `files`, `channel.fromPath`, `channel.fromFilePairs` and the `publishDir` operator.
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.
Nextflow resolves relative paths against the current working directory following the usual Linux and Java conventions.
For example, if the workflow is execution is launched in the path
/home/yo/workflow
and the workflow reference a filefoo.txt
using the functionfile('foo.txt')
, the resulting file path will be/home/yo/workflow/foo.txt
.This makes sense when working in a local or share file system, howeber it results into counter-intuitive behaviour when using a cloud-containerised execution environment.
In this scenario, Nextflow runs into a container ephemeral file system and relative paths are resolved as local container files that are lost after the job completion.
To solve this problem, this PR introduces the environment variable
NXF_FILE_ROOT
that can be used to define the root path against which relative path needs to be resolved.For example having define the following variable
NXF_FILE_ROOT=s3://my-bucket/data
, the use offile('foo.txt')
will result in the paths3://my-bucket/data/foo.txt
/This behaviour applies to file path resolved via the Nextflow built-in functions
file
,files
,channel.fromPath
,channel.fromFilePairs
and thepublishDir
operator.