Commit 2f850610 authored by Paul Rich's avatar Paul Rich
Browse files

blocks with location set won't try to drain already draining blocks.

parent f06b3995
......@@ -1185,14 +1185,24 @@ class BGBaseSystem (Component):
def _find_drain_block(self, job, drain_blocks):
'''find a block to drain. If there is a specified location for a job,
drain only on that location, otherwise, choose the block where we want
the job to eventually run.
geometry = job.get('geometry', None)
# if the user requested a particular block, we only try to drain that one
if job['attrs'].has_key("location"):
#don't drain a dead block
if (job['attrs']['location'] not in self.offline_blocks and
set(job['attrs']['location']).isdisjoint(set([name for name
in drain_blocks]))):
target_name = job['attrs']['location']
return self.cached_blocks.get(target_name, None)
target_block = self.cached_blocks.get(target_name, None)
if target_block is not None:
if target_block.draining:
return None
return target_block
#return this drain location or not at all for this job
return None
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