Skip to content

Commit

Permalink
16 fix unable to run the training job (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmind authored Dec 14, 2024
1 parent bdd338a commit 1a4b8a2
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions src/bikes/io/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import contextlib as ctx
import sys
import typing as T
import warnings

import loguru
import mlflow
Expand Down Expand Up @@ -113,14 +114,27 @@ def notify(self, title: str, message: str) -> None:
message (str): message of the notification.
"""
if self.enable:
notification.notify(
title=title,
message=message,
app_name=self.app_name,
timeout=self.timeout,
)
try:
notification.notify(
title=title,
message=message,
app_name=self.app_name,
timeout=self.timeout,
)
except NotImplementedError:
warnings.warn("Notifications are not supported on this system.", RuntimeWarning)
self._print(title=title, message=message)
else:
print(f"[{self.app_name}] {title}: {message}")
self._print(title=title, message=message)

def _print(self, title: str, message: str) -> None:
"""Print a notification to the system.
Args:
title (str): title of the notification.
message (str): message of the notification.
"""
print(f"[{self.app_name}] {title}: {message}")


class MlflowService(Service):
Expand Down

0 comments on commit 1a4b8a2

Please sign in to comment.