Skip to content

Commit dcd4860

Browse files
authored
Merge pull request #401 from simvue-io/hotfix/add-abort-alert-option
Added abort option to alert creation
2 parents 65309aa + 6871488 commit dcd4860

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

simvue/run.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,6 +1538,7 @@ def create_alert(
15381538
] = "average",
15391539
notification: typing.Literal["email", "none"] = "none",
15401540
pattern: typing.Optional[str] = None,
1541+
trigger_abort: bool = False,
15411542
) -> typing.Optional[str]:
15421543
"""Creates an alert with the specified name (if it doesn't exist)
15431544
and applies it to the current run. If alert already exists it will
@@ -1597,6 +1598,8 @@ def create_alert(
15971598
whether to notify on trigger, by default "none"
15981599
pattern : str, optional
15991600
for event based alerts pattern to look for, by default None
1601+
trigger_abort : bool, optional
1602+
whether this alert can trigger a run abort
16001603
16011604
Returns
16021605
-------
@@ -1671,7 +1674,7 @@ def create_alert(
16711674

16721675
if alert_id:
16731676
# TODO: What if we keep existing alerts/add a new one later?
1674-
data = {"id": self._id, "alerts": [alert_id]}
1677+
data = {"id": self._id, "alerts": [alert_id], "abort": trigger_abort}
16751678
self._simvue.update(data)
16761679

16771680
return alert_id

0 commit comments

Comments
 (0)