Skip to content

Commit

Permalink
Merge pull request #6598 from garlick/issue#6596
Browse files Browse the repository at this point in the history
fix housekeeping reconfiguration problem
  • Loading branch information
mergify[bot] authored Feb 3, 2025
2 parents ea5af0e + b748f94 commit a50142e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/modules/job-manager/housekeeping.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ json_t *housekeeping_get_stats (struct housekeeping *hk)
json_t *running;
json_t *stats = NULL;
struct allocation *a;
char *command = NULL;

if (!(running = json_object ()))
goto nomem;
Expand All @@ -626,11 +627,19 @@ json_t *housekeeping_get_stats (struct housekeeping *hk)
}
a = zlistx_next (hk->allocations);
}
if (!(stats = json_pack ("{s:O}", "running", running)))
if (hk->cmd)
command = flux_cmd_stringify (hk->cmd);
if (!(stats = json_pack ("{s:O, s{s:f s:s}}",
"running", running,
"config",
"release-after", hk->release_after,
"command", command ? command : "")))
goto nomem;
free (command);
json_decref (running);
return stats;
nomem:
free (command);
json_decref (running);
errno = ENOMEM;
return NULL;
Expand Down Expand Up @@ -742,7 +751,8 @@ static int housekeeping_parse_config (const flux_conf_t *conf,
flux_error_t e;
json_error_t jerror;
json_t *cmdline = NULL;
const char *release_after = NULL;
const char *release_after_fsd = NULL;
double release_after = default_release_after;
flux_cmd_t *cmd = NULL;
const char *imp_path = NULL;
char *imp_path_cpy = NULL;
Expand All @@ -764,7 +774,7 @@ static int housekeeping_parse_config (const flux_conf_t *conf,
0,
"{s?o s?s s?b !}",
"command", &cmdline,
"release-after", &release_after,
"release-after", &release_after_fsd,
"use-systemd-unit", &use_systemd_unit) < 0)
return errprintf (error, "job-manager.housekeeping: %s", jerror.text);

Expand All @@ -778,8 +788,8 @@ static int housekeeping_parse_config (const flux_conf_t *conf,
// let job-exec handle exec errors
(void)flux_conf_unpack (conf, NULL, "{s?{s?s}}", "exec", "imp", &imp_path);

if (release_after) {
if (fsd_parse_duration (release_after, &hk->release_after) < 0)
if (release_after_fsd) {
if (fsd_parse_duration (release_after_fsd, &release_after) < 0)
return errprintf (error,
"job-manager.housekeeping.release-after"
" FSD parse error");
Expand Down Expand Up @@ -813,6 +823,7 @@ static int housekeeping_parse_config (const flux_conf_t *conf,
hk->cmd = cmd;
free (hk->imp_path);
hk->imp_path = imp_path_cpy;
hk->release_after = release_after;
flux_log (hk->ctx->h,
LOG_DEBUG,
"housekeeping is %sconfigured%s",
Expand Down
19 changes: 19 additions & 0 deletions t/t2226-housekeeping.t
Original file line number Diff line number Diff line change
Expand Up @@ -395,4 +395,23 @@ test_expect_success 'one node is allocated' '
test $(FLUX_RESOURCE_LIST_RPC=sched.resource-status \
flux resource list -s allocated -no {nnodes}) -eq 1
'
# issue #6596
test_expect_success 'release-after is 0 from last test' '
flux module stats job-manager | \
jq -e .housekeeping.config >config1.json &&
jq -e ".\"release-after\" == 0" config1.json
'
test_expect_success 'reconfigure housekeeping with default release-after' '
flux config load <<-EOT
[job-manager.housekeeping]
command = [ "true" ]
# NOTE: release-after was "0" before, now it should be unset
EOT
'
test_expect_success 'release-after is -1 after reconfig' '
flux module stats job-manager | \
jq -e .housekeeping.config >config2.json &&
jq -e ".\"release-after\" == -1" config2.json
'

test_done

0 comments on commit a50142e

Please sign in to comment.