Is there a way to tell in a task/flow if a Flow ru...
# ask-community
c
Is there a way to tell in a task/flow if a Flow run is being run locally (with
prefect run -p …
) or registered/from Cloud? Context in this issue.
a
@Chris Arderne when you run flow using
prefect run -p flow.py
, then it’s running only locally and the flow run is not stored in the backend. But if you use
prefect run --id flow-uuid
, then you trigger a flow run via API and you can inspect the results in the Prefect Cloud UI or API. So the latter is equivalent to a quick run in the UI.
c
Thanks @Anna Geller. The purpose of running it locally it is to test runs more quickly by skipping VertexRun and associated infrastructure. But will just remove that task from reference tasks and ignore failure, as it's only needed when running on Cloud.
a
Got it. Yeah, with serverless it always take some time to spin up resources, so I can totally understand that running locally is much easier to test things out.
k
Does local here mean
flow.run()
or local agent? There is a flag for cloud triggered runs
running_with_backend: True
in the context
c
@Kevin Kho using
prefect run -p flowfile.py
. Which (in this case at least?) is equivalent to
flow.run()
. Thanks for the heads up about
running_with_backend
, I didn't spot that but sounds perfect.
🙌 1