diff --git a/NEWS b/NEWS index 4f4d764bb4bfb426299140e97a92049a7b556b02..17ffd68cc413f5fd1f70f3f9ed586579abd47185 100644 --- a/NEWS +++ b/NEWS @@ -208,6 +208,10 @@ documents those changes that are of interest to users and admins. the code) -- Added support for OSX build. +* Changes in SLURM 1.1.26 +========================= + - In sched/wiki2, fixes for support of job features. + * Changes in SLURM 1.1.25 ========================= - switch/elan: Fix for "Failed to initialise stats structure" from diff --git a/src/plugins/sched/wiki2/get_jobs.c b/src/plugins/sched/wiki2/get_jobs.c index bf966fcfd2163844b4033b03164005140f3aab0d..981ebb6c9a5cd2dfb47a1f2f9991f2f34cdfb80c 100644 --- a/src/plugins/sched/wiki2/get_jobs.c +++ b/src/plugins/sched/wiki2/get_jobs.c @@ -49,6 +49,7 @@ static char * _dump_all_jobs(int *job_cnt, int state_info); static char * _dump_job(struct job_record *job_ptr, int state_info); static char * _get_group_name(gid_t gid); static uint32_t _get_job_end_time(struct job_record *job_ptr); +static char * _get_job_features(struct job_record *job_ptr); static uint32_t _get_job_min_disk(struct job_record *job_ptr); static uint32_t _get_job_min_mem(struct job_record *job_ptr); static uint32_t _get_job_min_nodes(struct job_record *job_ptr); @@ -71,6 +72,8 @@ static uint32_t _get_job_time_limit(struct job_record *job_ptr); * Response format * ARG=<cnt>#<JOBID>; * STATE=<state>; Moab equivalent job state + * [RFEATURES=<features>;] required features, if any, + * NOTE: OR operator not supported * [HOSTLIST=<node1:node2>;] list of required nodes, if any * [STARTDATE=<uts>;] earliest start time, if any * [TASKLIST=<node1:node2>;] nodes in use, if running or completing @@ -91,8 +94,6 @@ static uint32_t _get_job_time_limit(struct job_record *job_ptr); * GNAME=<group_name>; group name * [#<JOBID>;...]; additional jobs, if any * - * NOTE: We don't report RFEATURES due to lack of support for "&" and "|" - * (logical AND and OR operators). */ /* RET 0 on success, -1 on failure */ extern int get_jobs(char *cmd_ptr, int *err_code, char **err_msg) @@ -205,6 +206,13 @@ static char * _dump_job(struct job_record *job_ptr, int state_info) /* SLURM_INFO_VOLITILE or SLURM_INFO_ALL */ if (job_ptr->job_state == JOB_PENDING) { + char *req_features = _get_job_features(job_ptr); + if (req_features) { + snprintf(tmp, sizeof(tmp), + "RFEATURES=%s;", req_features); + xstrcat(buf, tmp); + xfree(req_features); + } if ((job_ptr->details) && (job_ptr->details->req_nodes) && (job_ptr->details->req_nodes[0])) { @@ -406,6 +414,35 @@ static uint32_t _get_job_end_time(struct job_record *job_ptr) return (uint32_t) 0; } +/* Return a job's required features, if any joined with AND. + * If required features are joined by OR, then return NULL. + * Returned string must be xfreed. */ +static char * _get_job_features(struct job_record *job_ptr) +{ + int i; + char *rfeatures; + + if ((job_ptr->details == NULL) + || (job_ptr->details->features == NULL) + || (job_ptr->details->features[0] == '\0')) + return NULL; + + rfeatures = xstrdup(job_ptr->details->features); + /* Translate "&" to ":" */ + for (i=0; ; i++) { + if (rfeatures[i] == '\0') + return rfeatures; + if (rfeatures[i] == '|') + break; + if (rfeatures[i] == '&') + rfeatures[i] = ':'; + } + + /* Found '|' (OR), which is not supported by Moab */ + xfree(rfeatures); + return NULL; +} + /* returns how long job has been suspended, in seconds */ static uint32_t _get_job_suspend_time(struct job_record *job_ptr) { diff --git a/src/plugins/sched/wiki2/get_nodes.c b/src/plugins/sched/wiki2/get_nodes.c index 4c098430cf72191c46c17b3ab0c6593331749301..2ca823c99c1cc2514eb8b71ee8d60c05be8640f8 100644 --- a/src/plugins/sched/wiki2/get_nodes.c +++ b/src/plugins/sched/wiki2/get_nodes.c @@ -61,8 +61,8 @@ static char * _get_node_state(struct node_record *node_ptr); * CMEMORY=<MB>; MB of memory on node * CDISK=<MB>; MB of disk space on node * CPROCS=<cpus>; CPU count on node - * [FEATURES=<feature>;] features associated with node, if any, - * colon separate + * [FEATURE=<feature>;] features associated with node, if any, + * colon separator * [#<NODEID>:...]; */ extern int get_nodes(char *cmd_ptr, int *err_code, char **err_msg) @@ -211,12 +211,11 @@ static char * _dump_node(struct node_record *node_ptr, int state_info) if (node_ptr->config_ptr && node_ptr->config_ptr->feature) { - snprintf(tmp, sizeof(tmp), "FEATURES=%s;", + snprintf(tmp, sizeof(tmp), "FEATURE=%s;", node_ptr->config_ptr->feature); - /* comma separated to colon */ + /* comma separator to colon */ for (i=0; (tmp[i] != '\0'); i++) { - if ((tmp[i] == ',') - || (tmp[i] == '|')) + if (tmp[i] == ',') tmp[i] = ':'; } xstrcat(buf, tmp);