0

我正在开发一个运行 slurm 和 CentOS 的 HPC。我的工作流软件(Nextflow v19.10.0)需要执行这个命令

squeue --noheader -o %i %t -t all -u username

但是,我有一个错误引发以下错误

squeue: error: Unrecognized option: %
Usage: squeue [-A account] [--clusters names] [-i seconds] [--job jobid]  [-n name] [-o format] [-p partitions] [--qos qos] [--reservation reservation] [--sort fields] [--start]  [--step step_id] [-t states] [-u user_name] [--usage] [-L licenses] [-w nodes] [--federation] [--local] [--sibling]  [-ahjlrsv] 

有没有办法将上述命令包装在我的 .bashrc 文件中,所以当 Nextflow 运行该命令时,它会自动变成这个命令,我已经测试过它可以在我的集群上工作?

squeue --noheader -o "%i %t" -t all -u username

非常感谢你的帮助!!!

4

1 回答 1

1

如果 Nextflow 正在运行bash(您标记此问题的 shell),而不是 /bin/sh(这更常见,因为它是system()许多语言中的库调用的内容),您可以在任何封闭的 shell 中执行此操作:

# override *any* call to squeue with a very specific command that's known to work
squeue() {
  printf 'Ignoring old squeue arguments: ' >&2
  printf '%q ' "$@" >&2
  printf '\n' >&2
  command squeue --noheader -o '%i %t' -t all -u username
}
export -f squeue

但是,这可能行不通:很可能 Nextflow 实际上正在使用它sh,因此您需要创建一个目录,其中包含一个squeue可执行脚本,然后调用真正的 squeue命令,而不是使用导出的函数。因此:

#!/bin/bash
printf 'Ignoring old squeue arguments: ' >&2
printf '%q ' "$@" >&2
printf '\n' >&2

# FIXME: replace /usr/bin/squeue with the actual location of the real command 
exec /usr/bin/squeue --noheader -o '%i %t' -t all -u username
于 2020-01-24T16:57:05.967 回答