使用Slurm作业ID [英] Use slurm job id

查看:170
本文介绍了使用Slurm作业ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在集群上启动计算时,通常我有一个单独的程序在最后进行后处理:

When I launch a computation on the cluster, I usually have a separate program doing the post-processing at the end :

sbatch simulation
sbatch --dependency=afterok:JOBIDHERE postprocessing

我想避免出现错误,并自动插入良好的工作ID.任何的想法?谢谢

I want to avoid mistyping and automatically have the good job id inserted. Any idea? Thanks

推荐答案

您可以执行以下操作:

RES=$(sbatch simulation) && sbatch --dependency=afterok:${RES##* } postprocessing

RES变量将保存sbatch命令的结果,类似于Submitted batch job 102045.在当前情况下,构造${RES##* }隔离最后一个单词(请参见此处).工作编号. &&部分可确保您不会在第一次提交失败的情况下尝试提交第二份工作.

The RES variable will hold the result of the sbatch command, something like Submitted batch job 102045. The construct ${RES##* } isolates the last word (see more info here), in the current case the job id. The && part ensures you do not try to submit the second job in the case the first submission fails.

这篇关于使用Slurm作业ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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