-
Notifications
You must be signed in to change notification settings - Fork 642
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
PublishDir allows closures for mode, enabled, overwrite fields #2432
Conversation
acb53ee
to
2c6665e
Compare
@pditommaso I have a strong use case for this PR. Anything I can help do to move it closer to merge-ready? |
This was already discussed in the past. The point a closure is not needed to make these options conditionally configurable. A conditional expression should be enough e.g. Would that not fit your use case? |
That does not fit my case for the reasons outlined above. Using a conditional expression in the process script means that each process script file must specify the publishDir directive individually. That means a lot of copy/pasted code. Being able to specify in the configuration For |
Ok, this is interesting. Therefore the main concern is related to global settings via the config file. I understand the need and always thought there should be a way to change the Still think the closure approach is a hack and it's likely to go away from future config system (#2723). My proposal instead is to add a setting in the config file that allows changing the
What do you think? |
I am interested to see what happens with #2723 in the future. Anecdotally, I have had some issues with Lightbend config in the past (it is used in the scala workflow DSL, dagr). In my case with that specific workflow manager and config system, the configuration override file did not work, and in order to override config properties, you had to pass them as java system properties. For example, rather than passing a file with lines like
It is possible to set the publishDir logic globally in the config now, when you say defaults, do you mean I would be able to override individual parts of the Like: process.defaults.publishDir = [path: { "$params.outputPublishDir" ?: 'placeholder' }, mode: 'symlink', enabled: { "$params.outputPublishDir" as Boolean }] And then inside a process do something like this, and have the rest of the fields already set?: process foo {
publishDir mode: { params.publishMode }
} It sounds like I would still need to include the above override in every process if I wish to use the |
@pditommaso to clarify, it is possible to set most values in Even something like this does not work: publishDir = [
[mode: { 'copy' }]
] While this is perfectly fine: publishDir = [
[path: { "$params.outputDir" }]
] It would be very helpful to allow someone to specify something like this in the config: publishDir = [
[mode: { params.mode }]
] |
This could be a short term solution, but I feel like a hack. I have to say I'm bit lost with your use case when mentioned the need for the Could you please isolate a minimal example that shows what you are trying to achieve? |
@pditommaso here is an over simplified example where I only want to output the files from certain processes. In many workflows, I will want to publish the output of the config:
workflow: include { SortSam } from 'sortsam.nf' addParams(enablePublish: false)
include { VariantCalling } from 'variantcalling.nf
workflow {
// variant calling process requires coordinate sorted input, but I do not want to publish that intermediate file
SortSam(params.input-sam, 'coordinate')
VariantCalling(SortSam.out.bam_ch)
} |
2c461f8
to
23432f3
Compare
e2b4a93
to
f32ea0b
Compare
0d59b4c
to
b93634e
Compare
81f7cb7
to
8a43489
Compare
This likely will be addressed by #4186. Closing without merging |
This is a suggestion to make
PublishDir
more flexible by allowing more of the fields to be set using a closure.Use Case
I am using logic suggested here to set
publishDir
for all processes: #1933 (comment)That requires including these (or similar) lines in every single process file:
Rather than copy/pasting all of that into every single process file, I would like to set default global
publishDir
logic in my config files, like this:Some of this is possible without closures if I am to stick to the params provided at the start. But without closures, I cannot take advantage of the
addParams
feature when importing processes into a workflow.With this PR, it is now possible, and it will reflect changes on import. For example: