I put this line in my job-control file (written in bash) to capture the original as part of the run:

   cp $0 $RUNDIR/$SLURM_JOB_NAME

The $0 gives the full path to the working copy of the script, so it expands to this for example:

   /fs/slurm/var/spool/job67842/slurm_script

It depends on this spooling directory being readable by all users.
This may not be the case on all systems.
If not, there might be a way to make it readable to just the owner of the job, you'd have to talk to the SLURM developers about that.

Also I'm not setting the jobname, so the $SLURM_JOB_NAME defaults to the name of the original script. Otherwise, you should also be able to extract this from the "command" field output from squeue.

Note that this only works because the job is still running.
But it enables me to edit-and-submit the script in rapid-fire and capture the original script with each of the runs. So I can put it in the same directory where all the other output files go, and have a complete description of the run conditions.


------------------------------------------------------------------------
Subject:        [slurm-users] Get original script of a job
Date:   Fri, 5 Mar 2021 10:29:58 +0000
From:   Alberto Morillas, Angelines <angelines.albe...@ciemat.es>
Reply-To:       Slurm User Community List <slurm-users@lists.schedmd.com>
To:     slurm-users@lists.schedmd.com <slurm-users@lists.schedmd.com>



*External email: Use caution opening links or attachments*


Hi,

I would like to know if it will be possible to get the script that was used to send a job.

I know that when I send a job with scontroI can get the path and the name of the script used to send this job, but normally the users change theirs scripts and sometimes all was wrong after that, so is there any possibility to reproduce the script of an old job???

Thanks in advance


Angelines

Reply via email to