Tom Matthews
03/01/2024, 9:30 PMMarvin
03/01/2024, 9:31 PMpython
from prefect import context
# Assuming you have the base URL of your Prefect UI
prefect_ui_base_url = "<https://cloud.prefect.io/your-workspace-slug>"
# Fetch the flow run ID from the context
flow_run_id = context.get("flow_run_id")
# Construct the URL to the flow run in the UI
flow_run_ui_url = f"{prefect_ui_base_url}/flow-run/{flow_run_id}"
However, you should keep in mind the structure of the URL might differ based on your specific Prefect setup or version. To find out the exact method for your Prefect version, I can suggest looking into the GitHub issues or seeking clarification from the Prefect community.
Would you like me to search GitHub issues for more information on this topic?Kevin Grismore
03/01/2024, 9:40 PMfrom prefect import flow, runtime
@flow(log_prints=True)
def foo():
print(runtime.flow_run.api_url)
print(runtime.flow_run.ui_url)
foo()
Tom Matthews
03/01/2024, 11:05 PM