mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-12 02:53:29 +08:00
[Amend] Considering Multiple Executions and OS variations
This commit is contained in:
parent
8fca922999
commit
8249ddc185
19
main.py
19
main.py
@ -7,10 +7,23 @@ import folder_paths
|
|||||||
import time
|
import time
|
||||||
from comfy.cli_args import args
|
from comfy.cli_args import args
|
||||||
from app.logger import setup_logger
|
from app.logger import setup_logger
|
||||||
|
import datetime
|
||||||
|
import tempfile
|
||||||
|
|
||||||
pid = str(os.getpid())
|
def write_pid_to_file(identifier="ComfyUI"):
|
||||||
with open("/tmp/ComfyUI.pid", "w") as f:
|
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||||
f.write(pid)
|
filename = f"{identifier}_{timestamp}_{os.getpid()}.pid"
|
||||||
|
|
||||||
|
temp_dir = tempfile.gettempdir()
|
||||||
|
full_filepath = os.path.join(temp_dir, filename)
|
||||||
|
|
||||||
|
with open(full_filepath, "w") as temp_file:
|
||||||
|
temp_file.write(str(os.getpid()))
|
||||||
|
|
||||||
|
return full_filepath
|
||||||
|
|
||||||
|
pid_filepath = write_pid_to_file()
|
||||||
|
print(f"PID written to file: {pid_filepath}")
|
||||||
|
|
||||||
setup_logger(verbose=args.verbose)
|
setup_logger(verbose=args.verbose)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user