Skip to content

Added abort option to alert creation #401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion simvue/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,7 @@ def create_alert(
] = "average",
notification: typing.Literal["email", "none"] = "none",
pattern: typing.Optional[str] = None,
trigger_abort: bool = False,
) -> typing.Optional[str]:
"""Creates an alert with the specified name (if it doesn't exist)
and applies it to the current run. If alert already exists it will
Expand Down Expand Up @@ -1597,6 +1598,8 @@ def create_alert(
whether to notify on trigger, by default "none"
pattern : str, optional
for event based alerts pattern to look for, by default None
trigger_abort : bool, optional
whether this alert can trigger a run abort

Returns
-------
Expand Down Expand Up @@ -1671,7 +1674,7 @@ def create_alert(

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

return alert_id
Expand Down
Loading