处理蛇形中的SIGPIPE错误 [英] Handling SIGPIPE error in snakemake

查看:121
本文介绍了处理蛇形中的SIGPIPE错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下snakemake脚本:

The following snakemake script:

rule all:
    input:
        'test.done'

rule pipe:
   output:
       'test.done'
   shell:
        """
        seq 1 10000 | head > test.done
        """

失败,并出现以下错误:

fails with the following error:

snakemake -s test.snake

Provided cores: 1
Rules claiming more threads will be scaled down.
Job counts:
    count   jobs
    1   all
    1   pipe
    2

rule pipe:
    output: test.done
    jobid: 1

Error in job pipe while creating output file test.done.
RuleException:
CalledProcessError in line 9 of /Users/db291g/Tritume/test.snake:
Command '
        seq 1 10000 | head > test.done
        ' returned non-zero exit status 141.
  File "/Users/db291g/Tritume/test.snake", line 9, in __rule_pipe
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/concurrent/futures/thread.py", line 55, in run
Removing output files of failed job pipe since they might be corrupted:
test.done
Will exit after finishing currently running jobs.
Exiting because a job execution failed. Look above for error message

说明返回了非零退出状态141 似乎是说snakemake已捕获到head发送的SIGPIPE失败.我猜严格来讲,snakemake在捕获失败方面做得正确,但是我想知道是否有可能忽略诸如此类的某些类型的错误.我有一个使用head命令的snakemake脚本,我试图找到解决此错误的方法.

The explanation returned non-zero exit status 141 seems to say that snakemake has caught the SIGPIPE fail sent by head. I guess strictly speaking snakemake is doing the right thing in catching the fail, but I wonder if it would be possible to ignore some types of errors like this one. I have a snakemake script using the head command and I'm trying to find a workaround this error.

推荐答案

是的,Snakemake默认情况下会设置pipefail,因为在大多数情况下,这是人们隐含的期望.您可以始终在特定的命令中将set +o pipefail;放在shell命令之前将其禁用.

Yes, Snakemake sets pipefail by default, because in most cases this is what people implicitly expect. You can always deactivate it for specific commands by prepending set +o pipefail; to the shell command.

这篇关于处理蛇形中的SIGPIPE错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆