slurm queuing system: get jobfile from ID

As I use the same jobfile for several jobs with only minor (sometimes automated) changes, I do not retain copies of the jobscripts submitted to slurm. For automated progress reports during runtime, I need to get at least some information of the jobfiles. As far as google told me, there is no convenient way to access the jobfile version slurm works with. Hence, here is a workaround for those who have shell access to the nodes. Just add the following lines to your .bashrc. The function expects a single parameter, the jobid (only the number!).

catjobfile() {
	HOST=$(squeue -j 196929 | tail -n1 | sed 's/^.* //')
	echo 'cat $(ps aux | grep slurm_script | grep job'$1' | sed "s/^.*\ //")' | ssh $HOST 2>/dev/null
}

You may also like...

Leave a Reply

Your email address will not be published.