Scheduler Plugin
The Scheduler plugin (scheduler.py) may be used to collect cluster, node, power, job, reservation, QOS, step, user/account, and node-reason information that is available via scheduler CLI commands (Slurm: scontrol, sacct, sacctmgr, sinfo, squeue, sstat; Flux: flux jobs), transforms and filters the parsed records, and writes LML files for LLview's dbupdate action.
It typically runs periodically via cronjob on LLview Remote (e.g., a login or service node) under an account permitted to query cluster-wide Scheduler state.
Command-Line Interface
python3 scheduler.py --config config.yml [OPTIONS]
| Flag |
Required |
Default |
Description |
--config <file> |
Yes |
— |
Path to the YAML configuration file. |
--loglevel <level> |
No |
INFO |
Logging verbosity (DEBUG, INFO, WARNING, ERROR). |
--singleLML <file> |
No |
— |
Merge all sections into a single LML output file instead of one file per section. |
--outfolder <dir> |
No |
— |
Base output directory prepended to all generated LML paths. |
Processing Pipeline
Each top-level section in the YAML file is processed in the following order:
- Command Execution & Parsing:
- Executes
cmd via shell (shell=True, supporting pipes and subshells).
- Selectively caches commands appearing in multiple sections and evicts them from memory after their final consumer finishes.
- Parses
scontrol multi-line blocks or delimited CSV-like output (sacct, sacctmgr, sinfo, squeue, sstat), converting (null) to "".
modify_after_parse: Transforms raw parsed fields.
apply_function: Runs Python enrichment hooks on the section's dataset.
modify_before_mapping: Transforms fields prior to filtering and mapping.
exclude / include: Filters records via regular expressions.
mapping: Renames and selects fields to keep in the LML output (preserving __type, __id, __prefix).
add: Executes additional sub-commands (optionally via foreach) and merges their fields and mappings.
- LML Output: Writes
<objects>, <information>, and a pstat timing/count record (__nelems_<type>).
Section Configuration Reference
Core Options
| Key |
Type |
Default |
Description |
cmd |
string |
— |
Command to execute. Optional if data is synthesized by apply_function (e.g., sysinfo). |
LML |
string |
— |
Output LML XML file path (required unless --singleLML is set). |
type |
string |
'item' |
Entity type written to <object type="...">. |
prefix |
string |
'i' |
Prefix used to generate <object id="...">. |
delimiter |
string |
'\|' |
Column separator for CSV-like commands (sacct, sacctmgr, sinfo, squeue). |
full_line_fields |
list / string |
Built-in defaults |
Extra scontrol keys preserved as full lines (merged with Comment, Extra, Reason, Command, WorkDir, StdErr, StdIn, StdOut, TRES, OS). |
timestamp |
dict |
— |
Enables -S <start> / -E <end> time-window queries (see below). |
modify_after_parse |
dict |
— |
Map of field: function (or list / comma-separated string of functions) run after parsing. |
apply_function |
string / list |
— |
Hook function(s) executed on the parsed dataset. |
modify_before_mapping |
dict |
— |
Map of field: function (or list / comma-separated string of functions) run before filtering/mapping. |
exclude |
string / list / dict |
— |
Regex rules removing matching entries. |
include |
string / list / dict |
— |
Regex rules retaining only matching entries. |
mapping |
dict |
— |
Map of source_field: lml_field. Unmapped keys are dropped from the LML output. |
add |
list[dict] |
— |
Extra command blocks merged into the same section/LML file. |
timestamp Sub-Options
| Key |
Type |
Default |
Description |
file |
string |
— |
State file storing the last query epoch timestamp. Subtracts 300s on read for overlap; defaults to the last 24h if missing. |
ts_delay |
int / float |
0 |
Seconds subtracted from current time when setting -E <end_time>. |
add Sub-Options
Each entry in add supports cmd, timestamp, prefix, type, delimiter, full_line_fields, modify_after_parse, apply_function, modify_before_mapping, exclude, include, mapping (merged with parent mapping), plus:
| Key |
Type |
Description |
foreach |
string |
Field name from primary results; runs cmd once per unique value, substituting $$<field>$$. |
Section-Specific Options
| Option |
Used By |
Type |
Description |
motd |
sysinfo |
string |
Path to /etc/motd. Strips * border lines, escapes " as ", and joins lines with \n. |
support |
accountinfo |
dict |
Generates support entries (type default 'supportmap_slurm', prefix default 'SS', users list). |
systemname |
nodeinfo |
string / dict |
System identifier for mem_reserved lookup. Supports string/${VAR}, {file: path}, or {env: VAR}. |
mem_reserved |
nodeinfo |
number / dict |
Reserved memory (MB) subtracted from RealMemory - FreeMem (single value or dict keyed by systemname). |
Filtering (exclude and include)
Regex matching uses re.match (anchored at the start of the string; use .* for substring matching).
| Rule Format |
Matches Against |
Example |
string |
Entry ID / key |
include: '^jpca-.*' |
list[string] |
Entry ID / key (any match) |
include: ['jrc000.*', 'jrc020.*'] |
dict[field, str \| list] |
Attribute value(s) (any match) |
include: {Partition: ['^booster$', '^largebooster$']} |
list[dict] |
Attribute value(s) across rules |
exclude: [{gpus: '4'}, {State: 'DOWN'}] |
Built-in Modifier Functions
Used in modify_after_parse and modify_before_mapping:
| Function |
Input Example |
Output / Behavior |
expand_NodeList |
jpbo-[08-10,15] |
Space-separated node names (jpbo-08 jpbo-09 jpbo-10 jpbo-15), preserving zero-padding. |
remove_duplicate |
12-12 |
First value (12) when matching <num>-<num>. |
remove_key |
cpu=72 |
Value after first = (72). |
remove_id_num |
user1(12345) |
Strips trailing parenthesized integer (user1). |
to_seconds |
1-02:30:00 / 5 minutes / (10 seconds) |
Integer seconds. |
to_hours |
1-02:30:00 |
Floating-point hours (26.5). |
modify_date |
2026-11-09T07:13:17 |
Replaces T with a space (2026-11-09 07:13:17); returns "" for None. |
modify_state |
ALLOC, MIXED, PENDING, TIMEOUT, ... |
Normalizes node states (Running, Idle, Drained, Maint, Down) and job states (Running, Pending, Completed, Cancelled, Failed, Suspended). |
modify_load |
N/A |
Converts N/A to "-1". |
id_to_username |
CANCELLED by 1001 |
Resolves UID to username via Python pwd (falling back to id <uid>). |
Built-in apply_function Hooks
| Function |
Target Data |
Behavior |
sysinfo |
System |
Creates cluster entry with hostname, system_time, type='Cluster', and optional motd. |
accountinfo |
Accounts (squeue) |
Re-indexes entries by USER, joins unique ACCOUNTs with commas, sets id/ts, and emits support entries. |
nodeinfo |
Nodes (scontrol) |
Extracts gpus from Gres, computes physicalcores (CPUTot // ThreadsPerCore), queries scontrol show part for classes ([part:cpus]), and computes UsedMem (falling back to AllocMem). |
jobinfo |
Jobs (scontrol) |
Sets status/detailedstatus, computes MinCPUsNode and totaltasks, and formats NodeList/SchedNodeList as (node,cpus). |
stepinfo |
Steps (sacct) |
Splits step IDs into jobid and step (default 'job'), and splits ExitCode into rc and signr (default '-'). |
reasonsinfo |
Reasons (sinfo -R) |
Unpacks grouped NODELIST records into individual per-node entries with nodeid. |
add_ts |
Any |
Adds current Unix epoch timestamp under key ts for every record. |
Example Configuration
Full reference configurations for the Scheduler plugin are maintained in the LLview configuration repository: