Hi everyone, I am trying to run prefect agent in D...
# ask-community
v
Hi everyone, I am trying to run prefect agent in Detached mode using supervisor as per prefect documentation, even though i am able to spawn up the prefect agent, the additional params passed is not read. I have attached the CLI command that i use to run the agent and it works as expected but at the same time when i run it using supervisor, it doesn't attach the labels or get the API for the agent to connect to. If there is any other way to run prefect agent in detached mode or if there is an error in the way i am using is could you please let me know. Thanks in advance
k
Hi @vaibhav satpathy! Are you using the
prefect agent local install
to generate the supervisord.conf?
v
yes
@Kevin Kho
k
How are you starting the agent? With the shell script? Does an agent even start?
v
yes
if i use the shell script i can get the agent to spawn up and work as expected with the flows registered with it. But when i use supervisor the labels don't get attached to the agent, it only spawns up the raw sample agent
k
How are you starting the supervisor process?
v
using the command supervisorctl start all
k
That seems good I’ll try to replicate
v
sure awaiting your response
k
it works for me. i did
prefect agent local install -l foobar
. got the output generated by that and saved under
supervisord.conf
. I ran
supervisord
inside the same folder to start the agent and it worked.
Was you supervisord.conf file in the same folder where you can
supervisord
?
v
yes it was in the same folder Did your agent attach itself to the labels on your server Cause for me it is able to spawn up but not able to add the labels
the supervisor file also gets generated accurately but that's only for labels, I can't add start parameters such as --api to it either
k
Yes I saw the labels on cloud. I haven’t used these tools before, do you think starting with
supervisord
instead os
supervisorctl start
might make a difference?
v
i tried that too when i use prefect server it doesn't reflect. The most important of them being the
--api
parameter which i believe supervisor doesn't accept. Not sure
Cause it is needed to connect the agent to Graphql server, for some reason even the labels are not reflecting in my case. Any idea why that could be the case
k
Hey @vaibhav satpathy! Sorry was busy preparing for conferences. I’ll be sure to look devote more time to this later today.
What does the supervisord.log show you?
Also I don’t have quotes on my labels when I tried, maybe you can try removing them
Quotes seems to works for me. I would check the log file.
v
for me the prefect agent spawns up as expected, I tried without the quotes as per documentation as well and the result was same. The agent spawned up without the label and it doesn't accept the
--api
parameter.
My concern is around the fact that when i run the shell script or use the command line to run the agent with the same command, everything works as expected. The agent connects to the Graphql server and attaches itself to the labels or flows. But when i run the same thing as it is using supervisor it spawns up without the connection or labels. Is it something because of the way prefect was built or am i doing something wrong?
@Kevin Kho really appreciate your effort, Let me know whenever you get time to look into the concerned matter.
k
Hey, is there a supervisord.log file in the same folder? Could you show me that?
v
When i take a look at this it is there, when i use
supervisord
as you mentioned, but when i trigger using
supervisorctl start all
it fails to load it.
@Kevin Kho Thanks for the solution, if it is not too much to ask could you check with
supervisor start all
as well. Appreciate the help.
I am now able to run it end to end as expected. Thanks a lot @Kevin Kho
k
Yes that doesn’t do anything for me