Luis Cebrián
03/23/2023, 3:28 PMfrom prefect.client import Client
import prefect
flow_run_id = prefect.context.flow_run_id
url = Client().get_cloud_url("flow-run", flow_run_id)
I have not found anything similar in prefect 2.0. How can I do that in prefect 2.0?Filip Panovski
03/23/2023, 3:31 PMdef _notify(status: PipelineStatus, pipeline: str = None, params: dict = None):
pipeline = pipeline if pipeline else '<unnamed pipeline>'
params = params if params else {}
teams_webhook_block = MicrosoftTeamsWebhook.load("block-name")
teams_webhook_block.notify(f'[{pipeline}] {status.name} with parameters: {params}')
Using the Slack block for notifying should be fairly similar.Luis Cebrián
03/23/2023, 3:34 PMFilip Panovski
03/23/2023, 3:37 PMprefect.context.get_run_context().task_run.dict()
prefect.context.get_run_context().flow_run.dict()
might have the information you require. Specifically, flow_run
should contain a flow_id
. Have you tried looking at that?Luis Cebrián
03/23/2023, 3:47 PMjack
03/23/2023, 8:36 PMon_completion
and on_failure
callbacks outlined here:
https://discourse.prefect.io/t/prefect-2-8-3-is-here-with-completion-and-failure-hooks-for-flows-and-tasks/2437Luis Cebrián
03/27/2023, 2:18 PM