Paulo Rijnberg
05/26/2022, 8:44 AMdagster_slack.make_slack_on_run_failure_sensor
). I will add a code snippet at the end of my message.
I added on purpose a ZeroDivisionError: division by zero
error in my zin_trend_tool_ingestion_job
. But If I run the pipeline, it only shows the error, but nothing in the logs about sending a slack notification.
Is there someone that could help me out with the slack notification? Is there a way to test the slack notification? Should I add an additional configuration somewhere in order to let this work?
zin_trend_tool_ingestion_schedule = ScheduleDefinition(
job=zin_trend_tool_ingestion_job, cron_schedule="0 1 * * *"
)
def my_message_fn(context: PipelineFailureSensorContext) -> str:
return "Pipeline {pipeline_name} failed! Error: {error}".format(
pipeline_name=context.pipeline_run.pipeline_name,
error=context.failure_event.message,
)
slack_on_pipeline_failure = make_slack_on_pipeline_failure_sensor(
channel="#notifications",
slack_token=os.getenv("SLACK_TOKEN"),
text_fn=my_message_fn,
)
@repository
def zin_trend_tool_repository():
return [
zin_trend_tool_ingestion_job,
slack_on_pipeline_failure
]
daniel
05/26/2022, 1:20 PMPaulo Rijnberg
05/27/2022, 7:57 AMsean
05/31/2022, 1:24 PMPaulo Rijnberg
05/31/2022, 2:34 PM