sacct

The sacct command displays accounting data for all jobs and job steps in the Slurm job accounting log or Slurm database.

To view job information about a specific job:

sacct -j 100272

JobID           JobName  Partition    Account   AllocCPUS      State ExitCode 
------------ ---------- ---------- ----------   ---------- ---------- -------- 
100272          test.sh  gpu-a100  193000-100000        72    TIMEOUT      0:0 
100272.batch      batch            193000-100000        72    RUNNING      0:15 
100272.exte+     extern            193000-100000        72  COMPLETED      0:0 
100272.0     HelloWorld            193000-100000        72  CANCELLED      0:15

To view job information about all of a user’s jobs: sacct -u <username>

Retrieving Previous Job Scripts

Slurm’s accounting feature lets you retrieve the exact script used for previous jobs—helpful when a run succeeded but you don’t remember the parameters.

Get Job ID:

sacct -X

Add -S YEAR-MM-DD to include older jobs.

Dump the Run-Script:

sacct --batch-script --jobs <JOB_ID>

This prints your subscript exactly as it was submitted, including all #SBATCH directives and environment variables.