Gregory Hunt
05/18/2023, 12:25 PMif __name__ == "__main__":
block on code run. Does it run on the Agent? I am working on setting up a streaming flow with GCP Cloudrun jobs for the worker pool and am curious sync this part of the flow is continuous?Nate
05/18/2023, 2:38 PMWhere does the code theif you mean you have something like this that you've created a deployment fromblock on code runif __name__ == "__main__":
@flow
def my_flow():
pass
if __name__ == "__main__":
my_flow()
in your local flow file, that if __name__ == "__main__":
block doesn't actually run when your agent pulls -> submits your deployment flow run
the prefect engine will call your flow with the parameters (default, or the ones you provided), as the flow
-decorated function was defined in your local flow file when you created the deployment from it - does that make sense?Gregory Hunt
05/18/2023, 2:39 PMNate
05/18/2023, 2:54 PMcreate_flow_run_from_deployment
(via run_deployment)? that way you could let the prefect API act as the listener, triggering a new flow run each time some event comes through instead of having a while loop