You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何解决Slurm调度Singularity的Nextflow任务时的缺失stdout文件错误?

Nextflow + Slurm + Singularity 场景下的 Missing 'stdout' file 报错排查

初始测试脚本

搭建基于Slurm调度、集成Singularity组件的Nextflow流水线时,初始编写的单任务测试脚本如下:

#!/usr/bin/env nextflow

process createGroups {

  executor = 'slurm'
  queue = 'upgrade'
  memory = '10 GB'
  time = '30 min'
  cpus = 8
  clusterOptions = '--workdir /path/to/the/singularity/image'
    """
    singularity run ...
    """
}

执行表现

脚本提交后,Slurm节点上的任务本体实际执行成功,进程退出状态码为0,但Nextflow框架判定进程执行失败,抛出的完整报错信息为:

Error executing process > 'createGroups'

Caused by:
  Missing 'stdout' file: .../work/89/449f849ffc77a967be91ed994da860/.command.out for process > createGroups

Command executed:
executor >  slurm (1)
[89/449f84] process > createGroups [100%] 1 of 1, failed: 1 ✘
Error executing process > 'createGroups'

Caused by:
  Missing 'stdout' file: .../work/89/449f849ffc77a967be91ed994da860/.command.out for process > createGroups

Command executed:

  singularity run ...

Command exit status:
  0

Command output:
  (empty)

Work dir:
  .../work/89/449f849ffc77a967be91ed994da860

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

问题根因

报错由Slurm提交参数中的--workdir配置直接触发:
Slurm的--workdir参数会强制将作业的实际运行目录切换到指定路径,打破了Nextflow对任务工作目录的默认管理逻辑——Nextflow需要在自身维护的任务专属工作目录(即报错提示的路径)下,收集作业执行时重定向生成的.command.out、.command.err等校验文件,当作业运行目录被--workdir强制偏移后,Nextflow在默认路径下无法找到对应的输出文件,就会触发“文件缺失”的失败判定,即使任务本身执行成功、退出码为0也无法正常识别执行状态。

解决方法

  • 移除clusterOptions中配置的Slurm --workdir参数
  • 在进程的执行脚本块内,通过cd命令手动切换到目标路径后再执行Singularity相关命令

修复完成后,运行Nextflow时追加-resume参数,即可基于之前的缓存断点续跑,无需重新执行已成功完成的任务。


内容的提问来源于stack exchange,提问作者Pouya Ahmadvand

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.28 08:24:03