Merge pull request #268 from pigmej/pigmej-patch-12

set target in orch to location_id if not given
This commit is contained in:
Łukasz Oleś 2015-10-21 12:07:15 +02:00
commit 43e8fa274f
2 changed files with 21 additions and 1 deletions

View File

@ -96,8 +96,18 @@ class React(Event):
if self.parent_node in changes_graph:
if self.child_node not in changes_graph:
# TODO: solve this circular import problem
from solar.core import resource
try:
loaded_resource = resource.load(self.parent)
except KeyError:
# orm throws this error when we're NOT using resource there
location_id = None
else:
location_id = loaded_resource.args['location_id']
changes_graph.add_node(
self.child_node, status='PENDING',
target=location_id,
errmsg=None, type='solar_resource',
args=[self.child, self.child_action])
@ -112,7 +122,17 @@ class StateChange(Event):
def insert(self, changed_resources, changes_graph):
changed_resources.append(self.parent)
# TODO: solve this circular import problem
from solar.core import resource
try:
loaded_resource = resource.load(self.parent)
except KeyError:
# orm throws this error when we're NOT using resource there
location_id = None
else:
location_id = loaded_resource.args['location_id']
changes_graph.add_node(
self.parent_node, status='PENDING',
target=location_id,
errmsg=None, type='solar_resource',
args=[self.parent, self.parent_action])

View File

@ -72,5 +72,5 @@ def target_based_rule(dg, inprogress, item, limit=1):
return limit > target_count
def items_rule(dg, inprogress, item, limit=1):
def items_rule(dg, inprogress, item, limit=100):
return len(inprogress) < limit