enhanced management of services

This commit is contained in:
Saifeddine ALOUI 2024-03-19 00:00:41 +01:00
parent 104dc4e004
commit 3193a46658
2 changed files with 5 additions and 4 deletions

View File

@ -162,10 +162,10 @@ class LollmsComfyUI:
script_path = self.comfyui_folder / "main.py"
if share:
run_python_script_in_env("comfyui", str(script_path), cwd=self.comfyui_folder)
run_python_script_in_env("comfyui", str(script_path), cwd=self.comfyui_folder, wait=False)
# subprocess.Popen("conda activate " + str(script_path) +" --share", cwd=self.comfyui_folder)
else:
run_python_script_in_env("comfyui", str(script_path), cwd=self.comfyui_folder)
run_python_script_in_env("comfyui", str(script_path), cwd=self.comfyui_folder, wait=False)
# subprocess.Popen(script_path, cwd=self.comfyui_folder)
else:
ASCIIColors.info("Running on linux/MacOs")

View File

@ -74,7 +74,7 @@ def run_pip_in_env(env_name, pip_args, cwd=None):
#run_command(Commands.RUN, "-n", env_name, "python " + str(script_path), cwd=cwd)
def run_python_script_in_env(env_name, script_path, cwd=None):
def run_python_script_in_env(env_name, script_path, cwd=None, wait=True):
from conda.cli.python_api import run_command, Commands
import platform
# Set the current working directory if provided, otherwise use the current directory
@ -86,7 +86,8 @@ def run_python_script_in_env(env_name, script_path, cwd=None):
process = subprocess.Popen(f'{python_path} {script_path}', shell=True)
# Wait for the process to finish
process.wait()
if wait:
process.wait()
#subprocess.Popen(f'conda activate {env_name} && {script_path}', shell=True, cwd=cwd)
#run_command(Commands.RUN, "-n", env_name, "python " + str(script_path), cwd=cwd)