如何仅将 squeue 设为 return unique job_ids

How to get squeue only to return unique job_ids

所以我有一些代码想从工作名称列表

中获取所有job_ids

squeue --nohead --format %F --name {JOB_NAME}

但是,当相关作业是数组作业时,它 return 是同一作业 ID 的多个副本。有没有办法让我从数组作业中仅 return 获得 job_id 的单个副本?

更简单的方法是使用命令 uniq

squeue --nohead --format %F --name {JOB_NAME} | uniq

squeue 的输出通过管道传递给 uniq 命令。