Comfy-Org / comfy-cli

Command Line Interface for Managing ComfyUI
https://docs.comfy.org/comfy-cli/getting-started
GNU General Public License v3.0
230 stars 36 forks source link

When not using a virtual environment, `__COMFY_CLI_SESSION__` will not be set, and `reboot_path` will not be set. #83

Closed liusida closed 4 months ago

liusida commented 4 months ago

When not using a virtual environment, __COMFY_CLI_SESSION__ will not be set, and reboot_path will not be set.

After setting up a venv, it behaves properly.

My question is, is this the desired behavior? Why does __COMFY_CLI_SESSION__ related to the functionality of reboot?

Thanks.

ltdrdata commented 4 months ago

COMFY_CLI_SESSION

That is to inform that it is being launched from comfy-cli in ComfyUI-Manager. The default deploy method for ComfyUI on Windows is the run_gpu.bat batch script and python_embedded.

The problem is that the run_gpu.bat batch script does not support restarting. Therefore, I have implemented a restart feature using sys.execv in ComfyUI-Manager.

However, using comfy-cli as the launcher can handle the restart process. The major advantage in this case is that by completely terminating and then restarting the process, it ensures a clean restart by fully releasing VRAM, which is not completely freed when rebooting with sys.execv.

Ask: What environment are you running? Did you try it with system Python in something like Docker?

liusida commented 4 months ago

What environment are you running? Did you try it with system Python in something like Docker?

Yes, I was on Ubuntu and running a docker container of image pytorch/pytorch:2.2.2-cuda12.1-cudnn8-runtime.

By default, it uses /opt/conda/python, and it is None for this line: https://github.com/yoland68/comfy-cli/blob/78b63fef9b0544254e7f37fc30fe64528f141eac/comfy_cli/cmdline.py#L487

so this line doesn't run: https://github.com/yoland68/comfy-cli/blob/78b63fef9b0544254e7f37fc30fe64528f141eac/comfy_cli/cmdline.py#L496

ltdrdata commented 4 months ago

What environment are you running? Did you try it with system Python in something like Docker?

Yes, I was on Ubuntu and running a docker container of image pytorch/pytorch:2.2.2-cuda12.1-cudnn8-runtime.

By default, it uses /opt/conda/python, and it is None for this line:

https://github.com/yoland68/comfy-cli/blob/78b63fef9b0544254e7f37fc30fe64528f141eac/comfy_cli/cmdline.py#L487

so this line doesn't run:

https://github.com/yoland68/comfy-cli/blob/78b63fef9b0544254e7f37fc30fe64528f141eac/comfy_cli/cmdline.py#L496

I'll check it.

ltdrdata commented 4 months ago

That code was written when the launch command was initially created, and the config save path was located inside the venv. It is now unnecessary, so it has been removed.