Haytham Abuelfutuh
workflow_notifications
in flyte-core (might be inconsistent) but you can put the same emailer
block there and it will work just the same.
Have you successfully tested it in sandbox?Derek Yu
09/07/2023, 4:03 PMsendgrid
setup with flyte-core
chart as such:
workflow_notifications:
enabled: true
config:
notifications:
type: sandbox
emailer:
emailServerConfig:
serviceName: sendgrid
apiKeyEnvVar: $SENDGRID_API_KEY
subject: "Notice: Execution \"{{ workflow.name }}\" has {{ phase }} in \"{{ domain }}\"."
sender: "<mailto:foo@foo.com|foo@foo.com>"
body: >
asdf
When upgrading the chart, this error appeared:
helm.go:81: [debug] template: flyte/charts/flyte-core/templates/flytescheduler/deployment.yaml:16:27: executing "flyte/charts/flyte-core/templates/flytescheduler/deployment.yaml" at <include (print .Template.BasePath "/admin/configmap.yaml") .>: error calling include: template: flyte/charts/flyte-core/templates/admin/configmap.yaml:48:28: executing "flyte/charts/flyte-core/templates/admin/configmap.yaml" at <.Values.workflow_notifications.config.notifications.region>: wrong type for value; expected string; got interface {}
UPGRADE FAILED
Which suggests that the helm chart expects the fields for the AWS setup
(region, publisher, processer) and not the sendgrid
setup, which doesn't have those fields.Yee
Haytham Abuelfutuh
workflow_notifications:
enabled: true
config:
notifications:
type: sandbox
region: wrong-region
emailer:
emailServerConfig:
serviceName: sendgrid
apiKeyEnvVar: $SENDGRID_API_KEY
subject: "Notice: Execution \"{{ workflow.name }}\" has {{ phase }} in \"{{ domain }}\"."
sender: "<mailto:foo@foo.com|foo@foo.com>"
body: >
asdf
Yee
Derek Yu
09/12/2023, 3:47 PMsendgrid
never attempts to send an email, and I don't see any evidence of flyteadmin trying to reach sendgrid in the logs (grepped on keywords sendgrid
and notification
) when running a successful execution with the following launchplan copied directly from the example in the docs:
@task
def double_int_and_print(a: int) -> str:
return str(a * 2)
@workflow
def int_doubler_wf(a: int) -> str:
doubled = double_int_and_print(a=a)
return doubled
wacky_int_doubler_lp = LaunchPlan.get_or_create(
name="wacky_int_doubler",
workflow=int_doubler_wf,
default_inputs={"a": 4},
notifications=[
Slack(
phases=[
WorkflowExecutionPhase.SUCCEEDED,
WorkflowExecutionPhase.ABORTED,
WorkflowExecutionPhase.TIMED_OUT,
WorkflowExecutionPhase.FAILED,
],
recipients_email=["<http://xxx.slack.com|xxx.slack.com>"],
),
],
)
In flyteadmin
I see the correct content passed to /etc/flyte/config/notifications.yaml
notifications:
type: sandbox
region: foo
emailer:
body: |
Execution \"{{ workflow.name }} [{{ name }}]\" has {{ phase }} in \"{{ domain }}\". View details at <a href=\<https://xxx.xxxx.com/console/projects/{{> project }}/domains/{{ domain }}/executions/{{ name }}> <https://xxx.xxx.com/console/projects/{{> project }}/domains/{{ domain }}/executions/{{ name }}</a>. {{ error }}
emailServerConfig:
apiKeyEnvVar: xxxx
serviceName: sendgrid
sender: <mailto:myemail@xxx.com|myemail@xxx.com> (<- this email is my verified sender identity on sendgrid)
subject: 'Notice: Execution "{{ workflow.name }}" has {{ phase }} in "{{ domain }}".'
Is there anything else you recommend I check? Do these configurations looks correct? Thanks!Yee
logger:
show-source: true
level: 5
Derek Yu
09/14/2023, 5:10 PMnotifications:
type: sandbox
emailer:
emailServerConfig:
apiKeyEnvVar: "SENDGRID_API_KEY"
subject: "Notice: Execution \"{{ name }}\" has {{ phase }} in \"{{ domain }}\"."
sender: "<mailto:example@gmail.com|example@gmail.com>" # Consider using a generic email instead of personal
body: >
Execution \"{{ name }}\" has {{ phase }} in \"{{ domain }}\". View details at
<a href=\<http://example.com/projects/{{> project }}/domains/{{ domain }}/executions/{{ name }}>
<http://example.com/projects/{{> project }}/domains/{{ domain }}/executions/{{ name }}</a>. {{ error }}
Yee
Derek Yu
09/18/2023, 4:54 PMtype: sandbox
Yee
Derek Yu
09/18/2023, 5:30 PMYee
Derek Yu
09/18/2023, 5:31 PMYee
Derek Yu
09/18/2023, 5:33 PM