Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
job: make eventlog contexts json objects instead of free form text #2085
Per discussion in #2076. A few points worth mentioning:
ehhhh, maybe not worth it? Could we just accept quotes around any strings? Will have to adjust a number of tests as a result (i.e.
garlick left a comment •
Thanks - looks good! I did find a few things I think could be changed to improve the code. If I strayed into personal preference territory LMK, I'll bend.
On the string quotes/no quotes question, I'm fine as you have it, but don't feel strongly. Maybe @grondo has an opinion?
Yeah, I had the same thought, but I'm not sure I have any good insight. For now we should probably keep things simple, but I could see a point in the future where we might want to share the per-event "decode" functions between the job-manager and the flux-job eventlog command, so that wait-event or other utilities could be extended to search and/or wait based on not only the event but the context as @chu11 had mentioned before.
(Sorry, that isn't necessarily germane to the discussion about "text" mode, except that I was thinking that perhaps each event could have a custom method for formatting...)
FWIW, it is probably fine if JSON strings are quoted in "human readable" text mode.
Per RFC21 changes, update job-manager to format context data in a json object instead of key=value pairs. As a consequence, change event_job_post_fmt() to event_job_post_pack(), so event context data can be created similarly to how json_pack() is used.
Update flux job eventlog and flux job wait-event for recent updates to eventlog contexts stored in json format. Support new --context-format option for both subcommands, which allow user to output the context in raw json format or in a more readable key=value output.
Strings in the default flux job eventlog output are now quoted, so adjust tests that previously did not assume quotes around strings. Additional notes in an event are now listed via a key of "note" and not just additional text at the end of a line. Update tests accordingly to check for "note=".
@@ Coverage Diff @@ ## master #2085 +/- ## ========================================== - Coverage 80.44% 80.39% -0.05% ========================================== Files 193 192 -1 Lines 30532 30564 +32 ========================================== + Hits 24560 24571 +11 - Misses 5972 5993 +21