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

Job queue: Allow more than one file rename per RPC call

Reviewed-by: ultrotter
parent d7fd1f28
......@@ -620,9 +620,8 @@ class NodeHttpServer(http.server.HttpServer):
"""Rename a job queue file.
(old, new) = params
return backend.JobQueueRename(old, new)
# TODO: What if a file fails to rename?
return [backend.JobQueueRename(old, new) for old, new in params]
def perspective_jobqueue_set_drain(params):
......@@ -713,13 +713,14 @@ class JobQueue(object):
@param rename: List containing tuples mapping old to new names
# Rename them locally
for old, new in rename:
utils.RenameFile(old, new, mkdir=True)
names, addrs = self._GetNodeIp()
result = rpc.RpcRunner.call_jobqueue_rename(names, addrs, old, new)
self._CheckRpcResult(result, self._nodes,
"Moving %s to %s" % (old, new))
# ... and on all nodes
names, addrs = self._GetNodeIp()
result = rpc.RpcRunner.call_jobqueue_rename(names, addrs, rename)
self._CheckRpcResult(result, self._nodes, "Renaming files (%r)" % rename)
def _FormatJobID(self, job_id):
"""Convert a job ID to string format.
......@@ -943,13 +943,13 @@ class RpcRunner(object):
return cls._StaticSingleNodeCall(node, "jobqueue_purge", [])
def call_jobqueue_rename(cls, node_list, address_list, old, new):
def call_jobqueue_rename(cls, node_list, address_list, rename):
"""Rename a job queue file.
This is a multi-node call.
return cls._StaticMultiNodeCall(node_list, "jobqueue_rename", [old, new],
return cls._StaticMultiNodeCall(node_list, "jobqueue_rename", rename,
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