Michał Wysocki
11/28/2023, 3:22 PM@flow(name="sub-flow")
async def run_subflow():
print("subflow")
@flow(name="top-flow")
async def run_top():
print("top flow")
await run_subflow()
async def main_code():
await run_top()
It runs great locally, but how can I run a top flow on a worker (kubernetes) and subflow on another worker?
I have deployments created and I can run it using Kubernetes from Prefect Cloud UI or on schedule, but I just don't know how to run it on worker from code reusing this clean code.
Thanks!Michał Wysocki
11/28/2023, 4:05 PMHenning Holgersen
11/29/2023, 7:21 AMif __name__==‘__main__’: run_top()
block at the bottom, it should execute like any other Python script I think.Michał Wysocki
11/29/2023, 8:32 AMHenning Holgersen
11/29/2023, 10:31 AMMichał Wysocki
11/29/2023, 10:37 AMrun_top()
as a flow on the worker (instead of in the webapp process).
In other words: How do I use my deployment?David Joerg
02/08/2024, 3:49 PMMichał Wysocki
02/08/2024, 3:59 PMrun_deployment
did the trick for me: https://docs.prefect.io/latest/api-ref/prefect/deployments/deployments/#prefect.deployments.deployments.run_deployment