-
Notifications
You must be signed in to change notification settings - Fork 51
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
add ResourceJournalConsumer
and EventLogFormatter
classes and use them to standardize flux resource eventlog
#6614
add ResourceJournalConsumer
and EventLogFormatter
classes and use them to standardize flux resource eventlog
#6614
Conversation
c2f2388
to
cbb5beb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done! Good docs too!
I gave this an admittedly light skim and tried it out a bit and LGTM! Very nice to have the flux resource eventlog
command dressed up like one expects.
subclasses will follow the interface documented here. | ||
|
||
A journal consumer is created by passing the constructor an open | ||
:obj:`~flux.Flux` handle, the topic string of the journal servicealong |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
servicealong needs a space
cbb5beb
to
10502d9
Compare
Problem: The EventLogEvent class is defined in flux.job.event, but the eventlog format is not specific to jobs. Move the EventLogEvent class up a level to eventlog.py. For backwards compatibility, retain the ability to import EventLogEvent from flux.job and flux.job.event.
Problem: The JournalConsumer class in flux.job is specific to the job manager journal, but there may be other services that implement a journal-like interface. Add an abstract base class for journal consumer interfaces in flux.abc.JournalConsumerBase. Include a JournalEventBase class that derives from EventLogEvent. Most of the journal consumer interface is implemented in this class, with the expectation that derived classes only need to implement the few abstract methods left open for implementations.
Problem: The flux.job.JournalConsumer class duplicates code from the JournalConsumerBase class. Make flux.job.JournalConsumer a subclass of the JournalConsumerBase abstract base class.
Problem: There is no interface for the resource module journal. Add flux.resource.journal.JournalConsumer as a subclass of the JournalConsumerBase abstract base class.
Problem: There are no test of the Python ResourceJournalConsumer class. Add a Python based test in t/python/t0032-resource-journal.py.
Problem: Python utilities do not have access to the eventlog formatter class used by all C utilities for standard eventlog presentation. Add a Python EventLogFormatter class that mimics the C version.
Problem: There are no tests of the Python EventLogFormatter class. Add a new test t/python/t0033-eventlog-formatter.py.
Problem: `flux resource eventlog` doesn't have the same options and functionality as other eventlog commands. Make the options and functionality of `flux resource eventlog` match the standard Flux utility eventlog interface using the Python EventLogFormatter class.
Problem: t2355-resource-journal.t assumes the output of `flux resource eventlog` is JSON, but this is no longer true. Pass `-f json` to the command to force JSON output.
Problem: Newly added options to `flux resource eventlog` are not tested in t2355-resource-journal.t. Expand testing to cover new options.
Problem: The `flux resource eventlog` implementation uses the resource.journal RPC directly, but there's now a Python class for that. Use ResourceJournalConsumer to simplify the `flux resource eventlog` implementation.
Problem: New options to `flux resource eventlog` are not documented in flux-resource(1). Update the docs.
Problem: The `eventlog` subcommand of flux-resource(1) does not have tab completions. Add them to etc/completions/flux.pre.
10502d9
to
90ef568
Compare
Thanks! I've rebased and fixed that typo and will set MWP now. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6614 +/- ##
==========================================
+ Coverage 83.81% 83.86% +0.05%
==========================================
Files 530 534 +4
Lines 88237 88381 +144
==========================================
+ Hits 73955 74120 +165
+ Misses 14282 14261 -21
|
The main purpose of this PR is to add the Python
ResourceJournalConsumer
class, which mimics the existing job managerJournalConsumer
class. In fact, most of the originalJournalConsumer
class implementation is moved to an abstractJournalConsumerBase
class, then both the job managerJournalConsumer
andResourceJournalConsumer
classes inherit from that.In addition, the
flux resource eventlog
utility is modified to have similar options to the rest of theeventlog
utilities in Flux (--format
,--time-format
,--color
,--human
)using a newEventLogFormatter
class and the newly addedResourceJournalConsumer
class.