Skip to content

Commit 730d17b

Browse files
committed
Remove unused trigger variable for alerts
1 parent 352b4ed commit 730d17b

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

simvue/run.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def __init__(
101101
self._uuid: str = f"{uuid.uuid4()}"
102102
self._mode: typing.Literal["online", "offline", "disabled"] = mode
103103
self._name: typing.Optional[str] = None
104-
self._abort_on_fail: bool = True
104+
self._abort_on_alert: bool = True
105105
self._dispatch_mode: typing.Literal["direct", "queued"] = "queued"
106106
self._executor = Executor(self)
107107
self._dispatcher: typing.Optional[DispatcherBaseClass] = None
@@ -126,7 +126,6 @@ def __init__(
126126
self._shutdown_event: typing.Optional[threading.Event] = None
127127
self._configuration_lock = threading.Lock()
128128
self._heartbeat_termination_trigger: typing.Optional[threading.Event] = None
129-
self._alert_raised_trigger: typing.Optional[threading.Event] = None
130129
self._storage_id: typing.Optional[str] = None
131130
self._heartbeat_thread: typing.Optional[threading.Thread] = None
132131
self._heartbeat_interval: int = HEARTBEAT_INTERVAL
@@ -285,8 +284,8 @@ def _heartbeat(
285284
with self._configuration_lock:
286285
if (
287286
self._simvue
287+
and self._abort_on_alert
288288
and self._simvue.get_abort_status()
289-
and self._alert_raised_trigger
290289
):
291290
self._alert_raised_trigger.set()
292291
self.kill_all_processes()
@@ -463,13 +462,6 @@ def _error(self, message: str, join_threads: bool = True) -> None:
463462
self._heartbeat_termination_trigger.set()
464463
if join_threads:
465464
self._heartbeat_thread.join()
466-
if (
467-
self._abort_on_fail
468-
and self._alert_raised_trigger
469-
and self._alert_raised_trigger.is_set()
470-
):
471-
self._aborted = True
472-
self.kill_all_processes()
473465

474466
# Finish stopping all threads
475467
if self._shutdown_event:
@@ -842,7 +834,7 @@ def config(
842834
resources_metrics_interval: typing.Optional[int] = None,
843835
disable_resources_metrics: typing.Optional[bool] = None,
844836
storage_id: typing.Optional[str] = None,
845-
abort_on_fail: typing.Optional[bool] = None,
837+
abort_on_alert: typing.Optional[bool] = None,
846838
) -> bool:
847839
"""Optional configuration
848840
@@ -859,7 +851,7 @@ def config(
859851
disable monitoring of resource metrics
860852
storage_id : str, optional
861853
identifier of storage to use, by default None
862-
abort_on_fail : bool, optional
854+
abort_on_alert : bool, optional
863855
whether to abort the run if an alert is triggered
864856
865857
Returns
@@ -888,8 +880,8 @@ def config(
888880
if resources_metrics_interval:
889881
self._resources_metrics_interval = resources_metrics_interval
890882

891-
if abort_on_fail:
892-
self._abort_on_fail = abort_on_fail
883+
if abort_on_alert:
884+
self._abort_on_alert = abort_on_alert
893885

894886
if storage_id:
895887
self._storage_id = storage_id

0 commit comments

Comments
 (0)