https://prefect.io logo
j

José Duarte

11/03/2022, 10:07 AM
Hey all, in Prefect 2, is there a way to figure out if I’m running locally or with a remote? From my understanding, in Prefect 1 there was
prefect.context.get("running_with_backend")
a

Anna Geller

11/03/2022, 12:22 PM
check if the deployment ID is set, if not, then it's ad-hoc run:
Copy code
from prefect import flow, context


@flow
def xxx():
    x = context.get_run_context()
    print(x.flow_run.deployment_id)
j

José Duarte

11/03/2022, 12:34 PM
Nice, thank you!
🙌 1
5 Views