Skip to content

Commit

Permalink
Merge pull request #6614 from grondo/resource-journal-consumer
Browse files Browse the repository at this point in the history
add `ResourceJournalConsumer` and `EventLogFormatter` classes and use them to standardize `flux resource eventlog`
  • Loading branch information
mergify[bot] authored Feb 8, 2025
2 parents c205af7 + 90ef568 commit 779a41d
Show file tree
Hide file tree
Showing 16 changed files with 1,236 additions and 244 deletions.
22 changes: 21 additions & 1 deletion doc/man1/flux-resource.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SYNOPSIS
| **flux** **resource** **reload** [-f] [--xml] *path*
| **flux** **resource** **acquire-mute**
| **flux** **resource** **eventlog** [*-w* *EVENT*] [*-F*]
| **flux** **resource** **eventlog** [*-w* *EVENT*] [*-f* *FORMAT*] [*-T* *FORMAT*] [*-L* [*WHEN*]] [*-H*] [*-F*]
DESCRIPTION
===========
Expand Down Expand Up @@ -364,6 +364,26 @@ eventlog

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

.. option:: -f, --format=FORMAT

Specify the eventlog output format. Valid choices are *text* (the default)
or *json*.

.. option:: -T, --time-format=FORMAT

Specify the timestamp format. Valid choices are *raw* (the default), *iso*,
*offset*, and *human*.

.. option:: -H, --human

Display human-readable output. Equivalent to :option:`-T human -f text`.

.. option:: -L, --color[=WHEN]

Control color output. The optional argument *WHEN* can be one of *auto*,
*never*, or *always*. If *WHEN* is omitted, it defaults to *always*.
Otherwise the default is *auto*.

.. option:: -F, --follow

After printing the current eventlog, wait for new events and print
Expand Down
1 change: 1 addition & 0 deletions doc/test/spell.en.pws
Original file line number Diff line number Diff line change
Expand Up @@ -942,3 +942,4 @@ SATTR
myprogram
unref
sigprocmask
iso
28 changes: 24 additions & 4 deletions etc/completions/flux.pre
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ _flux_submit_commands()
# flux-resource(1) completions
_flux_resource()
{
local subcmds="drain undrain status list R info reload"
local subcmds="drain undrain status list R info reload eventlog"
local cmd=$1
local split=false
local states
Expand Down Expand Up @@ -570,15 +570,35 @@ _flux_resource()
-q --queue= \
-i --include= \
"
local eventlog_OPTS="\
-h --help \
-f --format= \
-T --time-format=
-L --color= \
-F --follor \
-w --wait-event= \
"

_flux_split_longopt && split=true
case $prev in
--queue | -!(-*)q)
_flux_complete_queue
return
;;
--format | -!(-*)o)
_flux_complete_format_name flux resource $cmd
return
--format | -!(-*)o | -!(-*)f)
case $cmd in
eventlog)
COMPREPLY=( $(compgen -W "text json" -- "$cur") )
return
;;
*)
# Only eventlog takes -f as format
if test "$prev" != "-f"; then
_flux_complete_format_name flux resource $cmd
return
fi
;;
esac
;;
--states | -!(-*)s)
case $cmd in
Expand Down
4 changes: 4 additions & 0 deletions src/bindings/python/flux/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ nobase_fluxpy_PYTHON = \
memoized_property.py \
debugged.py \
importer.py \
eventlog.py \
conf_builtin.py \
cli/__init__.py \
cli/base.py \
Expand Down Expand Up @@ -59,6 +60,7 @@ nobase_fluxpy_PYTHON = \
resource/ResourceSet.py \
resource/list.py \
resource/status.py \
resource/journal.py \
hostlist.py \
idset.py \
progress.py \
Expand All @@ -71,6 +73,8 @@ nobase_fluxpy_PYTHON = \
constraint/parser.py \
constraint/parsetab.py \
constraint/__init__.py \
abc/journal.py \
abc/__init__.py \
utils/parsedatetime/__init__.py \
utils/parsedatetime/parsedatetime.py \
utils/parsedatetime/warns.py \
Expand Down
13 changes: 13 additions & 0 deletions src/bindings/python/flux/abc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
###############################################################
# Copyright 2025 Lawrence Livermore National Security, LLC
# (c.f. AUTHORS, NOTICE.LLNS, COPYING)
#
# This file is part of the Flux resource manager framework.
# For details, see https://github.com/flux-framework.
#
# SPDX-License-Identifier: LGPL-3.0
###############################################################

from flux.abc.journal import JournalConsumerBase, JournalEventBase

__all__ = ["JournalConsumerBase", "JournalEventBase"]
Loading

0 comments on commit 779a41d

Please sign in to comment.