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
cmd/flux-job attach: add timestamps, --show-exec option #2388
Problem: attach event handling is somewhat involved and may benefit from some inline documentation. Add comment block for each attach continuation function, and rename print_output_continuation to attach_output_continuation for naming consitency.
Problem: flux-job attach has a context variable for the result of calling optparse_hasopt ("show-events"), but it also stores the optparse context in the same struct. This is unnecessary and won't scale as options are added. Drop ctx->show_events.
When the flux job attach --show-events option is in effect, display a timestamp for each eventlog entry, in %.3f seconds format. The timestamps are normalized to give the first entry a timestamp of 0.000. Move the code to a helper function, print_eventlog_entry().
Example with both event logs (sorting by timestamp since otherwise they are out of order)
grondo left a comment
This looks super useful! I wonder if there is some way to get these events somewhat sorted without piping to an external sort command? Perhaps pushing entries onto a sorted zlistx before printing entries from the list in a check watcher?
This might actually be a nice little module -- consume eventlog entries from multiple sources and print every N ms in sorted order, using a registered "print" handler for each entry type...
Anyway, that is probably a separate issue.
Add an attach option to display eventlog entries from the guest.exec.eventlog, in the same format as the main job eventlog entries. Change the logic slightly to: * Request the guest eventlog AFTER the main eventlog 'submit' event is received. This ensures guest events do not arrive before the timestamp zero point can be established by submit. * Don't cancel the guest eventlog after the 'output-ready' event. Continue processing guest events for display. Note that if both --show-exec and --show-events are specified, events from the two logs may be displayed out of time order, especially if the logs are not being produced in real time as they are consumed.
@@ Coverage Diff @@ ## master #2388 +/- ## ========================================== + Coverage 80.89% 80.91% +0.02% ========================================== Files 222 222 Lines 34986 34994 +8 ========================================== + Hits 28303 28317 +14 + Misses 6683 6677 -6