Commit e9e07c9c authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Add “gnt-job change-priority” sub-command

This can be used to change the priority of a pending or running job (the
latter only if there are unprocessed opcodes).
Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarBernardo Dal Seno <>
parent f63ffb37
......@@ -245,6 +245,26 @@ def CancelJobs(opts, args, cl=None, _stdout_fn=ToStdout, _ask_fn=AskUser):
lambda cl, job_id: cl.CancelJob(job_id))
def ChangePriority(opts, args):
"""Change priority of jobs.
@param opts: Command line options
@type args: list
@param args: Job IDs
@rtype: int
@return: Exit code
if opts.priority is None:
ToStderr("--priority option must be given.")
return constants.EXIT_FAILURE
return _MultiJobAction(opts, args, None, None, None,
"Change priority of job(s) listed above?",
lambda cl, job_id:
cl.ChangeJobPriority(job_id, opts.priority))
def ShowJobs(opts, args):
"""Show detailed information about jobs.
......@@ -494,6 +514,12 @@ commands = {
"watch": (
WatchJob, [ArgJobId(min=1, max=1)], [],
"<job-id>", "Follows a job and prints its output as it arrives"),
"change-priority": (
ChangePriority, [ArgJobId()],
"--priority <priority> {[--force] {--pending | --queued | --waiting} |"
" <job-id> [<job-id> ...]}",
"Change the priority of jobs"),
......@@ -50,6 +50,18 @@ not yet started to run can be canceled; that is, jobs in either the
``--queued`` and ``waiting`` can be used to cancel all jobs in the
respective state, ``--pending`` includes both.
| **change-priority** --priority {low | normal | high}
| {[\--force] {\--pending | \--queued | \--waiting} | *job-id* ...}
Changes the priority of one or multiple pending jobs. Jobs currently
running have only the priority of remaining opcodes changed.
``--priority`` must be specified. ``--queued`` and ``waiting`` can be
used to re-prioritize all jobs in the respective state, ``--pending``
includes both. To skip a confirmation, pass ``--force``.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment