Skip to content

Commit

Permalink
[KFP] Fix IPython Workflow Report Not Showing For Remote Pipeline (#5616
Browse files Browse the repository at this point in the history
)
  • Loading branch information
quaark committed May 23, 2024
1 parent cf98330 commit 1a8792e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 17 deletions.
20 changes: 12 additions & 8 deletions mlrun/projects/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -882,20 +882,24 @@ def get_run_status(
expected_statuses=None,
notifiers: mlrun.utils.notifications.CustomNotificationPusher = None,
):
# ignore notifiers, as they are handled by the remote pipeline notifications,
# so overriding with CustomNotificationPusher with empty list of notifiers
state, had_errors, text = _KFPRunner.get_run_status(
# ignore notifiers for remote notifications, as they are handled by the remote pipeline notifications,
# so overriding with CustomNotificationPusher with empty list of notifiers or only local notifiers
local_project_notifiers = list(
set(mlrun.utils.notifications.NotificationTypes.local()).intersection(
set(project.notifiers.notifications.keys())
)
)
notifiers = mlrun.utils.notifications.CustomNotificationPusher(
local_project_notifiers
)
return _KFPRunner.get_run_status(
project,
run,
timeout,
expected_statuses,
notifiers=mlrun.utils.notifications.CustomNotificationPusher([]),
notifiers=notifiers,
)

# indicate the pipeline status since we don't push the notifications in the remote runner
logger.info(text)
return state, had_errors, text


def create_pipeline(project, pipeline, functions, secrets=None, handler=None):
spec = imputil.spec_from_file_location("workflow", pipeline)
Expand Down
23 changes: 14 additions & 9 deletions mlrun/utils/notifications/notification/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,19 @@ def inverse_dependencies(self) -> list[str]:
self.console: [self.ipython],
}.get(self, [])

@classmethod
def local(cls) -> list[str]:
return [
cls.console,
cls.ipython,
]

@classmethod
def all(cls) -> list[str]:
return list(
[
cls.console,
cls.git,
cls.ipython,
cls.slack,
cls.webhook,
]
)
return [
cls.console,
cls.git,
cls.ipython,
cls.slack,
cls.webhook,
]
6 changes: 6 additions & 0 deletions mlrun/utils/notifications/notification_pusher.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,12 @@ def __init__(self, notification_types: list[str] = None):
if notification.is_async
}

@property
def notifications(self):
notifications = self._sync_notifications.copy()
notifications.update(self._async_notifications)
return notifications

def push(
self,
message: str,
Expand Down

0 comments on commit 1a8792e

Please sign in to comment.