-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python: create new BankFormatter
subclass, restructure view-bank
to use new class
#525
Open
cmoussa1
wants to merge
8
commits into
flux-framework:master
Choose a base branch
from
cmoussa1:restructure.bank.views
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmoussa1
added
improvement
Upgrades to an already existing feature
low priority
items that can be worked on at a later date
labels
Nov 4, 2024
cmoussa1
force-pushed
the
restructure.bank.views
branch
2 times, most recently
from
November 19, 2024 18:26
49aecd2
to
fc18eb6
Compare
cmoussa1
changed the title
[WIP] python: create new
python: create new Nov 19, 2024
BankFormatter
subclass, restructure view-bank
to use new classBankFormatter
subclass, restructure view-bank
to use new class
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. Add a new subclass called BankFormatter, which contains unique methods for viewing bank/user information in hierarchical and parsable formats with the view-bank command. Remove the helper functions previously defined in bank_subcommands.py in favor of using this new subclass. Add a --fields optional argument to allow the user to customize which columns they want to be returned when looking at a row of information for a bank.
Problem: view-bank does not have many unit tests, especially for calling view-bank with custom outputs or viewing information in either JSON or table format. Add some unit tests.
Problem: The --users option for the view-bank command lists a lot of columns for every user row in the association_table, which crowds the output with potentially unneccessary information when looking at which users belong to the bank being looked at. The format of this option has been changed to: 1) be formatted in tables, and 2) only include a couple of columns per user row Adjust the expected output of the --users optional argument to account for the use of the BankFormatter subclass.
Problem: The --tree option for the view-bank command still lists the default information for the bank being viewed *before* printing the bank hierarchy, which is not necessary when the user passes the --tree option. Now that the view_bank() function has been reworked to use the new BankFormatter subclass, these options are more distinct from one another, and the --tree option no longer includes this info for the single bank at the top of the output when the --tree option is passed. Adjust the expected output in the sharness tests to account for the removal of the default info for the passed-in bank when calling view-bank with the --tree option.
Problem: The default output of the view-bank command is now JSON by default, but one of the sharness tests still looks for the old format before the introduction of the BankFormatter subclass. Change the expected output to match the new format of calling view-bank with no optional arguments.
Problem: There is a test in t1023-flux-account-banks.t that looks for a specific error message when trying to view a bank that does not exist, but this error message has changed slightly with the introduction of the BankFormatter subclass. Change the expected error message in t1023-flux-account-banks.t to account for the new message format.
Problem: The parsable option for viewing bank heirarchies in the flux-accounting database is meant just to be another option for the --tree option, but now the -P option requires --tree to also be passed when calling view-bank. There are multiple tests in the flux-accounting testsuite that call -P without --tree, and thus, these tests fail. Add --tree to the view-bank -P calls in the testsuite.
Problem: The view-bank command does not support the combination of both --tree and --fields, but there is no check for this in the testsuite. Add a test in t1023-flux-account-banks.t that makes sure the appropriate error message is raised when combining both --tree and --fields.
cmoussa1
force-pushed
the
restructure.bank.views
branch
from
November 26, 2024 19:33
fc18eb6
to
3ae8630
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
improvement
Upgrades to an already existing feature
low priority
items that can be worked on at a later date
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theview-bank
command, particularly with the--tree
,--users
, and-P
options. A new--fields
option is also added to match the customization available in thelist-banks
command. It removes the helper functions previously defined inbank_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 newBankFormatter
subclass.