Skip to content

Commit

Permalink
Notifications and stopfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
calum-chamberlain committed Dec 13, 2023
1 parent 5d45000 commit 0068684
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions rt_eqcorrscan/config/mailer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
""" Basic notification handling. Only tested for pushover """

import logging
import platform

from notifiers import get_notifier

Expand All @@ -18,6 +19,7 @@ def __init__(
self.default_args = default_args

def notify(self, content: str):
content = f"RTEQcorrscan message from {platform.node()}: {content}"
try:
self.service.notify(message=content, **self.default_args)
except Exception as e:
Expand Down
3 changes: 2 additions & 1 deletion rt_eqcorrscan/rt_match_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ def backfill(
Logger.info("Backfill process started, returning")
return

def stop(self, write_stopfile: bool = False) -> None:
def stop(self, write_stopfile: bool = True) -> None:
"""
Stop the real-time system.
Expand All @@ -1225,6 +1225,7 @@ def stop(self, write_stopfile: bool = False) -> None:
Used to write a one-line file telling listening systems that
this has stopped. Used by the Reactor.
"""
self.notifier.notify("Stopping run")
if self.plotter is not None: # pragma: no cover
self.plotter.background_stop()
self.rt_client.background_stop()
Expand Down

0 comments on commit 0068684

Please sign in to comment.