evaluator fix for startup phase
Change-Id: Id2e88a3da0b566d3c44de0922638e123086811ee
This commit is contained in:
parent
4f06e3a515
commit
4170911950
@ -297,16 +297,19 @@ class ActionTracker(object):
|
|||||||
|
|
||||||
def remove_action(self, key, action):
|
def remove_action(self, key, action):
|
||||||
# actions are unique in their trigger and scenario_ids
|
# actions are unique in their trigger and scenario_ids
|
||||||
def _is_equivalent(entry):
|
def _is_equivalent(action_entry):
|
||||||
return entry.trigger_id == action.trigger_id and \
|
return action_entry.trigger_id == action.trigger_id and \
|
||||||
entry.scenario_id == action.scenario_id
|
action_entry.scenario_id == action.scenario_id
|
||||||
try:
|
|
||||||
to_remove = next(entry for entry in self._tracker[key]
|
to_remove = [entry for entry in self._tracker.get(key, [])
|
||||||
if _is_equivalent(entry))
|
if _is_equivalent(entry)]
|
||||||
self._tracker[key].remove(to_remove)
|
|
||||||
except StopIteration:
|
if len(to_remove) == 0:
|
||||||
LOG.warning("Could not find action entry to remove "
|
LOG.warning("Could not find action entry to remove "
|
||||||
"from tracker: {}".format(action))
|
"from tracker: {}".format(action))
|
||||||
|
|
||||||
|
for entry in to_remove:
|
||||||
|
self._tracker[key].remove(entry)
|
||||||
|
|
||||||
def get_dominant_action(self, key):
|
def get_dominant_action(self, key):
|
||||||
return self._tracker[key][0] if self._tracker.get(key, None) else None
|
return self._tracker[key][0] if self._tracker.get(key, None) else None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user