Adding JSON to pbs_rstat

Adding JSON to pbs_rstat

Links

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 output

  • pbs_rstat -B -F JSON → JSON-formatted BRIEF output

  • pbs_rstat -S -F JSON → JSON-formatted SHORT output

  • pbs_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.