diff --git a/resource/modules/resource_match.cpp b/resource/modules/resource_match.cpp index bb46847a7..2e0bb41ce 100644 --- a/resource/modules/resource_match.cpp +++ b/resource/modules/resource_match.cpp @@ -2209,8 +2209,6 @@ static void stat_request_cb (flux_t *h, flux_msg_handler_t *w, std::shared_ptr ctx = getctx ((flux_t *)arg); int saved_errno; json_t *o = nullptr; - json_t *match_succeeded = nullptr; - json_t *match_failed = nullptr; double mean = 0.0f; double min = 0.0f; double variance = 0.0f; @@ -2235,8 +2233,7 @@ static void stat_request_cb (flux_t *h, flux_msg_handler_t *w, variance_failed = ctx->perf.M2_failed / (double)ctx->perf.njobs_reset_failed; } - if ( !(o = json_object ()) || !(match_succeeded = json_object ()) - || !(match_failed = json_object ())) { + if ( !(o = json_object ())) { errno = ENOMEM; goto error; } @@ -2250,37 +2247,43 @@ static void stat_request_cb (flux_t *h, flux_msg_handler_t *w, time_since_reset_s = std::chrono::duration_cast ( now - ctx->perf.time_since_reset).count (); - if (!(match_succeeded = json_pack ("{s:I s:I s:f s:f s:f s:f}", - "njobs", ctx->perf.njobs, - "njobs-reset", ctx->perf.njobs_reset, - "min-match", min, - "max-match", ctx->perf.max, - "avg-match", mean, - "match-variance", variance))) { - errno = ENOMEM; - goto error; - } - if (!(match_failed = json_pack ("{s:I s:I s:f s:f s:f s:f}", - "njobs-failed", ctx->perf.njobs_failed, - "njobs-reset-failed", ctx->perf.njobs_reset_failed, - "min-match-failed", min_failed, - "max-match-failed", ctx->perf.max_failed, - "avg-match-failed", mean_failed, - "match-variance-failed", variance_failed))) { - errno = ENOMEM; - goto error; - } - - if (flux_respond_pack (h, msg, "{s:I s:I s:o s:f s:I s:I s:{s:o s:o}}", - "V", num_vertices (ctx->db->resource_graph), - "E", num_edges (ctx->db->resource_graph), - "by_rank", o, - "load-time", ctx->perf.load, - "graph-uptime", graph_uptime_s, - "time-since-reset", time_since_reset_s, - "match", - "succeeded", match_succeeded, - "failed", match_failed) < 0) { + if (flux_respond_pack (h, msg, "{s:I s:I s:o s:f s:I s:I" + "s:{" + "s:{" + "s:I s:I s:{" + "s:f s:f s:f s:f" + "}" + "}" + "s:{" + "s:I s:I s:{" + "s:f s:f s:f s:f" + "}" + "}" + "}" + "}", + "V", num_vertices (ctx->db->resource_graph), + "E", num_edges (ctx->db->resource_graph), + "by_rank", o, + "load-time", ctx->perf.load, + "graph-uptime", graph_uptime_s, + "time-since-reset", time_since_reset_s, + "match", + "succeeded", + "njobs", ctx->perf.njobs, + "njobs-reset", ctx->perf.njobs_reset, + "stats", + "min", min, + "max", ctx->perf.max, + "avg", mean, + "variance", variance, + "failed", + "njobs", ctx->perf.njobs_failed, + "njobs-reset", ctx->perf.njobs_reset_failed, + "stats", + "min", min_failed, + "max", ctx->perf.max_failed, + "avg", mean_failed, + "variance", variance_failed) < 0) { flux_log_error (h, "%s: flux_respond_pack", __FUNCTION__); }