Merge pull request #268 from pigmej/pigmej-patch-12
set target in orch to location_id if not given
This commit is contained in:
commit
43e8fa274f
@ -96,8 +96,18 @@ class React(Event):
|
|||||||
|
|
||||||
if self.parent_node in changes_graph:
|
if self.parent_node in changes_graph:
|
||||||
if self.child_node not 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(
|
changes_graph.add_node(
|
||||||
self.child_node, status='PENDING',
|
self.child_node, status='PENDING',
|
||||||
|
target=location_id,
|
||||||
errmsg=None, type='solar_resource',
|
errmsg=None, type='solar_resource',
|
||||||
args=[self.child, self.child_action])
|
args=[self.child, self.child_action])
|
||||||
|
|
||||||
@ -112,7 +122,17 @@ class StateChange(Event):
|
|||||||
|
|
||||||
def insert(self, changed_resources, changes_graph):
|
def insert(self, changed_resources, changes_graph):
|
||||||
changed_resources.append(self.parent)
|
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(
|
changes_graph.add_node(
|
||||||
self.parent_node, status='PENDING',
|
self.parent_node, status='PENDING',
|
||||||
|
target=location_id,
|
||||||
errmsg=None, type='solar_resource',
|
errmsg=None, type='solar_resource',
|
||||||
args=[self.parent, self.parent_action])
|
args=[self.parent, self.parent_action])
|
||||||
|
@ -72,5 +72,5 @@ def target_based_rule(dg, inprogress, item, limit=1):
|
|||||||
return limit > target_count
|
return limit > target_count
|
||||||
|
|
||||||
|
|
||||||
def items_rule(dg, inprogress, item, limit=1):
|
def items_rule(dg, inprogress, item, limit=100):
|
||||||
return len(inprogress) < limit
|
return len(inprogress) < limit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user