diff --git a/NEWS b/NEWS index 99d605d2a37c2e2b1abd5cb395ac1e4fe02e4639..605cbfa034583995c8e49cec3298ad5a6c304121 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ documents those changes that are of interest to users and admins. * Changes in SLURM 0.7.0-pre5 ============================= -- Enhanced performance and debugging for slurmctld reconfiguration. + -- Add "scontrol update Jobid=# Nice=#" support. * Changes in SLURM 0.7.0-pre4 ============================= diff --git a/doc/man/man1/scontrol.1 b/doc/man/man1/scontrol.1 index d5bd0dbf93cf0bccaf5d6594c4a23dee9aa3498d..aaa579072b2f7d5fa92cc7c31d398ad75e6f44df 100644 --- a/doc/man/man1/scontrol.1 +++ b/doc/man/man1/scontrol.1 @@ -1,4 +1,4 @@ -.TH SCONTROL "1" "October 2005" "scontrol 0.7" "Slurm components" +.TH SCONTROL "1" "November 2005" "scontrol 0.7" "Slurm components" .SH "NAME" scontrol \- Used view and modify Slurm configuration and state. @@ -208,6 +208,9 @@ Set the job's partition to the specified value. \fIPriority\fP=<number> Set the job's priority to the specified value. .TP +\fINice\fP[=delta] +Adjust job's priority by the specified value. Default value is 100. +.TP \fIReqNodeList\fP=<nodes> Set the job's list of required node. Multiple node names may be specified using simple node range expressions (e.g. "lx[10-20]"). diff --git a/src/scontrol/scontrol.c b/src/scontrol/scontrol.c index 40468e9f12a09d325c1fce7faf359f47f56f13b5..562849fcf029f0326b57b7e980c06256f1441525 100644 --- a/src/scontrol/scontrol.c +++ b/src/scontrol/scontrol.c @@ -1388,6 +1388,22 @@ _update_job (int argc, char *argv[]) (char **) NULL, 10); update_cnt++; } + else if (strncasecmp(argv[i], "Nice=", 5) == 0) { + int nice; + nice = strtoll(&argv[i][5], (char **) NULL, 10); + if (abs(nice) > NICE_OFFSET) { + error("Invalid nice value, must be between " + "-%d and %d", NICE_OFFSET, NICE_OFFSET); + exit_code = 1; + return 0; + } + job_msg.nice = NICE_OFFSET + nice; + update_cnt++; + } + else if (strncasecmp(argv[i], "Nice", 4) == 0) { + job_msg.nice = NICE_OFFSET + 100; + update_cnt++; + } else if (strncasecmp(argv[i], "ReqProcs=", 9) == 0) { job_msg.num_procs = (uint32_t) strtol(&argv[i][9], diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index baf2aa5f62b16d71848aa1954780b470a910da7c..4b26de2f9880a029c742f3147855082565c6895d 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -3077,7 +3077,7 @@ int update_job(job_desc_msg_t * job_specs, uid_t uid) (job_ptr->priority > job_specs->priority)) { job_ptr->priority = job_specs->priority; info("update_job: setting priority to %u for " - "job_id %u", job_specs->priority, + "job_id %u", job_ptr->priority, job_specs->job_id); } else { error("Attempt to increase priority for job %u", @@ -3086,6 +3086,20 @@ int update_job(job_desc_msg_t * job_specs, uid_t uid) } } + if (job_specs->nice != NICE_OFFSET) { + if (super_user || (job_specs->nice < NICE_OFFSET)) { + job_ptr->priority -= ((int)job_specs->nice - + NICE_OFFSET); + info("update_job: setting priority to %u for " + "job_id %u", job_ptr->priority, + job_specs->job_id); + } else { + error("Attempt to increase priority for job %u", + job_specs->job_id); + error_code = ESLURM_ACCESS_DENIED; + } + } + if (job_specs->min_procs != NO_VAL && detail_ptr) { if (super_user || (detail_ptr->min_procs > job_specs->min_procs)) {