Skip to content

Commit 5866e5d

Browse files
committed
Update abort_on_alert
Remove long-deprecated ability to pass bool and make literals consistent within code
1 parent e518b49 commit 5866e5d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

simvue/run.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import functools
2424
import platform
2525
import typing
26-
import warnings
2726
import uuid
2827
import numpy
2928
import randomname
@@ -1065,7 +1064,7 @@ def config(
10651064
enable_emission_metrics: bool | None = None,
10661065
disable_resources_metrics: bool | None = None,
10671066
storage_id: str | None = None,
1068-
abort_on_alert: typing.Literal["run", "all", "ignore"] | bool | None = None,
1067+
abort_on_alert: typing.Literal["run", "terminate", "ignore"] | None = None,
10691068
) -> bool:
10701069
"""Optional configuration
10711070
@@ -1084,10 +1083,10 @@ def config(
10841083
disable monitoring of resource metrics
10851084
storage_id : str, optional
10861085
identifier of storage to use, by default None
1087-
abort_on_alert : Literal['ignore', run', 'terminate'], optional
1086+
abort_on_alert : Literal['ignore', 'terminate', 'ignore'], optional
10881087
whether to abort when an alert is triggered.
10891088
* run - current run is aborted.
1090-
* terminate - script itself is terminated.
1089+
* terminate - (default) script itself is terminated.
10911090
* ignore - alerts do not affect this run.
10921091
10931092
Returns
@@ -1153,11 +1152,12 @@ def config(
11531152

11541153
if abort_on_alert is not None:
11551154
if isinstance(abort_on_alert, bool):
1156-
warnings.warn(
1157-
"Use of type bool for argument 'abort_on_alert' will be deprecated from v1.2, "
1158-
"please use either 'run', 'all' or 'ignore'"
1155+
raise (
1156+
TypeError(
1157+
"Use of type bool for argument 'abort_on_alert' has been removed, "
1158+
"please use either 'run', 'all' or 'ignore'"
1159+
)
11591160
)
1160-
abort_on_alert = "run" if self._abort_on_alert else "ignore"
11611161
self._abort_on_alert = abort_on_alert
11621162

11631163
if storage_id:

0 commit comments

Comments
 (0)