Commit 59303563 authored by Iustin Pop's avatar Iustin Pop
Browse files

Restrict job propagation to master candidates only

This patch restricts the job propagation to master candidates only, by
not registering non-candidates in the job queue node lists.

Note that we do intentionally purge the job queue if a node is toggled
to non-master status.

Reviewed-by: imsnah
parent 6a5b8b4b
...@@ -522,7 +522,8 @@ class JobQueue(object): ...@@ -522,7 +522,8 @@ class JobQueue(object):
# Get initial list of nodes # Get initial list of nodes
self._nodes = dict((n.name, n.primary_ip) self._nodes = dict((n.name, n.primary_ip)
for n in self.context.cfg.GetAllNodesInfo().values()) for n in self.context.cfg.GetAllNodesInfo().values()
if n.master_candidate)
# Remove master node # Remove master node
try: try:
...@@ -596,6 +597,12 @@ class JobQueue(object): ...@@ -596,6 +597,12 @@ class JobQueue(object):
# Clean queue directory on added node # Clean queue directory on added node
rpc.RpcRunner.call_jobqueue_purge(node_name) rpc.RpcRunner.call_jobqueue_purge(node_name)
if not node.master_candidate:
# remove if existing, ignoring errors
self._nodes.pop(node_name, None)
# and skip the replication of the job ids
return
# Upload the whole queue excluding archived jobs # Upload the whole queue excluding archived jobs
files = [self._GetJobPath(job_id) for job_id in self._GetJobIDsUnlocked()] files = [self._GetJobPath(job_id) for job_id in self._GetJobIDsUnlocked()]
......
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