https://prefect.io logo
r

Rikimaru Yamaguchi

12/06/2022, 12:16 PM
hello. I developed a function to notify Slack when a flow is completed. In doing so, I would like to include a link to the perfect cloud log page. What can I do? Thank you.
1
a

Anna Geller

12/06/2022, 12:24 PM
try this:
Copy code
from prefect.settings import PREFECT_UI_URL


def get_ui_flowrun_url() -> str:
    id_ = get_run_context().flow_run.dict().get('id')
    ui_url = PREFECT_UI_URL.value() or "<http://ephemeral-orion/api>"
    return f"{ui_url}/flow-runs/flow-run/{id_}"
r

Rikimaru Yamaguchi

12/07/2022, 12:51 AM
Thank you. Successful!
from prefect.context import get_run_context
need this too.
🙌 1
2 Views