static int send_state_event (flux_t *h, job_state_t st, int64_t j) { flux_msg_t *msg; char *json = NULL; char *topic = NULL; int rc = -1; if (asprintf (&topic, "jsc.state.%s", jsc_job_num2state (st)) < 0) { errno = ENOMEM; flux_log_error (h, "create state change event: %s", jsc_job_num2state (st)); goto done; } if ((msg = flux_event_pack (topic, "{ s:I }", "lwj", j)) == NULL) { flux_log_error (h, "flux_event_pack"); goto done; } if (flux_send (h, msg, 0) < 0) flux_log_error (h, "flux_send event"); flux_msg_destroy (msg); rc = 0; done: free (topic); free (json); return rc; }
// Send out a call to all modules that the simulation is starting // and that they should join int send_start_event (flux_t *h) { int rc = 0; flux_msg_t *msg = NULL; uint32_t rank; if (flux_get_rank (h, &rank) < 0) return -1; if (!(msg = flux_event_pack ("sim.start", "{ s:s s:i s:i }", "mod_name", "sim", "rank", rank, "sim_time", 0)) || flux_send (h, msg, 0) < 0) { rc = -1; } flux_msg_destroy (msg); return rc; }