Exemplo n.º 1
0
def test_slack():
    obj = _notifications.Slack(
        [_execution_model.WorkflowExecutionPhase.FAILED], ["*****@*****.**"])
    assert obj.email is None
    assert obj.pager_duty is None
    assert obj.phases == [_execution_model.WorkflowExecutionPhase.FAILED]
    assert obj.slack.recipients_email == ["*****@*****.**"]

    obj2 = _notifications.Slack.from_flyte_idl(obj.to_flyte_idl())
    assert obj == obj2
Exemplo n.º 2
0
# This is a launchplan that is created with default values of inputs and added some annotations, labels and
# notification preferences. Default values make it possible to still override when an execution is requested
scale_rotate_default_launchplan = workflows.ScaleAndRotateWorkflow.create_launch_plan(
    labels=Labels({
        'flyte.org/managed': 'true',
    }),
    annotations=Annotations({
        'flyte.org/secret-inject': 'required',
    }),
    notifications=[
        _notifications.Slack(
            [
                _execution.WorkflowExecutionPhase.SUCCEEDED,
                _execution.WorkflowExecutionPhase.FAILED,
                _execution.WorkflowExecutionPhase.TIMED_OUT,
                _execution.WorkflowExecutionPhase.ABORTED,
            ],
            ['*****@*****.**'],
        ),
    ],
    default_inputs={})

# This launch plan customizes the input angle to 90 and the scale factor to 4x as `fixed_inputs`. Inputs cannot be
# changed now
scale4x_rotate90degrees_launchplan = workflows.ScaleAndRotateWorkflow.create_launch_plan(
    fixed_inputs={
        "angle": 90.0,
        "scale": 4
    }, )