Skip to content

Commit

Permalink
wreck: save rcalc object in wreck_job struct for future use
Browse files Browse the repository at this point in the history
  • Loading branch information
grondo committed May 5, 2018
1 parent c733f92 commit f6c71e6
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions src/modules/wreck/job.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,22 +776,6 @@ static int runevent_fallback (flux_t *h, struct wreck_job *job)
return 0;
}

static bool Rlite_targets_this_node (flux_t *h, const char *key,
const char *R_lite)
{
rcalc_t *r = NULL;
bool result;

if (!(r = rcalc_create (R_lite))) {
if (broker_rank == 0)
flux_log (h, LOG_ERR, "Unable to parse %s", key);
return false;
}
result = rcalc_has_rank (r, broker_rank);
rcalc_destroy (r);
return result;
}

/* Handle response to lookup of R_lite. If this node is targetted,
* spawn wrexecd. If R_lite doesn't exist, fallback to old method
* of looking up rank.N, with one more continuation.
Expand All @@ -802,6 +786,7 @@ static void runevent_continuation (flux_future_t *f, void *arg)
flux_t *h = flux_future_get_flux (f);
const char *key = flux_kvs_lookup_get_key (f);
const char *R_lite;
rcalc_t *r = NULL;

if (flux_kvs_lookup_get (f, &R_lite) < 0) {
if (broker_rank == 0)
Expand All @@ -812,8 +797,17 @@ static void runevent_continuation (flux_future_t *f, void *arg)
}
goto done;
}
if (!Rlite_targets_this_node (h, key, R_lite))
if (!(r = rcalc_create (R_lite))) {
flux_log (h, LOG_ERR, "Unable to parse %s", key);
goto done_destroy;
}
if (!rcalc_has_rank (r, broker_rank)) {
rcalc_destroy (r);
goto done_destroy;
}
if (wreck_job_set (job, "rcalc", r, (flux_free_f) rcalc_destroy) < 0)
flux_log_error (h, "wreck_job_set (rcalc)");

if (spawn_exec_handler (h, job) < 0)
goto done_destroy;
done_destroy:
Expand Down

0 comments on commit f6c71e6

Please sign in to comment.