You have to specify the --starttime
and --endtime
to see the jobs completed in a specific time duration. Otherwise the start and end time will be the current time when the --state option is specified and only currently running jobs can be displayed (Check here).
For example,
sacct --starttime $(date -d 'last week' +%D-%R) --endtime midnight --state COMPLETED
The documentation states the following:
A start and/or end time must be specified to view information about
jobs not currently running. See the JOB STATE CODES section below for
a list of state designators. Multiple state names may be specified
using comma separators. Either the short or long form of the state
name may be used (e.g. CA or CANCELLED) and the name is case
insensitive (i.e. ca and CA both work).
These are the job state codes:
CA CANCELLED Job was cancelled by the user or a sysadmin
CD COMPLETED Job finished normally, with exit code 0
F FAILED Job finished abnormally, with a non-zero exit code
OOM OUT_OF_MEMORY Job was killed for using too much memory
PD PENDING Job is waiting to start
R RUNNING Job is currently running
TO TIMEOUT Job was killed for exceeding its time limit
Another example: to see jobs that completed, either normally or abnormally, since July 12th, without job steps:
sacct -S 0712 -s CD,F
Visit here for more information.