-
Notifications
You must be signed in to change notification settings - Fork 651
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
[proposal] Add process programmatic configuration context #4322
Comments
It'd be nice if we could set the .
├── main.nf
├── modules
│ ├── module_a
│ │ ├── main.nf
│ │ └── nextflow.config
│ └── module_b
│ ├── main.nf
│ └── nextflow.config
└── nextflow.config
4 directories, 6 files We can currently do it by adding the following to the root includeConfig './modules/module_a/nextflow.config'
includeConfig './modules/module_b/nextflow.config' But it'd be cool if we didn't have to 😅 |
It's an unrelated problem. The goal of this issue is to make it possible to configure a process in the context of the script where it's included. The local config file, could help to have config in the context of the process definition |
I think the proposal is good enough to try a proof-of-concept. It seems aligned with our broader effort to improve the definition of workflow inputs and outputs, as well as a potential programmatic API for processes and workflows (e.g. a "builder" syntax). Also notable that the |
According to @drpatelh , the nice thing about the Furthermore, the if statements in the rnaseq I've said before that this problem seems closely related to the need to better define workflow inputs and outputs. I'm starting to think that the I'm not necessarily ditching this programmatic process config idea, but we need to take it further. For example, instead of specifying the literal directive values in the pipeline code, we could specify them with params or workflow inputs, then keep the actual settings in a config or params file. Taking Paolo's original example: // main.nf
def publish_dir(path) {
[path: "${params.outdir}/${path}", mode: params.publish_dir_mode]
}
workflow MY_ANALYSIS {
BAR.config.ext.args = params.my_analysis_bar_args
BAR.config.publishDir = publish_dir(params.my_analysis_bar_publish_path)
BAR()
BAR.out.view()
} // nextflow.config
params {
my_analysis_bar_args = '--foo --bar'
my_analysis_bar_publish_path = 'sample_fastq/fastq'
} The programmatic process config is still useful because it allows you to specific process directives outside of the module definition but with more flexibility than a config file allows. Meanwhile, you can expose the settings that users might want to customize in the configuration, separate from the pipeline code. This can already be done with the original proposal, it's just a "best practice" on top of the new syntax. |
Based on discussion at the hackathon, this approach will not work for nf-core. Instead we will try to implement a module config as described in #4422 |
Context
The use of DSL2 introduces the use of module components that allow the inclusion and re-use a process more than one time with different names.
A common requirement in this scenario is that a process configuration needs to be customised, for example, to provide a specific
publishDir
path or command arguments.Currently, this need is addressed by creating a monolithic configuration file in which the process configuration is provided by using the target process name. For example here
https://github.com/nf-core/rnaseq/blob/master/conf/modules.config#L174-L192
In some case, there's a conditional logic that needs to be duplicated in the workflow script. For example here:
https://github.com/nf-core/rnaseq/blob/master/conf/modules.config#L209-L224
This approach has several disadvantages:
Solution
A possible solution is to allow the process configuration in the context of the workflow definition instead of the configuration file.
A possible syntax could be the following:
The
.config
syntax will allow overriding the process default configuration in the context of the workflow execution.This has several advantages:
.config
property is consistent with the already existing syntax of process acceessors e.g..out
The text was updated successfully, but these errors were encountered: