Skip to content

Commit 04c71be

Browse files
authored
Merge pull request #6635 from grondo/issue#6634
Restore `flux resource eventlog -F, --follow` functionality
2 parents 9029a38 + 4f19a0d commit 04c71be

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/cmd/flux-resource.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,9 @@ def eventlog(args):
734734
evf = EventLogFormatter(
735735
format=args.format, timestamp_format=args.time_format, color=args.color
736736
)
737-
consumer = ResourceJournalConsumer(h, include_sentinel=True).start()
737+
# The sentinel event is only used if we're not following the eventlog:
738+
sentinel = not args.follow
739+
consumer = ResourceJournalConsumer(h, include_sentinel=sentinel).start()
738740
while True:
739741
event = consumer.poll()
740742
if event is None or event.is_empty():

t/t2355-resource-journal.t

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,21 @@ test_expect_success 'that event WAS posted to the KVS' '
119119
test $(grep resource-define kvs2 | wc -l) -eq 2
120120
'
121121
test_expect_success NO_CHAIN_LINT 'watch eventlog in the background waiting on drain' '
122-
flux resource eventlog -F --wait=drain >bgeventlog &
123-
echo $! >bgpid
122+
flux resource eventlog -HF --wait=drain >bgeventlog &
123+
echo $! >bgpid &&
124+
# ensure RPC is established before moving on
125+
waitfile.lua -vt 15 bgeventlog
124126
'
125127
test_expect_success NO_CHAIN_LINT 'drain rank 1' '
126128
flux resource drain 1
127129
'
128130
test_expect_success NO_CHAIN_LINT 'background watcher completed successfully' '
129131
wait $(cat bgpid)
130132
'
131-
133+
test_expect_success NO_CHAIN_LINT 'background watcher waited for drain event' '
134+
test_debug "cat bgeventlog" &&
135+
tail -1 bgeventlog | grep drain
136+
'
132137
test_expect_success 'run restartable flux instance, drain 0' '
133138
flux start --setattr=statedir=$(pwd) \
134139
sh -c "flux resource eventlog --wait=resource-define \

0 commit comments

Comments
 (0)