简体   繁体   English

防止 Slurm 用户在他/她自己的工作上运行 scancel

[英]Prevent Slurm user from running scancel on his/her own job

In our HPC setup where Slurm is installed, after a user logs in using ssh, a script is executed where a job is submitted using srun with an interactive bash.在我们安装了 Slurm 的 HPC 设置中,用户使用 ssh 登录后,将执行一个脚本,其中使用 srun 和交互式 bash 提交作业。 The script is placed on.profile and the user cannot modify it.该脚本放在.profile 上,用户不能修改它。 This is the contents of the bash script file.这是 bash 脚本文件的内容。

srun -A <ACCOUNT_NAME> -p --mem=< MEMORY> --time=HH:MM:SS -N <NUM_NODES> --gres=gpu:<NUM_GPU> --pty /bin/bash -i srun -A <帐户名> -p --mem=<内存> --time=HH:MM:SS -N <NUM_NODES> --gres=gpu:<NUM_GPU> --pty /bin/bash -i

Is there a way to prevent this user from bypassing slurm?有没有办法阻止这个用户绕过 slurm? Since the user can perform scancel on the job id anyway.由于用户无论如何都可以对作业 ID 执行 scancel。 Or is there a way to prevent the user from performing the scancel command?或者有没有办法阻止用户执行 scancel 命令?

Please advise.请指教。 Thank you.谢谢你。

There is no simple way to prevent users from managing their own job (you could create wrappers that submit/manage jobs with another user id, but that would be difficult to manage/maintain/).没有简单的方法可以阻止用户管理他们自己的作业(您可以创建包装器来使用另一个用户 ID 提交/管理作业,但这将难以管理/维护/)。

One option could be to add exit or logout after the srun... line in .profile so that as soon as the Slurm job is terminated (either scancel led or after the user has exit ed from the interactive session, the SSH session is terminated as well. One option could be to add exit or logout after the srun... line in .profile so that as soon as the Slurm job is terminated (either scancel led or after the user has exit ed from the interactive session, the SSH session is terminated也是。

srun -A ...
exit

Another option is to exec the srun command rather than simply running it:另一种选择是exec命令, srun不是简单地运行它:

exec srun -A ...

so that the srun instance replaces the Bash instance running outside of the control of Slurm.以便srun实例替换在 Slurm 控制之外运行的 Bash 实例。 As soon as srun is terminated (for either reason as above), the user will be disconnected.一旦srun终止(出于上述任一原因),用户将断开连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM