[slurm-users] How to detect Job submission by srun / interactive jobs

22 views
Skip to first unread message

Stephan Roth

unread,
May 18, 2020, 10:03:48 AM5/18/20
to slurm...@lists.schedmd.com
Dear all,

Does anybody know of a way to detect whether a job is submitted with
srun, preferrably in job_submit.lua?

The goal is to allow interactive jobs only on specific partitions.

Any recommendation or best practice on how to handle interactive jobs is
welcome.

Thank you,
Stephan

Florian Zillner

unread,
May 18, 2020, 11:21:48 AM5/18/20
to Slurm User Community List
Hi Stephan,

From the slurm.conf docs:
---
BatchFlag
Jobs submitted using the sbatch command have BatchFlag set to 1. Jobs submitted using other commands have BatchFlag set to 0.
---
You can look that up e.g. with scontrol show job <jobid>. I haven't checked though how to access that via lua. If you know, let me know, I'd be interested as well.

Example:
# scontrol show job 128922
JobId=128922 JobName=sleep
...
JobState=RUNNING Reason=None Dependency=(null)
Requeue=1 Restarts=0 BatchFlag=0 Reboot=0 ExitCode=0:0
RunTime=00:00:54 TimeLimit=00:30:00 TimeMin=N/A

Cheers,
Florian

Yair Yarom

unread,
May 19, 2020, 3:11:29 AM5/19/20
to Slurm User Community List
Hi,

We have here a job_submit_limit_interactive plugin that limits interactive jobs and can force a partition for such jobs. It also limits the number of concurrent interactive jobs per user by using the license system. It's written in c, so compilation is required. It can be found in: https://github.com/irush-cs/slurm-plugins

Note that while it depends on what exactly you're trying to avoid, users can somewhat easily circumvent this by e.g. submitting an sbatch of a jupyter notebook.

Best regards,
    Yair.

--
  /|       |
  \/       | Yair Yarom | Senior DevOps Architect
  []       | The Rachel and Selim Benin School
  [] /\    | of Computer Science and Engineering
  []//\\/  | The Hebrew University of Jerusalem
  [//  \\  | T +972-2-5494522 | F +972-2-5494522
  //    \  | ir...@cs.huji.ac.il
 //        |

Carlos Fenoy

unread,
May 19, 2020, 5:09:41 AM5/19/20
to Slurm User Community List
Hi,

In lua you can check for the job_desc.script field to be empty:

if (job_desc.script == nil or job_desc.script == '') then
...

Regards,
Carlos
--
--
Carles Fenoy
Reply all
Reply to author
Forward
0 new messages