supervisordsigtermprefect

Supervisor kills Prefect agent with SIGTERM unexpectedly


I'm using a rapsberry pi 4, v10(buster). I installed supervisor per the instructions here: http://supervisord.org/installing.html Except I changed "pip" to "pip3" because I want to monitor running things that use the python3 kernel. I'm using Prefect, and the supervisord.conf is running the program with command=/home/pi/.local/bin/prefect "agent local start" (I tried this with and without double quotes)

Looking at the supervisord.log file it seems like the Prefect Agent does start, I see the ASCII art that normally shows up when I start it from the command line. But then it shows it was terminated by SIGTERM;not expected, WARN recieved SIGTERM inidicating exit request.

I saw this post: Supervisor gets a SIGTERM for some reason, quits and stops all its processes but I don't even have that 10Periodic file it references.

Anyone know why/how Supervisor processes are getting killed by sigterm?


Solution

  • It could be that your process exits immediately because you don’t have an API key in your command and this is required to connect your agent to the Prefect Cloud API. Additionally, it’s a best practice to always assign a unique label to your agents, below is an example with “raspberry” as a label.

    You can also check the logs/status:

    supervisorctl status
    

    Here is a command you can try, plus you can specify a directory in your supervisor config (not sure whether environment variables are needed but I saw it from other raspberry Pi supervisor user):

    [program:prefect-agent]
    command=prefect agent local start -l raspberry -k YOUR_API_KEY --no-hostname-label
    directory=/home/pi/.local/bin/prefect
    user=pi
    environment=HOME="/home/pi/.local/bin/prefect",USER="pi"