-
Notifications
You must be signed in to change notification settings - Fork 660
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
Documentation vs reality: workflow.container #3394
Comments
Bumping this One could do like this: #!/usr/bin/env nextflow
nextflow.enable.dsl=2
// creating an empty dictionary
mapContainers = [:]
process bash_step {
input:
val(example)
output:
path '*.out', emit: wfl
script:
if (!mapContainers.containsKey(task.container)) {
mapContainers[task.container] = task.process
}
"""
echo ${workflow.container} > ${example}.out
"""
}
process job_a {
input:
path(wfl)
output:
path '*.out.gz', emit: gzip
script:
if (!mapContainers.containsKey(task.container)) {
mapContainers[task.container] = task.process
}
"""
gzip -c ${wfl} > ${wfl}.gz
"""
}
process job_b {
input:
path(wfl)
path(gzip)
output:
path 'compress.comp'
publishDir "${params.tracedir}", mode: "copy"
shell:
if (!mapContainers.containsKey(task.container)) {
mapContainers[task.container] = task.process
}
'''
echo native: $(wc -c !{wfl}) > compress.comp
echo compressed: $(wc -c !{gzip}) >> compress.comp
echo "## content follows ##" >> compress.comp
cat !{wfl} >> compress.comp
echo "## EOC ##" >> compress.comp
'''
}
workflow {
main:
bash_step('bob')
job_a(bash_step.out.wfl)
job_b(bash_step.out.wfl, job_a.out.gzip)
}
// print the mapContainers here
workflow.onComplete {
def status = "NA"
if(workflow.success) {
status = "SUCCESS"
println("""
Workflow container : ${mapContainers}
"""
)
}
} the problem is that this approach won't work when using with modules.... |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
The relevant code is here: nextflow/modules/nextflow/src/main/groovy/nextflow/Session.groovy Lines 1270 to 1274 in a66b0e6
However when I inspect the process config at this point, I get the following:
@pditommaso can you explain the logic here? I don't know what the |
I have to say I have no memory about that. Tho there's even a test for that nextflow/modules/nextflow/src/test/groovy/nextflow/SessionTest.groovy Lines 513 to 559 in 3051cd1
|
Bug report
Expected behavior and actual behavior
The metadata documentation indicates that
workflow.container
returns a map of all containers:A map is not returned when multiple containers defined, only the top level value when defined (
process.container
).If top level
process.container
has not been defined we get[:]
.nextflow.config
main.nf
Run with:
Gives:
Would expect:
(possibly no entry for
bash_step
)Steps to reproduce the problem
As above
Program output
As above
Environment
Additional context
Appears related to #1758, if this is not a suitable way to introspect this value please update documentation.
The text was updated successfully, but these errors were encountered: