Skip to content

Commit 779a41d

Browse files
authored
Merge pull request #6614 from grondo/resource-journal-consumer
add `ResourceJournalConsumer` and `EventLogFormatter` classes and use them to standardize `flux resource eventlog`
2 parents c205af7 + 90ef568 commit 779a41d

File tree

16 files changed

+1236
-244
lines changed

16 files changed

+1236
-244
lines changed

doc/man1/flux-resource.rst

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ SYNOPSIS
2222
| **flux** **resource** **reload** [-f] [--xml] *path*
2323
2424
| **flux** **resource** **acquire-mute**
25-
| **flux** **resource** **eventlog** [*-w* *EVENT*] [*-F*]
25+
| **flux** **resource** **eventlog** [*-w* *EVENT*] [*-f* *FORMAT*] [*-T* *FORMAT*] [*-L* [*WHEN*]] [*-H*] [*-F*]
2626
2727
DESCRIPTION
2828
===========
@@ -364,6 +364,26 @@ eventlog
364364

365365
Watch the resource journal, which is described in RFC 44.
366366

367+
.. option:: -f, --format=FORMAT
368+
369+
Specify the eventlog output format. Valid choices are *text* (the default)
370+
or *json*.
371+
372+
.. option:: -T, --time-format=FORMAT
373+
374+
Specify the timestamp format. Valid choices are *raw* (the default), *iso*,
375+
*offset*, and *human*.
376+
377+
.. option:: -H, --human
378+
379+
Display human-readable output. Equivalent to :option:`-T human -f text`.
380+
381+
.. option:: -L, --color[=WHEN]
382+
383+
Control color output. The optional argument *WHEN* can be one of *auto*,
384+
*never*, or *always*. If *WHEN* is omitted, it defaults to *always*.
385+
Otherwise the default is *auto*.
386+
367387
.. option:: -F, --follow
368388

369389
After printing the current eventlog, wait for new events and print

doc/test/spell.en.pws

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,3 +942,4 @@ SATTR
942942
myprogram
943943
unref
944944
sigprocmask
945+
iso

etc/completions/flux.pre

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ _flux_submit_commands()
523523
# flux-resource(1) completions
524524
_flux_resource()
525525
{
526-
local subcmds="drain undrain status list R info reload"
526+
local subcmds="drain undrain status list R info reload eventlog"
527527
local cmd=$1
528528
local split=false
529529
local states
@@ -570,15 +570,35 @@ _flux_resource()
570570
-q --queue= \
571571
-i --include= \
572572
"
573+
local eventlog_OPTS="\
574+
-h --help \
575+
-f --format= \
576+
-T --time-format=
577+
-L --color= \
578+
-F --follor \
579+
-w --wait-event= \
580+
"
581+
573582
_flux_split_longopt && split=true
574583
case $prev in
575584
--queue | -!(-*)q)
576585
_flux_complete_queue
577586
return
578587
;;
579-
--format | -!(-*)o)
580-
_flux_complete_format_name flux resource $cmd
581-
return
588+
--format | -!(-*)o | -!(-*)f)
589+
case $cmd in
590+
eventlog)
591+
COMPREPLY=( $(compgen -W "text json" -- "$cur") )
592+
return
593+
;;
594+
*)
595+
# Only eventlog takes -f as format
596+
if test "$prev" != "-f"; then
597+
_flux_complete_format_name flux resource $cmd
598+
return
599+
fi
600+
;;
601+
esac
582602
;;
583603
--states | -!(-*)s)
584604
case $cmd in

src/bindings/python/flux/Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ nobase_fluxpy_PYTHON = \
1111
memoized_property.py \
1212
debugged.py \
1313
importer.py \
14+
eventlog.py \
1415
conf_builtin.py \
1516
cli/__init__.py \
1617
cli/base.py \
@@ -59,6 +60,7 @@ nobase_fluxpy_PYTHON = \
5960
resource/ResourceSet.py \
6061
resource/list.py \
6162
resource/status.py \
63+
resource/journal.py \
6264
hostlist.py \
6365
idset.py \
6466
progress.py \
@@ -71,6 +73,8 @@ nobase_fluxpy_PYTHON = \
7173
constraint/parser.py \
7274
constraint/parsetab.py \
7375
constraint/__init__.py \
76+
abc/journal.py \
77+
abc/__init__.py \
7478
utils/parsedatetime/__init__.py \
7579
utils/parsedatetime/parsedatetime.py \
7680
utils/parsedatetime/warns.py \
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
###############################################################
2+
# Copyright 2025 Lawrence Livermore National Security, LLC
3+
# (c.f. AUTHORS, NOTICE.LLNS, COPYING)
4+
#
5+
# This file is part of the Flux resource manager framework.
6+
# For details, see https://github.com/flux-framework.
7+
#
8+
# SPDX-License-Identifier: LGPL-3.0
9+
###############################################################
10+
11+
from flux.abc.journal import JournalConsumerBase, JournalEventBase
12+
13+
__all__ = ["JournalConsumerBase", "JournalEventBase"]

0 commit comments

Comments
 (0)