1

我有这个小管道:


process test {
    """
    echo 'hello'
    exit 1
    """
}

workflow.onError {
    process finish_error{
        script:
        """
        echo 'blablabla'
        """
    }
}

echo blabla我想触发一个python脚本,以防管道使用完成错误过程出错,但即使使用简单的示例,整个过程似乎也不会被触发。

nextflow run test.nf 
N E X T F L O W  ~  version 20.10.0
Launching `test.nf` [cheesy_banach] - revision: 9020d641ca
executor >  local (1)
[56/994298] process > test         [100%] 1 of 1, failed: 1 ✘
[-        ] process > finish_error [  0%] 0 of 1
Error executing process > 'test'

Caused by:
  Process `test` terminated with an error exit status (1)

Command executed:

  echo 'hello'
  exit 1

Command exit status:
  1

Command output:
  hello

Command wrapper:
  hello

Work dir:
  /home/joost/nextflow/work/56/9942985fc9948fd9bf7797d39c1785

Tip: when you have fixed the problem you can continue the execution adding the option `-resume` to the run command line

如何触发此 finish_error 过程,以及如何查看其输出?

4

1 回答 1

1

onError进程导致管道执行过早终止时,将调用处理程序。由于 Nextflow 管道实际上只是连接在一起的一系列流程,因此从事件处理程序中启动另一个管道流程对我来说没有多大意义。如果您的 python 脚本应该使用本地执行器运行,您可以按照通常的方式执行它。此示例假定您的脚本是可执行的并且具有适当的 shebang:

process test {

    """
    echo 'hello'
    exit 1
    """
}

workflow.onError {

    def proc = "${baseDir}/test.py".execute()
    proc.waitFor()

    println proc.text
}

运行使用:

nextflow run -ansi-log false test.nf 
于 2020-11-20T12:51:40.773 回答