Is it possible to check (from inside the task) if ...
# ask-community
k
Is it possible to check (from inside the task) if the flow is being executed locally, without agent or it it's being executed in Prefect Server/Cloud by an agent? E.g. by looking up some property in the context?
k
Hey @Krzysztof Nawara, you can do
if prefect.config.backend != "cloud":
Actually no that only distinguishes between cloud and server. Let me think for the agent.
k
👍
k
Use
prefect.context.get("running_with_backend")
. This does not exist for
flow.run()
calls.
k
Thanks!