Skip to content
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

view_jobs(): adjust helper function to actually return a string #522

Merged
merged 3 commits into from
Oct 31, 2024

Conversation

cmoussa1
Copy link
Member

Problem

The convert_to_str() function used to convert a list of JobRecord objects to a string does not actually convert it to a string, but rather just appends separate strings to a list and then returns a list. Thus, flux-account.py has to have some special logic for just the view-job-records command to parse the returned data from the function.


This PR adds a .join() call to the convert_to_str() function to actually construct a string of all of the job records returned by view_jobs(). It also removes the special logic in flux-account.py that iterates through the list of job records and prints it out since it is no longer needed. I've also adjusted the unit tests in t1006_job_archive.py to use a better function in jobs_table_subcommands.py, as well as fixed a test description for one of the unit tests.

@cmoussa1 cmoussa1 added improvement Upgrades to an already existing feature low priority items that can be worked on at a later date labels Oct 29, 2024
Copy link
Member

@jameshcorbett jameshcorbett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable!

@cmoussa1
Copy link
Member Author

Thanks! Setting MWP here

Problem: The convert_to_str() function used to convert a list of
JobRecord objects to a string does not actually convert it to a string,
but rather just appends separate strings to a list and then returns a
list. Thus, flux-account.py has to have some special logic for just the
view-job-records command to parse the returned data from the function.

Add a .join() call to the convert_to_str() function to actually
construct a string of all of the job records returned by view_jobs().
Remove the special logic in flux-account.py that iterates through the
list of job records and prints it out since it is no longer needed.
Problem: The unit tests for jobs_table_subcommands.py use view_jobs()
for checking the correct amount of job records returned, but get_jobs()
is a better function to call here since it returns a list.

Convert the view_jobs() calls to get_jobs() in the unit tests in
t1006_job_archive.py. Since the return value of get_jobs() does not
include the headers for the job records, reduce all of the expected
lengths of job record lists by 1.
Problem: One of the descriptions of one of the unit tests in
t1006_job_archive.py is incorrectly stating that one of the function
calls should raise an error, but this is not the case; it should just
return a list of length 0.

Adjust the test description to more accurately explain what the expected
behavior is.
@mergify mergify bot merged commit 012d2b5 into flux-framework:master Oct 31, 2024
13 checks passed
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 merge-when-passing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants