Skip to main content

Crate sacct_parse

Crate sacct_parse 

Source
Expand description

Parse Slurm sacct --parsable2 rows into typed records.

sacct prints one pipe-separated line per accounting row. This crate reads one line at a time and turns it into a Record: timestamps as Unix seconds, runtimes as seconds, wall limits as Limit, job states as a State enum, and allocated resources as a count per resource name. A row that cannot be read earns an Error that names the row and the field, never a quiet default.

§The clock is the caller’s

sacct prints local clock readings with no zone on them. This crate does not carry a timezone database and does not guess one: every parsing function takes utc_offset_seconds, the zone’s offset at the time of the export, and computes unix = civil_interpreted_as_utc − utc_offset_seconds. A site whose clock changes mid-export makes two calls with two offsets; the crate stays arithmetic.

§Parsing, not deciding

Every row parses. Job steps are still records — Record::is_step says which they are, and the caller decides what to do with them. An unfinished job parses like a finished one. Nothing here filters by GPU, renumbers ids, applies tiers, or writes a file.

Structs§

Record
One parsed sacct row. Data.

Enums§

Error
Why a row could not be parsed. Data.
Limit
TimelimitRaw: the minutes a job asked for, or no limit. Data.
State
State, matched on the first whitespace-separated word of the field. Data.

Functions§

parse_file
Parse a whole sacct --parsable2 --noheader export. Calculation.
parse_row
Parse one sacct --parsable2 --noheader row. Calculation.