flux-framework / flux-accounting

bank/accounting interface for the Flux resource manager
https://flux-framework.readthedocs.io/projects/flux-accounting/en/latest/index.html
GNU Lesser General Public License v3.0
3 stars 10 forks source link

idea: implement format string for some of the `view-*` commands #519

Closed cmoussa1 closed 3 weeks ago

cmoussa1 commented 1 month ago

Some great feedback given in #514 was to perhaps replicate flux-core's use of a format string when viewing data so that the user can customize the fields when looking at certain data, especially if it has many columns, like the association_table in the flux-accounting DB.

grondo commented 1 month ago

If it is helpful, there's examples of how to subclass the flux.util.OutputFormat class to easily add a -o, --format option to a command in the flux-core codebase.

The simplest example might be the HKFormat class in flux-housekeeping.py

Note also the subclass of UtilConfig used to store a couple default formats. This also allows users to register their own formats by name in system-wide or per-user config files

cmoussa1 commented 3 weeks ago

flux-accounting now has its own AccountingFormatter class with some common utility for printing out the results of a SQL query in both JSON or table format, so I'll go ahead and close this issue. I'll re-open more specific issues if they come up in the future.