Skip to content

Commit

Permalink
resource: support expiration update in resource.acquire
Browse files Browse the repository at this point in the history
Problem: RFC 28 defines an 'expiration' key in the resource.acquire
response payload, but the resource module currently does not send
this response after a resource expiration update.

Process resource-update events in the resource.eventlog and send
an expiration update response to resource.acquire when the expiration
has been updated.
  • Loading branch information
grondo committed Oct 31, 2023
1 parent ca81606 commit 18ccb29
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/modules/resource/acquire.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,29 @@ static void reslog_cb (struct reslog *reslog,
}
}
}
else if (streq (name, "resource-update")) {
double expiration = -1.;

/* Handle resource-update event. Currently the only supported
* context of such an event is an expiration update
*/
if (json_unpack (context,
"{s?F}",
"expiration", &expiration) < 0) {
errmsg = "error preparing resource.acquire update response";
goto error;
}
if (expiration >= 0.
&& flux_respond_pack (h,
msg,
"{s:f}",
"expiration", expiration) < 0) {
flux_log_error (h,
"error responding to resource.acquire (%s)",
name);
goto error;
}
}
else if (streq (name, "online")
|| streq (name, "offline")
|| streq (name, "drain")
Expand Down

0 comments on commit 18ccb29

Please sign in to comment.