Is there any way to get flow run url from the flow...
# prefect-community
m
Is there any way to get flow run url from the flow ?
r
I do not believe there is a flow run URL in the context, but you could infer the URL for a flow run as it is in the format:
<https://app.prefect.cloud/account/><account_id>/workspace/<workspace_id>/flow-runs/flow-run/<flow_run_id>
You can use the
get_run_context()
to get the flow run id and
get_settings_context()
to get the workspace and account ids associated with the flow run. Here are the docs for the Prefect context that you can use in your Prefect code
j
Can you point me to the correct attribute names within the
SettingsContext
that will provide
workspace_id
and
account_id
? I am not seeing them.
Okay here it is:
Copy code
from prefect.context import get_settings_context()
get_settings_context().settings.PREFECT_API_URL
The `PREFECT_API_URL`contains within it the account_id and the workspace_id