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

python: create new `BankFormatter` subclass, restructure `view-bank` to use new class #525

Open cmoussa1 opened 2 weeks ago

cmoussa1 commented 2 weeks ago

Problem

The AccountingFormatter class has good overarching methods for printing the results of a query to the flux-accounting database, but there is some functionality specific to viewing bank information from the database that could use its own subclass.


This PR adds a new subclass called BankFormatter, which contains unique methods for viewing bank/user information in hierarchical and parsable formats with the view-bank command, particularly with the --tree, --users, and -P options. A new --fields option is also added to match the customization available in the list-banks command. It removes the helper functions previously defined in bank_subcommands.py in favor of using this new subclass.

I've added some new unit tests for the output of the reworked view-bank command to the testsuite as well as adjusted a number of expected output files throughout the testsuite to account for the use of the new BankFormatter subclass.