Skip to content
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

Output the theoretical .command.sh file when using stub #4504

Open
awgymer opened this issue Nov 9, 2023 · 1 comment
Open

Output the theoretical .command.sh file when using stub #4504

awgymer opened this issue Nov 9, 2023 · 1 comment

Comments

@awgymer
Copy link

awgymer commented Nov 9, 2023

It would be great if there was a way to run a workflow with -stub but also get the result of what would have run in the script section.

Currently I have a work around that looks something like this:

script:
def prefix = task.ext.prefix ?: "${meta.id}"
def args = teask.ext.args ?: ""
"""
some command \
    $input \
    $args 
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
def args = teask.ext.args ?: ""
command = """
some command \
    $input \
    $args 
"""

"""
echo '${command}'

touch myoutput.txt
"""

But obviously this creates a lot of code duplication and requires one to carefully keep the stub section aligned with every chaneg to the script section.

Suggest implementation

Could be default to output the would-be script to .command.sh.stub or something.
Or it could be an additional option like --stub-run-verbose or some such.
I am not sure how easy this would be to implement with how nextflow is written in honesty.

@warrenson
Copy link

warrenson commented Jun 1, 2024

But obviously this creates a lot of code duplication...

This is why I am here now.

Another suggestion

I'd be happy if the script text was available in the $task map when running in stub mode. So you could include it in the stub like:

stub:
echo "$task.script"
touch some output

Which would print the script contents, with variables expanded, in the .command.sh on the stub output.

(I edited this comment to add the suggestion)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants