From ea736cc5d655378e644625ceed31dc71ab71f60d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Tue, 24 Sep 2024 09:20:47 -0700 Subject: [PATCH] Add notification to Slack when post-fill data collection is delayed --- src/lvmcryo/__main__.py | 1 + src/lvmcryo/runner.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/lvmcryo/__main__.py b/src/lvmcryo/__main__.py index a5f7e30..bab0046 100644 --- a/src/lvmcryo/__main__.py +++ b/src/lvmcryo/__main__.py @@ -571,6 +571,7 @@ async def ln2( } record_pk, plot_paths = await post_fill_tasks( handler, + notifier=notifier, write_data=config.write_data, data_path=config.data_path, data_extra_time=config.data_extra_time if error is None else None, diff --git a/src/lvmcryo/runner.py b/src/lvmcryo/runner.py index fbb966a..e5b9c09 100644 --- a/src/lvmcryo/runner.py +++ b/src/lvmcryo/runner.py @@ -147,6 +147,7 @@ async def ln2_runner( async def post_fill_tasks( handler: LN2Handler, + notifier: Notifier | None = None, write_data: bool = False, data_path: str | pathlib.Path | None = None, data_extra_time: float | None = None, @@ -214,6 +215,13 @@ async def post_fill_tasks( if write_data and event_times.start_time and event_times.end_time: if data_extra_time: log.info(f"Waiting {data_extra_time} seconds before collecting data.") + + if notifier is not None: + await notifier.post_to_slack( + f"Fill notifications will be delayed {data_extra_time:.0f} " + "seconds while collecting post-fill data." + ) + await asyncio.sleep(data_extra_time) if data_path is None: