Skip to content

Commit

Permalink
libjsc: add jsc_query_rdesc_efficiently()
Browse files Browse the repository at this point in the history
Problem: JSON encode/decode of JSC rdesc objects proved
to be a significant bottleneck affecting scheduling
performance for high throughput workloads.

Add jsc_query_rdesc_efficiently() to allow nnodes, ncores,
ntasks, and walltime to be queries directly.

This was solved in a different way in current flux-sched
master, but this is needed as a temporary workaround until
older forks of flux-sched used with the Splash application
catch up with master per @trws.

Fixes #1455
  • Loading branch information
garlick committed Apr 13, 2018
1 parent 0139994 commit 5650070
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/common/libjsc/jstatctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,29 @@ static int query_rdesc (flux_t *h, int64_t j, json_object **jcb)
return 0;
}

int jsc_query_rdesc_efficiently (flux_t *h, int64_t jobid,
int64_t *nnodes, int64_t *ntasks,
int64_t *ncores, int64_t *walltime)
{
if (nnodes) {
if (extract_raw_nnodes (h, jobid, nnodes) < 0)
return -1;
}
if (ntasks) {
if (extract_raw_ntasks (h, jobid, ntasks) < 0)
return -1;
}
if (ncores) {
if (extract_raw_ncores (h, jobid, ncores) < 0)
return -1;
}
if (walltime) {
if (extract_raw_walltime (h, jobid, walltime) < 0)
return -1;
}
return 0;
}

static int query_rdl (flux_t *h, int64_t j, json_object **jcb)
{
char *rdlstr = NULL;
Expand Down
9 changes: 9 additions & 0 deletions src/common/libjsc/jstatctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@ int jsc_update_jcb (flux_t *h, int64_t jobid, const char *key, const char *jcb);
const char *jsc_job_num2state (job_state_t s);
int jsc_job_state2num (const char *s);

/**
* Accessor for nnodes, ntasks, ncores, walltime that circumvents
* JSON encode/decode. N.B. this is a workaround for performance issu
* encountered when scheduling high throughput workloads.
*/
int jsc_query_rdesc_efficiently (flux_t *h, int64_t jobid,
int64_t *nnodes, int64_t *ntasks,
int64_t *ncores, int64_t *walltime);

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit 5650070

Please sign in to comment.