コード例 #1
0
ファイル: common.py プロジェクト: sauravsrijan/flytekit
 def to_flyte_idl(self):
     """
     :rtype: flyteidl.admin.common_pb2.Notification
     """
     return _common_pb2.Notification(
         phases=self.phases,
         email=self.email.to_flyte_idl() if self.email else None,
         pager_duty=self.pager_duty.to_flyte_idl()
         if self.pager_duty else None,
         slack=self.slack.to_flyte_idl() if self.slack else None)
コード例 #2
0
def test_slack_notification():
    slack_notif = notification.Slack(phases=[_workflow_execution_succeeded],
                                     recipients_email=["*****@*****.**"])
    assert slack_notif.to_flyte_idl() == _common_pb2.Notification(
        phases=[_workflow_execution_succeeded],
        email=None,
        pager_duty=None,
        slack=_common_model.SlackNotification(["*****@*****.**"
                                               ]).to_flyte_idl(),
    )
コード例 #3
0
def test_email_notification():
    email_notif = notification.Email(phases=[_workflow_execution_succeeded],
                                     recipients_email=["*****@*****.**"])
    assert email_notif.to_flyte_idl() == _common_pb2.Notification(
        phases=[_workflow_execution_succeeded],
        email=_common_model.EmailNotification(["*****@*****.**"
                                               ]).to_flyte_idl(),
        pager_duty=None,
        slack=None,
    )
コード例 #4
0
def test_pager_duty_notification():
    pager_duty_notif = notification.PagerDuty(
        phases=[_workflow_execution_succeeded],
        recipients_email=["*****@*****.**"])
    assert pager_duty_notif.to_flyte_idl() == _common_pb2.Notification(
        phases=[_workflow_execution_succeeded],
        email=None,
        pager_duty=_common_model.PagerDutyNotification(
            ["*****@*****.**"]).to_flyte_idl(),
        slack=None,
    )