From b04941c3213270c96dabd218eaccdd3036cf5ef0 Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Thu, 6 Jul 2023 13:08:09 -0700 Subject: [PATCH] job-manager: fix indent of multi-line pack/unpack Problem: some job-manager multi-line pack/unpack function calls are broken and indented inconsistently. Make them consistent with modern project norms. --- src/modules/job-manager/alloc.c | 92 +++++++++++-------- src/modules/job-manager/annotate.c | 10 +- src/modules/job-manager/event.c | 5 +- src/modules/job-manager/job-manager.c | 7 +- src/modules/job-manager/job.c | 19 ++-- src/modules/job-manager/jobtap.c | 36 +++++--- src/modules/job-manager/journal.c | 10 +- src/modules/job-manager/kill.c | 26 +++--- src/modules/job-manager/list.c | 21 ++--- src/modules/job-manager/plugins/begin-time.c | 2 +- .../job-manager/plugins/dependency-after.c | 6 +- .../job-manager/plugins/priority-default.c | 6 +- .../job-manager/plugins/validate-duration.c | 5 +- src/modules/job-manager/raise.c | 36 +++----- src/modules/job-manager/start.c | 71 +++++++++----- src/modules/job-manager/submit.c | 2 +- src/modules/job-manager/urgency.c | 16 ++-- src/modules/job-manager/wait.c | 15 +-- 18 files changed, 215 insertions(+), 170 deletions(-) diff --git a/src/modules/job-manager/alloc.c b/src/modules/job-manager/alloc.c index b635e650a614..f162499156e6 100644 --- a/src/modules/job-manager/alloc.c +++ b/src/modules/job-manager/alloc.c @@ -75,9 +75,12 @@ static void requeue_pending (struct alloc *alloc, struct job *job) } annotations_sched_clear (job, &cleared); if (cleared) { - if (event_job_post_pack (ctx->event, job, "annotations", + if (event_job_post_pack (ctx->event, + job, + "annotations", EVENT_NO_COMMIT, - "{s:n}", "annotations") < 0) + "{s:n}", + "annotations") < 0) flux_log_error (ctx->h, "%s: event_job_post_pack", __FUNCTION__); @@ -184,8 +187,7 @@ int cancel_request (struct alloc *alloc, struct job *job) FLUX_NODEID_ANY, FLUX_RPC_NORESPONSE, "{s:I}", - "id", - job->id))) { + "id", job->id))) { flux_log_error (h, "sending sched.cancel id=%s", idf58 (job->id)); return -1; } @@ -210,11 +212,12 @@ static void alloc_response_cb (flux_t *h, flux_msg_handler_t *mh, if (flux_response_decode (msg, NULL, NULL) < 0) goto teardown; // ENOSYS here if scheduler not loaded/shutting down - if (flux_msg_unpack (msg, "{s:I s:i s?s s?o}", - "id", &id, - "type", &type, - "note", ¬e, - "annotations", &annotations) < 0) + if (flux_msg_unpack (msg, + "{s:I s:i s?s s?o}", + "id", &id, + "type", &type, + "note", ¬e, + "annotations", &annotations) < 0) goto teardown; if (!(job = zhashx_lookup (ctx->active_jobs, &id))) { flux_log (h, LOG_ERR, "sched.alloc-response: id=%s not active", @@ -251,8 +254,11 @@ static void alloc_response_cb (flux_t *h, flux_msg_handler_t *mh, alloc->alloc_pending_count--; job->alloc_pending = 0; if (job->annotations) { - if (event_job_post_pack (ctx->event, job, "alloc", 0, - "{ s:O }", + if (event_job_post_pack (ctx->event, + job, + "alloc", + 0, + "{s:O}", "annotations", job->annotations) < 0) goto teardown; } @@ -279,9 +285,12 @@ static void alloc_response_cb (flux_t *h, flux_msg_handler_t *mh, } annotations_clear (job, &cleared); if (cleared) { - if (event_job_post_pack (ctx->event, job, "annotations", + if (event_job_post_pack (ctx->event, + job, + "annotations", EVENT_NO_COMMIT, - "{s:n}", "annotations") < 0) + "{s:n}", + "annotations") < 0) flux_log_error (ctx->h, "%s: event_job_post_pack: id=%s", __FUNCTION__, @@ -309,9 +318,12 @@ static void alloc_response_cb (flux_t *h, flux_msg_handler_t *mh, } job->alloc_pending = 0; if (cleared) { - if (event_job_post_pack (ctx->event, job, "annotations", + if (event_job_post_pack (ctx->event, + job, + "annotations", EVENT_NO_COMMIT, - "{s:n}", "annotations") < 0) + "{s:n}", + "annotations") < 0) flux_log_error (ctx->h, "%s: event_job_post_pack: id=%s", __FUNCTION__, @@ -345,12 +357,13 @@ int alloc_request (struct alloc *alloc, struct job *job) if (!(msg = flux_request_encode ("sched.alloc", NULL))) return -1; - if (flux_msg_pack (msg, "{s:I s:I s:I s:f s:O}", - "id", job->id, - "priority", (json_int_t)job->priority, - "userid", (json_int_t) job->userid, - "t_submit", job->t_submit, - "jobspec", job->jobspec_redacted) < 0) + if (flux_msg_pack (msg, + "{s:I s:I s:I s:f s:O}", + "id", job->id, + "priority", (json_int_t)job->priority, + "userid", (json_int_t) job->userid, + "t_submit", job->t_submit, + "jobspec", job->jobspec_redacted) < 0) goto error; if (flux_send (alloc->ctx->h, msg, 0) < 0) goto error; @@ -383,7 +396,8 @@ static void hello_cb (flux_t *h, flux_msg_handler_t *mh, job = zhashx_first (ctx->active_jobs); while (job) { if (job->has_resources) { - if (flux_respond_pack (h, msg, + if (flux_respond_pack (h, + msg, "{s:I s:I s:I s:f}", "id", job->id, "priority", job->priority, @@ -416,9 +430,11 @@ static void ready_cb (flux_t *h, flux_msg_handler_t *mh, struct job *job; const char *sender; - if (flux_request_unpack (msg, NULL, "{s:s s?i}", - "mode", &mode, - "limit", &limit) < 0) + if (flux_request_unpack (msg, + NULL, + "{s:s s?i}", + "mode", &mode, + "limit", &limit) < 0) goto error; if (streq (mode, "limited")) { if (limit <= 0) { @@ -541,8 +557,11 @@ static void check_cb (flux_reactor_t *r, flux_watcher_t *w, /* Post event for debugging if job was submitted FLUX_JOB_DEBUG flag. */ if ((job->flags & FLUX_JOB_DEBUG)) - (void)event_job_post_pack (ctx->event, job, - "debug.alloc-request", 0, NULL); + (void)event_job_post_pack (ctx->event, + job, + "debug.alloc-request", + 0, + NULL); } /* called from event_job_action() FLUX_JOB_STATE_CLEANUP */ @@ -554,8 +573,11 @@ int alloc_send_free_request (struct alloc *alloc, struct job *job) return -1; job->free_pending = 1; if ((job->flags & FLUX_JOB_DEBUG)) - (void)event_job_post_pack (alloc->ctx->event, job, - "debug.free-request", 0, NULL); + (void)event_job_post_pack (alloc->ctx->event, + job, + "debug.free-request", + 0, + NULL); alloc->free_pending_count++; } return 0; @@ -709,14 +731,10 @@ static void alloc_query_cb (flux_t *h, if (flux_respond_pack (h, msg, "{s:i s:i s:i s:i}", - "queue_length", - zlistx_size (alloc->queue), - "alloc_pending", - alloc->alloc_pending_count, - "free_pending", - alloc->free_pending_count, - "running", - alloc->ctx->running_jobs) < 0) + "queue_length", zlistx_size (alloc->queue), + "alloc_pending", alloc->alloc_pending_count, + "free_pending", alloc->free_pending_count, + "running", alloc->ctx->running_jobs) < 0) flux_log_error (h, "%s: flux_respond", __FUNCTION__); return; } diff --git a/src/modules/job-manager/annotate.c b/src/modules/job-manager/annotate.c index 3afaab764a05..d6fc74c10b99 100644 --- a/src/modules/job-manager/annotate.c +++ b/src/modules/job-manager/annotate.c @@ -142,10 +142,12 @@ void annotate_memo_request (flux_t *h, int no_commit = 0; json_t *tmp = NULL; - if (flux_request_unpack (msg, NULL, "{s:I s?b s:o}", - "id", &id, - "volatile", &no_commit, - "memo", &memo) < 0 + if (flux_request_unpack (msg, + NULL, + "{s:I s?b s:o}", + "id", &id, + "volatile", &no_commit, + "memo", &memo) < 0 || flux_msg_get_cred (msg, &cred) < 0) goto error; if (!(job = zhashx_lookup (ctx->active_jobs, &id))) { diff --git a/src/modules/job-manager/event.c b/src/modules/job-manager/event.c index 991ae95fde5e..e74c4fb98116 100644 --- a/src/modules/job-manager/event.c +++ b/src/modules/job-manager/event.c @@ -460,7 +460,8 @@ static int event_submit_context_decode (json_t *context, uint32_t *userid, int *flags) { - if (json_unpack (context, "{ s:i s:i s:i }", + if (json_unpack (context, + "{s:i s:i s:i}", "urgency", urgency, "userid", userid, "flags", flags) < 0) { @@ -499,7 +500,7 @@ static int event_exception_context_decode (json_t *context, const char *type; if (json_unpack (context, - "{ s:i s:s }", + "{s:i s:s}", "severity", severity, "type", &type) < 0) { errno = EPROTO; diff --git a/src/modules/job-manager/job-manager.c b/src/modules/job-manager/job-manager.c index 8439e22a8f4e..6f75cb8d31db 100644 --- a/src/modules/job-manager/job-manager.c +++ b/src/modules/job-manager/job-manager.c @@ -50,8 +50,7 @@ void getinfo_handle_request (flux_t *h, if (flux_respond_pack (h, msg, "{s:I}", - "max_jobid", - ctx->max_jobid) < 0) + "max_jobid", ctx->max_jobid) < 0) flux_log_error (h, "%s: flux_respond_pack", __FUNCTION__); return; error: @@ -77,7 +76,9 @@ static void stats_cb (flux_t *h, flux_msg_handler_t *mh, { struct job_manager *ctx = arg; int journal_listeners = journal_listeners_count (ctx->journal); - if (flux_respond_pack (h, msg, "{s:{s:i} s:i s:i s:I}", + if (flux_respond_pack (h, + msg, + "{s:{s:i} s:i s:i s:I}", "journal", "listeners", journal_listeners, "active_jobs", zhashx_size (ctx->active_jobs), diff --git a/src/modules/job-manager/job.c b/src/modules/job-manager/job.c index a853d79b12b7..d24199e040e2 100644 --- a/src/modules/job-manager/job.c +++ b/src/modules/job-manager/job.c @@ -163,8 +163,8 @@ static int jobspec_redacted_parse_queue (struct job *job) if (json_unpack (job->jobspec_redacted, "{s?{s?{s?s}}}", "attributes", - "system", - "queue", &job->queue) < 0) { + "system", + "queue", &job->queue) < 0) { errno = EINVAL; return -1; } @@ -266,13 +266,14 @@ struct job *job_create_from_json (json_t *o) if (!(job = job_create ())) return NULL; - if (json_unpack (o, "{s:I s:i s:i s:f s:i s:O}", - "id", &job->id, - "urgency", &job->urgency, - "userid", &job->userid, - "t_submit", &job->t_submit, - "flags", &job->flags, - "jobspec", &job->jobspec_redacted) < 0) { + if (json_unpack (o, + "{s:I s:i s:i s:f s:i s:O}", + "id", &job->id, + "urgency", &job->urgency, + "userid", &job->userid, + "t_submit", &job->t_submit, + "flags", &job->flags, + "jobspec", &job->jobspec_redacted) < 0) { errno = EPROTO; job_decref (job); return NULL; diff --git a/src/modules/job-manager/jobtap.c b/src/modules/job-manager/jobtap.c index 1bed7e831fb5..317ddaeba40a 100644 --- a/src/modules/job-manager/jobtap.c +++ b/src/modules/job-manager/jobtap.c @@ -376,7 +376,9 @@ static int jobtap_conf_entry (struct jobtap *jobtap, const char *remove = NULL; json_t *conf = NULL; - if (json_unpack_ex (entry, &json_err, 0, + if (json_unpack_ex (entry, + &json_err, + 0, "{s?s s?o s?s}", "load", &load, "conf", &conf, @@ -674,7 +676,8 @@ int jobtap_get_priority (struct jobtap *jobtap, /* * A priority.get callback was run. Try to unpack a new priority */ - if (flux_plugin_arg_unpack (args, FLUX_PLUGIN_ARG_OUT, + if (flux_plugin_arg_unpack (args, + FLUX_PLUGIN_ARG_OUT, "{s?I}", "priority", &priority) < 0) { flux_log (jobtap->ctx->h, LOG_ERR, @@ -763,7 +766,8 @@ static int jobtap_call_early (struct jobtap *jobtap, * If plugin did not provide an error message, then construct * a generic error "rejected by plugin". */ - if (flux_plugin_arg_unpack (args, FLUX_PLUGIN_ARG_OUT, + if (flux_plugin_arg_unpack (args, + FLUX_PLUGIN_ARG_OUT, "{s:s}", "errmsg", &errmsg) < 0) errmsg = "rejected by job-manager plugin"; @@ -874,7 +878,8 @@ static int jobtap_check_dependency (struct jobtap *jobtap, * a generic error "rejected by plugin". */ const char *errmsg; - if (flux_plugin_arg_unpack (args, FLUX_PLUGIN_ARG_OUT, + if (flux_plugin_arg_unpack (args, + FLUX_PLUGIN_ARG_OUT, "{s:s}", "errmsg", &errmsg) < 0) { errmsg = "rejected by job-manager dependency plugin"; @@ -892,11 +897,13 @@ static int dependencies_unpack (struct jobtap * jobtap, json_t *dependencies = NULL; json_error_t error; - if (json_unpack_ex (job->jobspec_redacted, &error, 0, + if (json_unpack_ex (job->jobspec_redacted, + &error, + 0, "{s:{s?{s?o}}}", "attributes", - "system", - "dependencies", &dependencies) < 0) { + "system", + "dependencies", &dependencies) < 0) { error_asprintf (jobtap, job, errp, "unable to unpack dependencies: %s", error.text); @@ -1041,7 +1048,8 @@ int jobtap_call (struct jobtap *jobtap, "jobtap: %s: callback returned error", topic); } - if (flux_plugin_arg_unpack (args, FLUX_PLUGIN_ARG_OUT, + if (flux_plugin_arg_unpack (args, + FLUX_PLUGIN_ARG_OUT, "{s?I s?o}", "priority", &priority, "annotations", ¬e) < 0) { @@ -1387,8 +1395,9 @@ static void jobtap_handle_list_req (flux_t *h, json_t *o = jobtap_plugin_list (jobtap); if (o == NULL) flux_respond_error (h, msg, ENOMEM, "Failed to create plugin list"); - else if (flux_respond_pack (h, msg, - "{ s:o }", + else if (flux_respond_pack (h, + msg, + "{s:o}", "plugins", o) < 0) flux_log_error (h, "jobtap_handle_list: flux_respond"); } @@ -1918,8 +1927,7 @@ int flux_jobtap_job_set_flag (flux_plugin_t *p, "set-flags", 0, "{s:[s]}", - "flags", - flag); + "flags", flag); } static int jobtap_job_vraise (struct jobtap *jobtap, @@ -2020,7 +2028,9 @@ int flux_jobtap_get_job_result (flux_plugin_t *p, errno = EINVAL; return -1; } - if (json_unpack_ex (job->end_event, &error, 0, + if (json_unpack_ex (job->end_event, + &error, + 0, "{s:s s:{s?i s?s s?i}}", "name", &name, "context", diff --git a/src/modules/job-manager/journal.c b/src/modules/job-manager/journal.c index 49f330d24a97..c25ac0f67b5e 100644 --- a/src/modules/job-manager/journal.c +++ b/src/modules/job-manager/journal.c @@ -107,8 +107,10 @@ int journal_process_event (struct journal *journal, msg = flux_msglist_first (journal->listeners); while (msg) { if (allow_deny_check (msg, name)) { - if (flux_respond_pack (journal->ctx->h, msg, - "{s:[O]}", "events", wrapped_entry) < 0) + if (flux_respond_pack (journal->ctx->h, + msg, + "{s:[O]}", + "events", wrapped_entry) < 0) flux_log_error (journal->ctx->h, "%s: flux_respond_pack", __FUNCTION__); } @@ -153,7 +155,9 @@ static void journal_handle_request (flux_t *h, if (!(filter = calloc (1, sizeof (*filter)))) goto error; - if (flux_request_unpack (msg, NULL, "{s?o s?o}", + if (flux_request_unpack (msg, + NULL, + "{s?o s?o}", "allow", &filter->allow, "deny", &filter->deny) < 0 || flux_msg_aux_set (msg, "filter", filter, diff --git a/src/modules/job-manager/kill.c b/src/modules/job-manager/kill.c index ad6ea8df12b5..513c4f7846a4 100644 --- a/src/modules/job-manager/kill.c +++ b/src/modules/job-manager/kill.c @@ -74,9 +74,11 @@ void kill_handle_request (flux_t *h, char topic [64]; const char *errstr = NULL; - if (flux_request_unpack (msg, NULL, "{s:I s:i}", - "id", &id, - "signum", &sig) < 0) + if (flux_request_unpack (msg, + NULL, + "{s:I s:i}", + "id", &id, + "signum", &sig) < 0) goto error; if (kill_check_signal (sig) < 0) { errstr = "Invalid signal number"; @@ -137,12 +139,9 @@ void killall_handle_request (flux_t *h, if (flux_request_unpack (msg, NULL, "{s:b s:i s:i}", - "dry_run", - &dry_run, - "userid", - &userid, - "signum", - &signum) < 0) { + "dry_run", &dry_run, + "userid", &userid, + "signum", &signum) < 0) { errstr = "error decoding request"; goto error; } @@ -174,8 +173,7 @@ void killall_handle_request (flux_t *h, topic, 0, "{s:i}", - "signum", - signum))) { + "signum", signum))) { error_count++; goto next; } @@ -187,10 +185,8 @@ void killall_handle_request (flux_t *h, if (flux_respond_pack (h, msg, "{s:i s:i}", - "count", - count, - "errors", - error_count) < 0) + "count", count, + "errors", error_count) < 0) flux_log_error (h, "%s: flux_respond", __FUNCTION__); return; error: diff --git a/src/modules/job-manager/list.c b/src/modules/job-manager/list.c index 3fa30c619b6d..0288f8847169 100644 --- a/src/modules/job-manager/list.c +++ b/src/modules/job-manager/list.c @@ -43,18 +43,12 @@ int list_append_job (json_t *jobs, struct job *job) /* We pack priority with I instead of i to avoid issue of * signed vs unsigned int */ if (!(o = json_pack ("{s:I s:I s:i s:I s:f s:i}", - "id", - job->id, - "userid", - (json_int_t) job->userid, - "urgency", - job->urgency, - "priority", - job->priority, - "t_submit", - job->t_submit, - "state", - job->state))) { + "id", job->id, + "userid", (json_int_t) job->userid, + "urgency", job->urgency, + "priority", job->priority, + "t_submit", job->t_submit, + "state", job->state))) { errno = ENOMEM; return -1; } @@ -94,8 +88,7 @@ void list_handle_request (flux_t *h, if (flux_request_unpack (msg, NULL, "{s:i}", - "max_entries", - &max_entries) < 0) + "max_entries", &max_entries) < 0) goto error; if (max_entries < 0) { errno = EPROTO; diff --git a/src/modules/job-manager/plugins/begin-time.c b/src/modules/job-manager/plugins/begin-time.c index ee7eb76237f8..6a2fe7ea3463 100644 --- a/src/modules/job-manager/plugins/begin-time.c +++ b/src/modules/job-manager/plugins/begin-time.c @@ -161,7 +161,7 @@ static int depend_cb (flux_plugin_t *p, "{s:I s:{s:s}}", "id", &id, "dependency", - "value", &s) < 0) + "value", &s) < 0) return flux_jobtap_reject_job (p, args, "error processing begin-time: %s", diff --git a/src/modules/job-manager/plugins/dependency-after.c b/src/modules/job-manager/plugins/dependency-after.c index 29e354318788..ce47d71c2f10 100644 --- a/src/modules/job-manager/plugins/dependency-after.c +++ b/src/modules/job-manager/plugins/dependency-after.c @@ -221,7 +221,8 @@ static int lookup_job_uid_state (flux_plugin_t *p, int rc = 0; flux_plugin_arg_t *args = flux_jobtap_job_lookup (p, id); if (!args - || flux_plugin_arg_unpack (args, FLUX_PLUGIN_ARG_IN, + || flux_plugin_arg_unpack (args, + FLUX_PLUGIN_ARG_IN, "{s:i s:i}", "userid", puid, "state", pstate) < 0) @@ -673,8 +674,7 @@ static int query_cb (flux_plugin_t *p, if (flux_plugin_arg_pack (args, FLUX_PLUGIN_ARG_OUT, "{s:O}", - "dependencies", - o) < 0) + "dependencies", o) < 0) flux_log_error (flux_jobtap_get_flux (p), "dependency-after: query_cb: flux_plugin_arg_pack: %s", flux_plugin_arg_strerror (args)); diff --git a/src/modules/job-manager/plugins/priority-default.c b/src/modules/job-manager/plugins/priority-default.c index d860e6f481a3..8b8347f310ba 100644 --- a/src/modules/job-manager/plugins/priority-default.c +++ b/src/modules/job-manager/plugins/priority-default.c @@ -30,7 +30,8 @@ static int priority_cb (flux_plugin_t *p, { int urgency = -1; flux_t *h = flux_jobtap_get_flux (p); - if (flux_plugin_arg_unpack (args, FLUX_PLUGIN_ARG_IN, + if (flux_plugin_arg_unpack (args, + FLUX_PLUGIN_ARG_IN, "{s:i}", "urgency", &urgency) < 0) { flux_log (h, LOG_ERR, @@ -38,7 +39,8 @@ static int priority_cb (flux_plugin_t *p, flux_plugin_arg_strerror (args)); return -1; } - if (flux_plugin_arg_pack (args, FLUX_PLUGIN_ARG_OUT, + if (flux_plugin_arg_pack (args, + FLUX_PLUGIN_ARG_OUT, "{s:i}", "priority", urgency) < 0) { flux_log (h, LOG_ERR, diff --git a/src/modules/job-manager/plugins/validate-duration.c b/src/modules/job-manager/plugins/validate-duration.c index 69ec40f257e7..8e75dd717aa1 100644 --- a/src/modules/job-manager/plugins/validate-duration.c +++ b/src/modules/job-manager/plugins/validate-duration.c @@ -60,7 +60,8 @@ static int validate_duration (flux_plugin_t *p, { double duration = -1.; - if (flux_plugin_arg_unpack (args, FLUX_PLUGIN_ARG_IN, + if (flux_plugin_arg_unpack (args, + FLUX_PLUGIN_ARG_IN, "{s:{s:{s?{s?F}}}}", "jobspec", "attributes", @@ -80,7 +81,7 @@ static void kvs_lookup_cb (flux_future_t *f, void *arg) if (flux_kvs_lookup_get_unpack (f, "{s:{s:F}}", "execution", - "expiration", &expiration) < 0) { + "expiration", &expiration) < 0) { flux_log_error (h, "flux_kvs_lookup_unpack"); } flux_future_reset (f); diff --git a/src/modules/job-manager/raise.c b/src/modules/job-manager/raise.c index 921b6c3d0524..3eee3ed55ebf 100644 --- a/src/modules/job-manager/raise.c +++ b/src/modules/job-manager/raise.c @@ -136,11 +136,13 @@ void raise_handle_request (flux_t *h, const char *note = NULL; const char *errstr = NULL; - if (flux_request_unpack (msg, NULL, "{s:I s:i s:s s?s}", - "id", &id, - "severity", &severity, - "type", &type, - "note", ¬e) < 0 + if (flux_request_unpack (msg, + NULL, + "{s:I s:i s:s s?s}", + "id", &id, + "severity", &severity, + "type", &type, + "note", ¬e) < 0 || flux_msg_get_cred (msg, &cred) < 0) goto error; if (raise_check_severity (severity)) { @@ -238,18 +240,12 @@ void raiseall_handle_request (flux_t *h, if (flux_request_unpack (msg, NULL, "{s:b s:i s:i s:i s:s s?s}", - "dry_run", - &dry_run, - "userid", - &userid, - "states", - &state_mask, - "severity", - &severity, - "type", - &type, - "note", - ¬e) < 0) + "dry_run", &dry_run, + "userid", &userid, + "states", &state_mask, + "severity", &severity, + "type", &type, + "note", ¬e) < 0) goto error; if (flux_msg_get_cred (msg, &cred) < 0) goto error; @@ -292,10 +288,8 @@ void raiseall_handle_request (flux_t *h, if (flux_respond_pack (h, msg, "{s:i s:i}", - "count", - zlistx_size (target_jobs), - "errors", - error_count) < 0) + "count", zlistx_size (target_jobs), + "errors", error_count) < 0) flux_log_error (h, "%s: flux_respond", __FUNCTION__); zlistx_destroy (&target_jobs); return; diff --git a/src/modules/job-manager/start.c b/src/modules/job-manager/start.c index bfb7b81c5b6c..22b148b7d71b 100644 --- a/src/modules/job-manager/start.c +++ b/src/modules/job-manager/start.c @@ -164,9 +164,12 @@ static void interface_teardown (struct start *start, char *s, int errnum) while (job) { if (job->start_pending) { if ((job->flags & FLUX_JOB_DEBUG)) - (void)event_job_post_pack (ctx->event, job, - "debug.start-lost", 0, - "{ s:s }", "note", s); + (void)event_job_post_pack (ctx->event, + job, + "debug.start-lost", + 0, + "{s:s}", + "note", s); job->start_pending = 0; } job = zhashx_next (ctx->active_jobs); @@ -191,9 +194,11 @@ static void start_response_cb (flux_t *h, flux_msg_handler_t *mh, flux_log_error (h, "start: topic=%s not registered", topic); goto error; } - if (flux_msg_unpack (msg, "{s:I s:s s:o}", "id", &id, - "type", &type, - "data", &data) < 0) { + if (flux_msg_unpack (msg, + "{s:I s:s s:o}", + "id", &id, + "type", &type, + "data", &data) < 0) { flux_log_error (h, "start response payload"); goto error; } @@ -227,16 +232,21 @@ static void start_response_cb (flux_t *h, flux_msg_handler_t *mh, else if (streq (type, "release")) { const char *idset; int final; - if (json_unpack (data, "{s:s s:b}", "ranks", &idset, - "final", &final) < 0) { + if (json_unpack (data, + "{s:s s:b}", + "ranks", &idset, + "final", &final) < 0) { errno = EPROTO; flux_log_error (h, "start: release response: malformed data"); goto error; } if (final) // final release is end-of-stream job->start_pending = 0; - if (event_job_post_pack (ctx->event, job, "release", 0, - "{ s:s s:b }", + if (event_job_post_pack (ctx->event, + job, + "release", + 0, + "{s:s s:b}", "ranks", idset, "final", final) < 0) goto error_post; @@ -245,15 +255,20 @@ static void start_response_cb (flux_t *h, flux_msg_handler_t *mh, int xseverity; const char *xtype; const char *xnote = NULL; - if (json_unpack (data, "{s:i s:s s?s}", "severity", &xseverity, - "type", &xtype, - "note", &xnote) < 0) { + if (json_unpack (data, + "{s:i s:s s?s}", + "severity", &xseverity, + "type", &xtype, + "note", &xnote) < 0) { errno = EPROTO; flux_log_error (h, "start: exception response: malformed data"); goto error; } - if (event_job_post_pack (ctx->event, job, "exception", 0, - "{ s:s s:i s:I s:s }", + if (event_job_post_pack (ctx->event, + job, + "exception", + 0, + "{s:s s:i s:I s:s}", "type", xtype, "severity", xseverity, "userid", (json_int_t) FLUX_USERID_UNKNOWN, @@ -267,8 +282,12 @@ static void start_response_cb (flux_t *h, flux_msg_handler_t *mh, flux_log_error (h, "start: finish response: malformed data"); goto error; } - if (event_job_post_pack (ctx->event, job, "finish", 0, - "{ s:i }", "status", status) < 0) + if (event_job_post_pack (ctx->event, + job, + "finish", + 0, + "{s:i}", + "status", status) < 0) goto error_post; } else { @@ -296,19 +315,23 @@ int start_send_request (struct start *start, struct job *job) if (!job->start_pending && start->topic != NULL) { if (!(msg = flux_request_encode (start->topic, NULL))) return -1; - if (flux_msg_pack (msg, "{s:I s:i s:O s:b}", - "id", job->id, - "userid", (json_int_t) job->userid, - "jobspec", job->jobspec_redacted, - "reattach", job->reattach) < 0) + if (flux_msg_pack (msg, + "{s:I s:i s:O s:b}", + "id", job->id, + "userid", (json_int_t) job->userid, + "jobspec", job->jobspec_redacted, + "reattach", job->reattach) < 0) goto error; if (flux_send (ctx->h, msg, 0) < 0) goto error; flux_msg_destroy (msg); job->start_pending = 1; if ((job->flags & FLUX_JOB_DEBUG)) - (void)event_job_post_pack (ctx->event, job, - "debug.start-request", 0, NULL); + (void)event_job_post_pack (ctx->event, + job, + "debug.start-request", + 0, + NULL); } return 0; error: diff --git a/src/modules/job-manager/submit.c b/src/modules/job-manager/submit.c index 4bba018c66b0..475816eb5816 100644 --- a/src/modules/job-manager/submit.c +++ b/src/modules/job-manager/submit.c @@ -44,7 +44,7 @@ static int submit_post_event (struct job_manager *ctx, struct job *job) entry = eventlog_entry_pack (job->t_submit, "submit", - "{ s:I s:i s:i s:i }", + "{s:I s:i s:i s:i}", "userid", (json_int_t) job->userid, "urgency", job->urgency, "flags", job->flags, diff --git a/src/modules/job-manager/urgency.c b/src/modules/job-manager/urgency.c index af97bf6a0afc..dc36b034edfc 100644 --- a/src/modules/job-manager/urgency.c +++ b/src/modules/job-manager/urgency.c @@ -51,9 +51,11 @@ void urgency_handle_request (flux_t *h, int urgency, orig_urgency; const char *errstr = NULL; - if (flux_request_unpack (msg, NULL, "{s:I s:i}", - "id", &id, - "urgency", &urgency) < 0 + if (flux_request_unpack (msg, + NULL, + "{s:I s:i}", + "id", &id, + "urgency", &urgency) < 0 || flux_msg_get_cred (msg, &cred) < 0) goto error; if (urgency < FLUX_JOB_URGENCY_MIN @@ -94,9 +96,11 @@ void urgency_handle_request (flux_t *h, * was a priority change. */ orig_urgency = job->urgency; - if (event_job_post_pack (ctx->event, job, - "urgency", 0, - "{ s:I s:i }", + if (event_job_post_pack (ctx->event, + job, + "urgency", + 0, + "{s:I s:i}", "userid", (json_int_t) cred.userid, "urgency", urgency) < 0) goto error; diff --git a/src/modules/job-manager/wait.c b/src/modules/job-manager/wait.c index 4877566f8bf3..e1b969346aa0 100644 --- a/src/modules/job-manager/wait.c +++ b/src/modules/job-manager/wait.c @@ -93,10 +93,8 @@ static int decode_job_result (struct job *job, if (json_unpack (context, "{s:s s?s}", - "type", - &type, - "note", - ¬e) < 0) + "type", &type, + "note", ¬e) < 0) return -1; errprintf (errp, "Fatal exception type=%s %s", @@ -156,12 +154,9 @@ static void wait_respond (struct waitjob *wait, if (flux_respond_pack (h, msg, "{s:I s:b s:s}", - "id", - job->id, - "success", - success ? 1 : 0, - "errstr", - error.text) < 0) + "id", job->id, + "success", success ? 1 : 0, + "errstr", error.text) < 0) flux_log_error (h, "wait_respond id=%s", idf58 (job->id)); return; error: