https://prefect.io logo
Title
m

Marcin Grzybowski

05/31/2022, 6:12 AM
Hi, can I generate flow diagram in Prefect 2.0 from code? In 1.0 i could use flow.visualize() to get pdf with diagram.
a

Anna Geller

05/31/2022, 9:42 AM
Good question. Our general recommendation, for now, is to run your code first in a development/sandbox environment, see the chart visualization and then move to your production Prefect environment e.g. Cloud 2.0
profiles make it easy - you can do:
prefect profile use dev
prefect profile use prod
each profile may point to a different PREFECT_API_URL what I often do myself is run the flow first in my default profile which is a locally running Orion API server (PREFECT_API_URL='None' or localhost), then when I'm ready for a production run, I switch the profile to Cloud 2.0:
prefect profile use cloud
to explain the reason for it: Prefect 2.0 no longer precompiles a DAG - it's generated at runtime dynamically
m

Marcin Grzybowski

05/31/2022, 10:16 AM
thank you, and how/where can I see the chart? Are you talking about "radar" in UI ?
a

Anna Geller

05/31/2022, 10:20 AM
exactly that
m

Marcin Grzybowski

05/31/2022, 10:27 AM
ok, thx!