Is there a way to change running jobs created by srun, sbatch salloc to interactive mode? - slurm

The jobs are running with the slurm by executing the command below.
srun --pty --x11 ./my_work1
sbatch -p P1 ./mywork2
Is there a way to change jobs that are already running to interactive mode?

Related

Check sbatch script of running job

When running an slurm job from an sbatch script, is there a command that lets me see what was in the sbatch script that I used to start this job?
For example sacct tells me I'm on SLURM_JOB_ID.3 and I would like to see how many job steps there will be in total.
I'm looking for a command that takes the job id and prints the sbatch script it is running.
You can use
scontrol write batch_script SLURM_JOB_ID
The above will display the submission script for job identified with jobid 12345
More info: https://slurm.schedmd.com/scontrol.html#OPT_write-batch_script

Does Slurm MaxStepCount limit number of cumulative jobs I can invoke from any script

I have a top level script (bash) which invokes many scripts from inside and at leaf level Slurm jobs are launched using srun command.
top.sh
+ foo.sh
+ bar.sh
If cumulative number of jobs launched via srun from foo.sh and bar.sh exceeds MaxStepCount, further jobs will fail, is that right ?
Is there anyway to avoid it (other than changing MaxStepCount) ?

[slurm]How to check the job type on slurm ? batch or interactive

I want to determine whether a job on the slurm is a batch job or an interactive job.
It is possible to check the batch host with the following command, but is there a better way?
squeue -O "Name,BatchHost"
NAME EXEC_HOST
int login001
batch compute009
scontrol show job has a flag BatchFlag. The scontrol manpage says:
BatchFlag
Jobs submitted using the sbatch command have BatchFlag set to 1. Jobs submitted using other commands have BatchFlag set to 0.

Get ID of shell started using salloc

I just started using slurm and did
salloc -p UBUNTU bash
I started a script, then my system froze for another reason and I had to restart. How can I retrieve the ID of the allocated job so I can reattach and end the script?
You can see the list of your jobs with:
squeue -u $USER
Assuming you connect to your cluster with SSH, if you did not start a terminal multiplexer (such as screen or tmux) your job was most probably killed as soon as your SSH session ended.

SLURM how to know if a running job is a srun or a sbatch job?

I need to distinguish between batch and interactive job when are in RUNNING state.
I can't find with sact or stat a way to know if a job is a interactive session.
Did anyone already solved a similar problem?
You can use the batchflag formatting keyword in the squeue command to infer if a job has been submitted using the sbatch command.
$ squeue --Format=batchflag -u ${USER} --states=RUNNING
From the BatchFlag description in the scontrol help page:
Jobs submitted using the sbatch command have BatchFlag set to 1. Jobs submitted using other commands have BatchFlag set to 0.

Resources