formatter
: add new JobsFormatter
class, restructure view-job-records
to use new class
#563
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
formatter
module in flux-accounting does not have a class for formatting the output of job records which would be useful because the flux-accounting Python bindings manually define the formatting of these job records within its bindings.This PR creates a new class called
JobsFormatter
which takes a list of job records for formatting. It adds a method calledas_columns()
, which will create column-separated output of job records to be returned while supporting custom formatting (i.e allowing custom formatting of these columns).view-job-records
is restructured to use the newJobsFormatter
class instead of defining its own print function as well as modified to include a--fields
optional argument to the command to allow the user to specify which fields to include in their output if they so choose.Finally, a couple of the
view-job-records
tests are cleaned up to account for the use of the new formatter class.