Ticket 5353

Summary: sinfo/squeue: display parseable output with configurable delimiter
Product: Slurm Reporter: Jeff Frey <frey>
Component: User CommandsAssignee: Unassigned Developer <dev-unassigned>
Status: OPEN --- QA Contact:
Severity: 5 - Enhancement    
Priority: --- CC: sts
Version: 17.11.7   
Hardware: Linux   
OS: Linux   
Site: -Other- Alineos Sites: ---
Atos/Eviden Sites: --- Confidential Site: ---
Coreweave sites: --- Cray Sites: ---
DS9 clusters: --- HPCnow Sites: ---
HPE Sites: --- IBM Sites: ---
NOAA SIte: --- OCF Sites: ---
Recursion Pharma Sites: --- SFW Sites: ---
SNIC sites: --- Linux Distro: ---
Machine Name: CLE Version:
Version Fixed: Target Release: ---
DevPrio: --- Emory-Cloud Sites: ---
Attachments: "git diff master" against the change branch

Description Jeff Frey 2018-06-26 08:40:38 MDT
Created attachment 7187 [details]
"git diff master" against the change branch

When requesting node/queue/job information using the sinfo and squeue utilities, the fixed-width display of the information is undesirable for machine-parsed cases (see also the primary request in bug 1804). For long-format arguments, using zero-width runs the fields together:

    $ sinfo --Format="nodeaddr:0,cpus:0"
    NODE_ADDRCPUS
    r00n0236
    r00n0336
       :

Using short --format would work, but not every data point available via long-format tags are available in the short format.

This patch implements two new CLI flags to the sinfo and squeue utilities that can be used to produce machine-parseable output.

  - added -D/--delimiter=<DELIM>
    - print a static string between each field displayed
  - added --parseable
    - all fields zero width (print entire thing)
    - w/o explicit -D/--delimiter, a "|" delimiter is implied
  - augmented long-format field name parsing to allow trailing suffixes
    - <field-name>[:[.][<width>][<suffix>]]
    - Example: --Format="nodeaddr:0|,features:0:,cpus:0"

    $ sinfo --Format="nodeaddr:0|,features:0:,cpus:0"
    NODE_ADDR|AVAIL_FEATURES:CPUS
    r00n02|E5-2695,E5-2695v4:36
    r00n03|E5-2695,E5-2695v4:36
       :

  - miscellaneous other fixes
    - addressed leaking list iterators in print functions (early return on error)