0
$\begingroup$

I'm wondering how Snakemake deals with output to stdout and stderr that is generated when running a rule with a shell: command.

I ran the following rule and only got informed that there was a non-zero exit code. However, I did not get a stack trace. To get access to the stack trace I had to run the shell command manually:

# Shortened for clarity
rule parse:
    input:
        sequences = rules.join_downloads.output
    output:
        sequences = "data/sequences.fasta"
    shell:
        """
        augur parse
        """

Why is that? And can I somehow make Snakemake output more detailed information when something goes wrong to help with debugging?

$\endgroup$

1 Answer 1

1
$\begingroup$

You usually define a log file like below, and redirect the stdout and/or stderr to it. Stdout is >, stderr is 2> and both of them combined is &>.

rule parse:
    input:
        sequences = rules.join_downloads.output
    output:
        sequences = "data/sequences.fasta"
    log:
        my_output/my_log.log
    shell:
        """
        augur parse 2> {log}
        """
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.