static int waitjob_cb (const char *jcbstr, void *arg, int errnum) { JSON jcb = NULL; int64_t os = 0, ns = 0, j = 0; flux_t h = (flux_t)arg; wjctx_t *ctx = getctx (h); if (errnum > 0) { flux_log (ctx->h, LOG_ERR, "waitjob_cb: errnum passed in"); return -1; } if (!(jcb = Jfromstr (jcbstr))) { flux_log (ctx->h, LOG_ERR, "waitjob_cb: error parsing JSON string"); return -1; } get_jobid (jcb, &j); get_states (jcb, &os, &ns); Jput (jcb); if ((j == ctx->jobid) && (ns == J_COMPLETE)) { if (ctx->complete) touch_outfile (ctx->complete); flux_log (ctx->h, LOG_INFO, "waitjob_cb: completion notified"); raise (SIGINT); } return 0; }
static int job_status_cb (const char *jcbstr, void *arg, int errnum) { int64_t os = 0; int64_t ns = 0; int64_t j = 0; jstatctx_t *ctx = NULL; flux_t h = (flux_t)arg; JSON jcb = NULL; ctx = getctx (h); if (errnum > 0) { flux_log (ctx->h, LOG_ERR, "job_status_cb: errnum passed in"); return -1; } if (!(jcb = Jfromstr (jcbstr))) { flux_log (ctx->h, LOG_ERR, "job_status_cb: error parsing JSON string"); return -1; } get_jobid (jcb, &j); get_states (jcb, &os, &ns); Jput (jcb); fprintf (ctx->op, "%s->%s\n", jsc_job_num2state ((job_state_t)os), jsc_job_num2state ((job_state_t)ns)); fflush (ctx->op); return 0; }