Skip to content

Commit

Permalink
Add notification to Slack when post-fill data collection is delayed
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Sep 24, 2024
1 parent e0873bf commit ea736cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lvmcryo/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions src/lvmcryo/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit ea736cc

Please sign in to comment.