https://prefect.io logo
Title
t

Tomás Emilio Silva Ebensperger

09/28/2022, 3:57 PM
It is possible to run the agent in 2.0 in a python file instead of doing
prefect agent start  --work-queue blabla
1
k

Khuyen Tran

09/28/2022, 4:20 PM
We currently don’t support that. Is there a reason that you want to run the agent in a Python file?
t

Tomás Emilio Silva Ebensperger

09/28/2022, 5:55 PM
I am able to set supervisor to run the agent properly but then when i trigger flows in the UI it is not using the virtual environment and it is using the global python runtime.
k

Khuyen Tran

09/28/2022, 6:19 PM
That is not the expected behavior. Are you using virtualenv?
t

Tomás Emilio Silva Ebensperger

09/28/2022, 6:19 PM
pyenv
/home/ubuntu/project/env/bin/prefect agent start --work-queue "my queue"
this is qhat i have in the supervisor file
and i don't wan to install al the dependencies globally to make it work
i added environment=PATH=... and it seems to work now. the whole reason why i was asking about python agent execution instead of bash was because with prefect 1.0 ive never had to worry about those environments i just executed the python file with the right path to the environment and that was it
thanks for the help
k

Khuyen Tran

09/29/2022, 8:26 PM
I’m curious which infrastructure you are using?