<@ULVA73B9P> In Prefect 3.x, i have an automation that isn't correctly linking to my Prefect UI. H...
k
@Marvin In Prefect 3.x, i have an automation that isn't correctly linking to my Prefect UI. How do I fix this Jinja to correctly show the UI_URL for the flow_run ? Flow Run: {{ flow.name }}/{{ flow_run.name }} State:
{% if flow_run.state.name == "Completed" %}:large_green_circle:{% endif %}{{ flow_run.state.name }}
Timestamp: {{ flow_run.state.timestamp.strftime("%Y-%b-%d %I:%M %p") }} America/Phoenix Flow ID: {{ flow_run.flow_id }} Flow Run ID: {{ flow_run.id }} Flow Run URL: {{ flow_run|ui_url }}/flow-runs/flow-run/{{ flow_run.flow_id }} {% if flow_run.state.message %} State Message: {{ flow_run.state.message }} {% endif %}
m
To correctly display the UI URL for a flow run using Jinja in Prefect 3.x, there seems to be a minor mistake in your template. The current line for the Flow Run URL:
{{ flow_run|ui_url }}/flow-runs/flow-run/{{ flow_run.flow_id }}
appears to incorrectly conjoin flow run IDs and paths. To construct the correct UI URL using the Jinja template, you should be using the
flow_run
object with its appropriate attributes or methods directly provided by Prefect, often encapsulated in a helper function or a built-in filter specifically for UI URLs. Here’s a corrected approach to generate the URL, based on common patterns for accessing Prefect Cloud resources: - Make sure you use the
flow_run.id
directly, as this is the primary identifier for a flow run. - Use any Prefect helper functions, if available or documented, to access the URL. Although I couldn't find a specific documented filter or function in the Prefect 3.x documentation for directly accessing the UI URL, typical access involves constructing the URL with the base domain of your Prefect Cloud instance followed by the specific identifiers for the flow run. Here’s a suggested structure: Flow Run URL:
<https://cloud.prefect.io/<your-workspace>/flow-runs/flow-run/{{> flow_run.id }}
Replace
<your-workspace>
with your actual Prefect workspace. Since detailed documentation or issues directly addressing this were not found, I recommend checking your Prefect Cloud configuration or consulting the broader user community if issues persist. For more detailed actions and examples around automations and Jinja templating in Prefect 3.x, consider visiting the documentation here on automations or checking your connection to Prefect Cloud as described here.