Skip to content

Fix error with dynamic directives with named arguments#6550

Merged
bentsherman merged 3 commits intomasterfrom
6512-fix-dynamic-process-directive
Nov 12, 2025
Merged

Fix error with dynamic directives with named arguments#6550
bentsherman merged 3 commits intomasterfrom
6512-fix-dynamic-process-directive

Conversation

@bentsherman
Copy link
Member

Close #6512

This PR fixes an apparent regression in 25.10. The following directives fail when they are specified with a closure that references a process input:

  • accelerator
  • arch
  • publishDir

This has to do with how they are implemented in ProcessBuilder. Most directives aren't implemented explicitly, but these directives require explicit methods in order to handle named arguments.

I'm not sure why it works in 25.04 but not in 25.10, since the logic of these methods were not changed when they were moved to ProcessBuilder. I suspect it was being held together with some hidden Groovy magic 🤷

Test case derived from the issue:

params.analysis_output_dir = 'analysis_output_dir'
params.analysis_id = 'analysis_id'

workflow {
    TEST( tuple('individual_id', 'sample_id') )
}

process TEST {
    publishDir { dirProcessReads(individual_id, sample_id) }, mode: 'link'

    input:
    tuple val(individual_id), val(sample_id)

    script:
    """
    echo '${dirProcessReads(individual_id, sample_id)}'
    """
}

def dirProcessReads(individual_id, sample_id) { 
    return "${sampleBaseDir(individual_id, sample_id)}/processedReads"
}

def sampleBaseDir(individual_id, sample_id) {
    return "${params.analysis_output_dir}/${params.analysis_id}.${individual_id}.${sample_id}"
}

I added a simplified version of this to the e2e tests.

Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
@netlify
Copy link

netlify bot commented Nov 7, 2025

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit ae63161
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/6914922eac2407000919ee8b

@bentsherman bentsherman merged commit 064f57f into master Nov 12, 2025
24 checks passed
@bentsherman bentsherman deleted the 6512-fix-dynamic-process-directive branch November 12, 2025 14:43
pditommaso pushed a commit that referenced this pull request Nov 28, 2025
---------

Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in running function within publishDir block

2 participants