Skip to content

Commit 22400f7

Browse files
committed
resource: handle expiration update in resource.acquire response
Problem: Fluxion currently does not support expiration updates as indicated by an expiration key in RFC 28 resource.acquire responses. Add support for the expiration key in the resource.acquire response and extend the graph duration using the new expiration as the graph_end.
1 parent 7d63065 commit 22400f7

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

resource/modules/resource_match.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,13 +1236,15 @@ static void update_resource (flux_future_t *f, void *arg)
12361236
int rc = -1;
12371237
const char *up = NULL;
12381238
const char *down = NULL;
1239+
double expiration = -1.;
12391240
json_t *resources = NULL;
12401241
std::shared_ptr<resource_ctx_t> ctx = getctx ((flux_t *)arg);
12411242

1242-
if ( (rc = flux_rpc_get_unpack (f, "{s?:o s?:s s?:s}",
1243+
if ( (rc = flux_rpc_get_unpack (f, "{s?:o s?:s s?:s s?:F}",
12431244
"resources", &resources,
12441245
"up", &up,
1245-
"down", &down)) < 0) {
1246+
"down", &down,
1247+
"expiration", &expiration)) < 0) {
12461248
flux_log_error (ctx->h, "%s: exiting due to resource.acquire failure",
12471249
__FUNCTION__);
12481250
flux_reactor_stop (flux_get_reactor (ctx->h));
@@ -1252,6 +1254,12 @@ static void update_resource (flux_future_t *f, void *arg)
12521254
flux_log_error (ctx->h, "%s: update_resource_db", __FUNCTION__);
12531255
goto done;
12541256
}
1257+
if (expiration >= 0.) {
1258+
/* Update graph duration:
1259+
*/
1260+
ctx->db->metadata.graph_duration.graph_end =
1261+
std::chrono::system_clock::from_time_t ((time_t) expiration);
1262+
}
12551263
for (auto &kv : ctx->notify_msgs) {
12561264
if ( (rc += flux_respond (ctx->h, kv.second->get_msg (), NULL)) < 0) {
12571265
flux_log_error (ctx->h, "%s: flux_respond", __FUNCTION__);

0 commit comments

Comments
 (0)