BEHAVIOR-002: isolate per-actuator runtime failures
This commit is contained in:
@@ -41,7 +41,14 @@ class BehaviorEngine:
|
|||||||
self._settings = settings
|
self._settings = settings
|
||||||
|
|
||||||
def train_all(self) -> list[ActuatorRecord]:
|
def train_all(self) -> list[ActuatorRecord]:
|
||||||
return [self.train(record.actuator_entity_id) for record in self._store.list()]
|
results: list[ActuatorRecord] = []
|
||||||
|
for record in self._store.list():
|
||||||
|
try:
|
||||||
|
results.append(self.train(record.actuator_entity_id))
|
||||||
|
except Exception:
|
||||||
|
logger.exception("Behavior training failed for %s", record.actuator_entity_id)
|
||||||
|
results.append(record)
|
||||||
|
return results
|
||||||
|
|
||||||
def train(self, actuator_entity_id: str) -> ActuatorRecord:
|
def train(self, actuator_entity_id: str) -> ActuatorRecord:
|
||||||
record = self._store.get(actuator_entity_id)
|
record = self._store.get(actuator_entity_id)
|
||||||
@@ -143,7 +150,14 @@ class BehaviorEngine:
|
|||||||
return self._save_behavior(record, behavior)
|
return self._save_behavior(record, behavior)
|
||||||
|
|
||||||
def evaluate_all(self) -> list[ActuatorRecord]:
|
def evaluate_all(self) -> list[ActuatorRecord]:
|
||||||
return [self.evaluate(record.actuator_entity_id) for record in self._store.list()]
|
results: list[ActuatorRecord] = []
|
||||||
|
for record in self._store.list():
|
||||||
|
try:
|
||||||
|
results.append(self.evaluate(record.actuator_entity_id))
|
||||||
|
except Exception:
|
||||||
|
logger.exception("Behavior evaluation failed for %s", record.actuator_entity_id)
|
||||||
|
results.append(record)
|
||||||
|
return results
|
||||||
|
|
||||||
def evaluate(self, actuator_entity_id: str) -> ActuatorRecord:
|
def evaluate(self, actuator_entity_id: str) -> ActuatorRecord:
|
||||||
record = self._store.get(actuator_entity_id)
|
record = self._store.get(actuator_entity_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user