Hi everyone, please how can I run prefect 2.0 Agent within python code that contain the flow?
k
Kalise Richmond
02/13/2023, 8:27 PM
Hi @Oluremi Akinwale, If you just want to run a flow with the python code, you can just trigger the code directly without the prefect Agent. Could you describe more what you are trying to accomplish with the agent within the python code that contains the flow?
o
Oluremi Akinwale
02/13/2023, 8:39 PM
Thanks Kalise for your reply
Oluremi Akinwale
02/13/2023, 8:40 PM
I deployed the flow on prefect cloud and also scheduled it but this doesn’t run except I run the agent first
k
Kalise Richmond
02/13/2023, 8:57 PM
Ah ok so the Agent is intended to be long running so it can poll cloud for scheduled work. when it finds the scheduled deployment, it gets the metadata such as the deployment infrastructure (where it should/how it should run) and the storage block (where the code is stored). It sounds like you need to specify a storage block for where you are storing the flow code. If you're looking for more serverless, here's an example Anna wrote: https://towardsdatascience.com/prefect-aws-ecs-fargate-github-actions-make-serverless-dataflows-as-easy-as-py-f6025335effc