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

Expose changing job priority via LUXI



A new LUXI request is added, in both Python and Haskell.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarBernardo Dal Seno <bdalseno@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 4679547e
......@@ -82,6 +82,8 @@ instance Arbitrary Luxi.LuxiOp where
Luxi.ReqAutoArchiveJobs -> Luxi.AutoArchiveJobs <$> arbitrary <*>
arbitrary
Luxi.ReqCancelJob -> Luxi.CancelJob <$> arbitrary
Luxi.ReqChangeJobPriority -> Luxi.ChangeJobPriority <$> arbitrary <*>
arbitrary
Luxi.ReqSetDrainFlag -> Luxi.SetDrainFlag <$> arbitrary
Luxi.ReqSetWatcherPause -> Luxi.SetWatcherPause <$> arbitrary
......
......@@ -163,6 +163,10 @@ $(genLuxiOp "LuxiOp"
, (luxiReqCancelJob,
[ simpleField "job" [t| Int |] ]
)
, (luxiReqChangeJobPriority,
[ simpleField "job" [t| Int |]
, simpleField "priority" [t| Int |] ]
)
, (luxiReqSetDrainFlag,
[ simpleField "flag" [t| Bool |] ]
)
......@@ -392,6 +396,10 @@ decodeCall (LuxiCall call args) =
[job] <- fromJVal args
rid <- parseJobId job
return $ CancelJob rid
ReqChangeJobPriority -> do
(job, priority) <- fromJVal args
rid <- parseJobId job
return $ ChangeJobPriority rid priority
ReqSetDrainFlag -> do
[flag] <- fromJVal args
return $ SetDrainFlag flag
......
......@@ -54,6 +54,7 @@ REQ_SUBMIT_MANY_JOBS = "SubmitManyJobs"
REQ_WAIT_FOR_JOB_CHANGE = "WaitForJobChange"
REQ_CANCEL_JOB = "CancelJob"
REQ_ARCHIVE_JOB = "ArchiveJob"
REQ_CHANGE_JOB_PRIORITY = "ChangeJobPriority"
REQ_AUTO_ARCHIVE_JOBS = "AutoArchiveJobs"
REQ_QUERY = "Query"
REQ_QUERY_FIELDS = "QueryFields"
......@@ -73,6 +74,7 @@ REQ_ALL = frozenset([
REQ_ARCHIVE_JOB,
REQ_AUTO_ARCHIVE_JOBS,
REQ_CANCEL_JOB,
REQ_CHANGE_JOB_PRIORITY,
REQ_QUERY,
REQ_QUERY_CLUSTER_INFO,
REQ_QUERY_CONFIG_VALUES,
......@@ -488,6 +490,9 @@ class Client(object):
def ArchiveJob(self, job_id):
return self.CallMethod(REQ_ARCHIVE_JOB, (job_id, ))
def ChangeJobPriority(self, job_id, priority):
return self.CallMethod(REQ_CHANGE_JOB_PRIORITY, (job_id, priority))
def AutoArchiveJobs(self, age):
timeout = (DEF_RWTO - 1) / 2
return self.CallMethod(REQ_AUTO_ARCHIVE_JOBS, (age, timeout))
......
......@@ -303,6 +303,12 @@ class ClientOps:
logging.info("Received job cancel request for %s", job_id)
return queue.CancelJob(job_id)
elif method == luxi.REQ_CHANGE_JOB_PRIORITY:
(job_id, priority) = args
logging.info("Received request to change priority for job %s to %s",
job_id, priority)
return queue.ChangeJobPriority(job_id, priority)
elif method == luxi.REQ_ARCHIVE_JOB:
(job_id, ) = args
logging.info("Received job archive request for %s", job_id)
......
......@@ -41,6 +41,7 @@ KNOWN_UNUSED_LUXI = frozenset([
luxi.REQ_SUBMIT_MANY_JOBS,
luxi.REQ_ARCHIVE_JOB,
luxi.REQ_AUTO_ARCHIVE_JOBS,
luxi.REQ_CHANGE_JOB_PRIORITY,
luxi.REQ_QUERY_EXPORTS,
luxi.REQ_QUERY_CONFIG_VALUES,
luxi.REQ_QUERY_TAGS,
......
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