[+] Added PID for main.py
A small addition to indicate the PID of the process when main.py is running in the background.
I find it useful in many scenarios - from support for Monit to running the process in the background with the start of my server.
The process number (PID) can be found with the following command ps -aux | grep main.py or in the temp folder named ComfyUI_YYYYMMDD_HHMMSS_PIDNUMBER.pid
ComfyUI can run multiple instances for multiple ports. And we need to consider environments other than Linux as well.
ComfyUI can run multiple instances for multiple ports. And we need to consider environments other than Linux as well.
@ltdrdata You are right. I haven't considered those scenarios and currently working to revise the code
@ltdrdata This should be more OS and Instance friendly
What's the value/use case for a PID in a random temporary file? That is harder to find the value than using ps -aux is.
What's the value/use case for a PID in a random temporary file? That is harder to find the value than using
ps -auxis.
Sure, @mcmonkey4eva. I was trying to be consistent with my first iteration, and this behaviour can audit which PID was assigned at what time, especially for multiple instances. I guess it's overkill, as the PID number is also at the end of the filename.
Doesn't really seem like the right solution. You're also writing to a non-standard location for pid file? I would reject the PR as an XY problem tbh. As the maintainer stated Comfy can run multiple instances, do you have any other software that is producing PID files like this?
For Monit, consider looking at alternatives to monitoring by PID. PID usage is meant for daemon process to be deterministic, you kinda lose that if you're throwing in the date.
Sounds like what you want is a health/status check, you do not need a PID file for that.