Skip to content

Commit

Permalink
Merge pull request #6635 from grondo/issue#6634
Browse files Browse the repository at this point in the history
Restore `flux resource eventlog -F, --follow` functionality
  • Loading branch information
mergify[bot] authored Feb 13, 2025
2 parents 9029a38 + 4f19a0d commit 04c71be
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/cmd/flux-resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,9 @@ def eventlog(args):
evf = EventLogFormatter(
format=args.format, timestamp_format=args.time_format, color=args.color
)
consumer = ResourceJournalConsumer(h, include_sentinel=True).start()
# The sentinel event is only used if we're not following the eventlog:
sentinel = not args.follow
consumer = ResourceJournalConsumer(h, include_sentinel=sentinel).start()
while True:
event = consumer.poll()
if event is None or event.is_empty():
Expand Down
11 changes: 8 additions & 3 deletions t/t2355-resource-journal.t
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,21 @@ test_expect_success 'that event WAS posted to the KVS' '
test $(grep resource-define kvs2 | wc -l) -eq 2
'
test_expect_success NO_CHAIN_LINT 'watch eventlog in the background waiting on drain' '
flux resource eventlog -F --wait=drain >bgeventlog &
echo $! >bgpid
flux resource eventlog -HF --wait=drain >bgeventlog &
echo $! >bgpid &&
# ensure RPC is established before moving on
waitfile.lua -vt 15 bgeventlog
'
test_expect_success NO_CHAIN_LINT 'drain rank 1' '
flux resource drain 1
'
test_expect_success NO_CHAIN_LINT 'background watcher completed successfully' '
wait $(cat bgpid)
'

test_expect_success NO_CHAIN_LINT 'background watcher waited for drain event' '
test_debug "cat bgeventlog" &&
tail -1 bgeventlog | grep drain
'
test_expect_success 'run restartable flux instance, drain 0' '
flux start --setattr=statedir=$(pwd) \
sh -c "flux resource eventlog --wait=resource-define \
Expand Down

0 comments on commit 04c71be

Please sign in to comment.