Are you using the job_script storage option? If so then you should be able to get at it by doing:

sacct -B j JOBID

https://slurm.schedmd.com/sacct.html#OPT_batch-script

-Paul Edmon-

On 2/16/2024 2:41 PM, Jason Simms via slurm-users wrote:
Hello all,

I've used the "scontrol write batch_script" command to output the job submission script from completed jobs in the past, but for some reason, no matter which job I specify, it tells me it is invalid. Any way to troubleshoot this? Alternatively, is there another way - even if a manual database query - to recover the job script, assuming it exists in the database?

sacct --jobs=38960
JobID           JobName  Partition    Account  AllocCPUS      State ExitCode
------------ ---------- ---------- ---------- ---------- ---------- --------
38960        amr_run_v+ tsmith2lab tsmith2lab         72  COMPLETED      0:0
38960.batch       batch            tsmith2lab         40  COMPLETED      0:0
38960.extern     extern            tsmith2lab         72  COMPLETED      0:0
38960.0      hydra_pmi+            tsmith2lab         72  COMPLETED      0:0

scontrol write batch_script 38960
job script retrieval failed: Invalid job id specified

Warmest regards,
Jason

--
Jason L. Simms, Ph.D., M.P.H.
Manager of Research Computing
Swarthmore College
Information Technology Services
(610) 328-8102
Schedule a meeting: https://calendly.com/jlsimms