Skip to content

Commit b1f14fe

Browse files
garlickgrondo
authored andcommitted
sched-simple: parse full sched.free request
Problem: sched-simple doesn't parse the entire sched.free payload. Parse 'id' and 'final' and include them in LOG_DEBUG output. Update housekeeping test to expect "(final)" in partial release tests.
1 parent 06526bd commit b1f14fe

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

src/modules/sched-simple/sched.c

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,11 @@ static void check_cb (flux_reactor_t *r,
343343
}
344344
}
345345

346-
static int try_free (flux_t *h, struct simple_sched *ss, json_t *R)
346+
static int try_free (flux_t *h,
347+
struct simple_sched *ss,
348+
flux_jobid_t id,
349+
json_t *R,
350+
bool final)
347351
{
348352
int rc = -1;
349353
char *r = NULL;
@@ -358,8 +362,14 @@ static int try_free (flux_t *h, struct simple_sched *ss, json_t *R)
358362
r = rlist_dumps (alloc);
359363
if ((rc = rlist_free (ss->rlist, alloc)) < 0)
360364
flux_log_error (h, "free: %s", r);
361-
else
362-
flux_log (h, LOG_DEBUG, "free: %s", r);
365+
else {
366+
flux_log (h,
367+
LOG_DEBUG,
368+
"free: %s %s%s",
369+
r,
370+
idf58 (id),
371+
final ? " (final)" : "");
372+
}
363373
free (r);
364374
rlist_destroy (alloc);
365375
return rc;
@@ -369,13 +379,20 @@ void free_cb (flux_t *h, const flux_msg_t *msg, const char *R_str, void *arg)
369379
{
370380
struct simple_sched *ss = arg;
371381
json_t *R;
382+
flux_jobid_t id;
383+
int final = 0;
372384

373-
if (flux_request_unpack (msg, NULL, "{s:o}", "R", &R) < 0) {
385+
if (flux_request_unpack (msg,
386+
NULL,
387+
"{s:I s:o s?b}",
388+
"id", &id,
389+
"R", &R,
390+
"final", &final) < 0) {
374391
flux_log (h, LOG_ERR, "free: error unpacking sched.free request");
375392
return;
376393
}
377394

378-
if (try_free (h, ss, R) < 0) {
395+
if (try_free (h, ss, id, R, final) < 0) {
379396
flux_log_error (h, "free: could not free R");
380397
return;
381398
}

t/t2226-housekeeping.t

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ test_expect_success 'nodes were returned to scheduler separately' '
109109
grep "free: rank0" sched.log &&
110110
grep "free: rank1" sched.log &&
111111
grep "free: rank2" sched.log &&
112-
grep "free: rank3" sched.log
112+
grep "free: rank3" sched.log &&
113+
test $(grep final sched.log | wc -l) -eq 1
113114
'
114115
test_expect_success 'create housekeeping script with one 10s straggler' '
115116
cat >housekeeping2.sh <<-EOT &&
@@ -147,7 +148,7 @@ test_expect_success 'housekeeping script ran on ranks 0-3' '
147148
test_expect_success 'there was one alloc and two frees to the scheduler' '
148149
flux dmesg -H | grep sched-simple >sched2.log &&
149150
grep "free: rank\[0-2\]" sched2.log &&
150-
grep "free: rank3" sched2.log
151+
grep "free: rank3.*(final)" sched2.log
151152
'
152153
test_expect_success 'configuring housekeeping with bad key fails' '
153154
test_must_fail flux config load 2>load.err <<-EOT &&

0 commit comments

Comments
 (0)