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-job-records: accept multiple timestamp formats for after-start-time, before-end-time optional args #567

Merged
merged 3 commits into from
Jan 27, 2025

Conversation

cmoussa1
Copy link
Member

@cmoussa1 cmoussa1 commented Jan 27, 2025

Problem

The --after-start-time and --before-end-time optional args for the view-job-records command only takes one format: a seconds-since-epoch timestamp, which isn't super user friendly.


This PR makes use of the flux.util.parse_datetime() function to accept multiple, more human-readable format strings as values to the --after-start-time and --before-end-time optional args.

It adds a helper function to jobs_table_subcommands to perform the parsing of the timestamp. If parsing the timestamp string fails, it just attempts to pass it as a seconds-since-epoch timestamp to the SQLite query (which will return no job records if the timestamp is invalid).

I've also updated the help description to both of the optional arguments to provide examples of human-readable formats as well as added some basic sharness tests that pass different timestamp formats to the flux-accounting job-archive.

Fixes #565

Problem: The --after-start-time and --before-end-time optional args for
the view-job-records command only takes one format: a
seconds-since-epoch timestamp, which isn't super user friendly.

Utilize flux.util.parse_datetime() to accept multiple, more
human-readable format strings as values to the --after-start-time and
--before-end-time optional args. Add a helper function to
jobs_table_subcommands to perform the parsing of the string. If parsing
the timestamp string fails, just attempt to pass it as a
seconds-since-epoch timestamp (which will return no job records if the
timestamp is invalid).
Problem: The view-job-records command help description is not clear in
what formats it accepts for timestamps for the after-start-time and
before-end-time optional arguments.

Extend the help descriptions for both of these optional arguments and
provide examples of acceptable human-readable formats.
Problem: There exists no sharness tests for passing different timestamp
formats for the --after-start-time and --before-end-time optional
arguments for the view-job-records command.

Add some basic tests.
@cmoussa1 cmoussa1 added improvement Upgrades to an already existing feature commands related to the flux-accounting commands/bindings labels Jan 27, 2025
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 like a nice improvement!

@cmoussa1
Copy link
Member Author

Thanks! I'll set MWP here

@mergify mergify bot merged commit e3d6431 into flux-framework:master Jan 27, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commands related to the flux-accounting commands/bindings improvement Upgrades to an already existing feature merge-when-passing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

time format for --before-end-time and --after-start-time for view-job-records
2 participants