Skip to content

Commit

Permalink
wreck: use cached job object for run event
Browse files Browse the repository at this point in the history
Don't create a separate wreck_job object for run event handling,
instead pull the existing job from the active_jobs hash.
  • Loading branch information
grondo committed May 8, 2018
1 parent 1a9bf1b commit 0160716
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/modules/wreck/job.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ static void job_create_kvs_continuation (flux_future_t *f, void *arg)
flux_log_error (h, "%s: flux_respond", __FUNCTION__);
flux_future_destroy (f_next);
flux_future_destroy (f);
wreck_job_destroy (job);
}

/* Handle next available jobid response, then issue KVS commit request
Expand Down Expand Up @@ -749,7 +748,6 @@ static void runevent_fallback_continuation (flux_future_t *f, void *arg)
goto done;
done:
flux_future_destroy (f);
wreck_job_destroy (job);
}

/* Send request to look up rank.N.
Expand Down Expand Up @@ -803,16 +801,15 @@ static void runevent_continuation (flux_future_t *f, void *arg)
flux_log (h, LOG_INFO, "No %s: %s", key, flux_strerror (errno));
if (runevent_fallback (h, job) < 0) {
flux_log_error (h, "%s: fallback failed", __FUNCTION__);
goto done_destroy;
goto done;
}
goto done;
}
if (!Rlite_targets_this_node (h, key, R_lite))
goto done_destroy;
goto done;

if (spawn_exec_handler (h, job) < 0)
goto done_destroy;
done_destroy:
wreck_job_destroy (job);
goto done;
done:
flux_future_destroy (f);
}
Expand Down Expand Up @@ -841,20 +838,20 @@ static void runevent_cb (flux_t *h, flux_msg_handler_t *w,
const flux_msg_t *msg,
void *arg)
{
int64_t id;
const char *topic;
struct wreck_job *job;
flux_future_t *f = NULL;
char k[MAX_JOB_PATH];

if (!(job = wreck_job_create ()))
goto error;
if (flux_event_decode (msg, &topic, NULL) < 0)
goto error;
if ((job->id = id_from_tag (topic+11)) < 0) {
errno = EPROTO;
id = id_from_tag (topic+11);
if (!(job = wreck_job_lookup (id, active_jobs))) {
errno = ENOENT;
goto error;
}
if (!(job->kvs_path = id_to_path (job->id)))
if (!job->kvs_path)
goto error;
if (snprintf (k, sizeof (k), "%s.R_lite", job->kvs_path) >= sizeof (k)) {
errno = EINVAL;
Expand All @@ -868,7 +865,6 @@ static void runevent_cb (flux_t *h, flux_msg_handler_t *w,
return;
error:
flux_log_error (h, "%s", __FUNCTION__);
wreck_job_destroy (job);
flux_future_destroy (f);
}

Expand Down

0 comments on commit 0160716

Please sign in to comment.