Adding JSON to pbs_rstat
Links
Link to discussion on Developer Forum: https://community.openpbs.org/t/design-proposal-add-json-output-support-to-pbs-rstat/4167?u=amehm
Link to issue: <issue link if available>
Link to pull request: https://github.com/openpbs/openpbs/pull/2680
Overview
Currently, the pbs_rstat command does not support alternate output formats such as JSON. The current usage is:pbs_rstat [-B] [-f|-F] [-S] [<reservation ID>...]
The -f and -F flags are functionally the same, both providing "full" output, with the only difference being case. To stay consistent with other PBS commands, we propose reassigning the -F flag as a formatting option (e.g., -F JSON), while retaining -f for full output. This avoids introducing a brand new flag and aligns with established PBS conventions.
With this change, users can format output in JSON by using -F JSON in combination with any other flags. For example:
pbs_rstat -f -F JSON→ JSON-formatted FULL outputpbs_rstat -B -F JSON→ JSON-formatted BRIEF outputpbs_rstat -S -F JSON→ JSON-formatted SHORT outputpbs_rstat -F JSON→ JSON-formatted default output (short format is default when no flag format is provided).
The JSON output will be consistent with the plaintext output. Fields purposefully omitted in the plaintext full output (like resv_execvnodes and resv_timezone) will also be omitted in the JSON output, preserving the same behavior.
Example: Short Output Comparison
Plaintext Output (pbs_rstat -S):
Suggested JSON Output (pbs_rstat -S -F JSON):
Note: Top-level keys such as timestamp, pbs_version, and pbs_server are included to match output behavior from other PBS commands that support JSON.
A pull request is currently in progress to implement these updates.