On 1/10/24 19:39, Drucker, Daniel wrote:

What am I misunderstanding about how sacct filtering works here? I would have expected the second command to show the exact same results as the first.

You need to specify --end NOW for this to work as expected. From the man page:

  WITHOUT --jobs AND WITH --state specified:
  --starttime defaults to Now.
--endtime defaults to --starttime and to Now if --starttime is not specified.

Eg

> sacct --starttime $(date -d "7 days ago" +"%Y-%m-%d") -X --format JobID,JobName,State,Elapsed --name bash
JobID           JobName      State    Elapsed
------------ ---------- ---------- ----------
570741             bash  COMPLETED   00:00:02
570742             bash  COMPLETED   00:00:02
570743             bash     FAILED   00:00:01
570744             bash     FAILED   00:00:01
570745             bash     FAILED   00:00:01
570746             bash  COMPLETED   00:00:02
570747             bash  COMPLETED   00:00:02
570748             bash  COMPLETED   00:00:02

> sacct --starttime $(date -d "7 days ago" +"%Y-%m-%d") -X --format JobID,JobName,State,Elapsed --name bash --state COMPLETED
JobID           JobName      State    Elapsed
------------ ---------- ---------- ----------
>

> sacct --starttime $(date -d "7 days ago" +"%Y-%m-%d") -X --format JobID,JobName,State,Elapsed --name bash --state COMPLETED --end now
JobID           JobName      State    Elapsed
------------ ---------- ---------- ----------
570741             bash  COMPLETED   00:00:02
570742             bash  COMPLETED   00:00:02
570746             bash  COMPLETED   00:00:02
570747             bash  COMPLETED   00:00:02
570748             bash  COMPLETED   00:00:02


Hope this helps!
Chris
--
Chris Samuel  :  http://www.csamuel.org/  :  Berkeley, CA, USA


Reply via email to