Sync: devchat[main](a84dfe79) Merge pull request #409 from devchat-ai/improve-err-msg
This commit is contained in:
parent
f2367a3d01
commit
bb6a8ab548
@ -162,7 +162,7 @@ devchat/path.py,sha256=I_rASGjunCNBj6NxDd9j1APqc-COsRk8-HX9I6CEF8k,182
|
|||||||
devchat/prompt.py,sha256=ZMdyRE4WIidg46_S3-VwpZ6D52bVYpP5ANhzvSJyY8c,9492
|
devchat/prompt.py,sha256=ZMdyRE4WIidg46_S3-VwpZ6D52bVYpP5ANhzvSJyY8c,9492
|
||||||
devchat/store.py,sha256=-KHp0N9F0t2VjAVXcANJa6tusNZQnd8d5vY4tuPzIFA,11954
|
devchat/store.py,sha256=-KHp0N9F0t2VjAVXcANJa6tusNZQnd8d5vY4tuPzIFA,11954
|
||||||
devchat/tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4,sha256=Ijkht27pm96ZW3_3OFE-7xAPtR0YyTWXoRO8_-hlsqc,1681126
|
devchat/tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4,sha256=Ijkht27pm96ZW3_3OFE-7xAPtR0YyTWXoRO8_-hlsqc,1681126
|
||||||
devchat/utils.py,sha256=GdI7DovvEzeG6oKnn8R-siGeW0myfQ76X1tDAhEKELQ,7650
|
devchat/utils.py,sha256=ScQwBeWrxVcjP-5VbL7UGMKb7VV4KmyN39nhxNpCyxA,7914
|
||||||
devchat/workflow/README.md,sha256=a48aJE5X8vjgasI9lhJljlUjwLvn7vO7tlG0PFM67m0,201
|
devchat/workflow/README.md,sha256=a48aJE5X8vjgasI9lhJljlUjwLvn7vO7tlG0PFM67m0,201
|
||||||
devchat/workflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
devchat/workflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||||
devchat/workflow/__pycache__/__init__.cpython-38.pyc,,
|
devchat/workflow/__pycache__/__init__.cpython-38.pyc,,
|
||||||
@ -189,7 +189,7 @@ devchat/workflow/command/env.py,sha256=wXZc497GwSjWk8T37krTkxqyjUhWSAh0c0RCwmLzR
|
|||||||
devchat/workflow/command/list.py,sha256=MYX469XXazUzNkahXuTlIJYIf_r_t1RwGrKEfugY8HY,1228
|
devchat/workflow/command/list.py,sha256=MYX469XXazUzNkahXuTlIJYIf_r_t1RwGrKEfugY8HY,1228
|
||||||
devchat/workflow/command/run.py,sha256=tSdDeVNBtNt7xwn6Q3hgjsMZUbL0NPt2g3-fsVAUg9A,214
|
devchat/workflow/command/run.py,sha256=tSdDeVNBtNt7xwn6Q3hgjsMZUbL0NPt2g3-fsVAUg9A,214
|
||||||
devchat/workflow/command/update.py,sha256=7hmqqtJHpKZ2I03zQtT-aGvw63L5V0Lsmi-qe8ThjL4,761
|
devchat/workflow/command/update.py,sha256=7hmqqtJHpKZ2I03zQtT-aGvw63L5V0Lsmi-qe8ThjL4,761
|
||||||
devchat/workflow/env_manager.py,sha256=F2xBVXZ6CXe98nlD21rluoFDRcOe8Iak5aTB2b5f1h4,8361
|
devchat/workflow/env_manager.py,sha256=h5hPUfGrlG-8KMkfpVAuD_fvkS_myLi5s7jPf_uOyfs,8474
|
||||||
devchat/workflow/envs.py,sha256=-lVTLjWRMrb8RGVVlHgWKCiGZaojNdmycjHFT0ZKjEo,298
|
devchat/workflow/envs.py,sha256=-lVTLjWRMrb8RGVVlHgWKCiGZaojNdmycjHFT0ZKjEo,298
|
||||||
devchat/workflow/namespace.py,sha256=CaotAAcSwGINH871zXcs2frBlzuf-eZ2DMEIx_8uRUo,3880
|
devchat/workflow/namespace.py,sha256=CaotAAcSwGINH871zXcs2frBlzuf-eZ2DMEIx_8uRUo,3880
|
||||||
devchat/workflow/path.py,sha256=VOZbxZxUFYAgiD-FgXsLkSrKq4g_xyb0KLBIGuyvE8Y,1355
|
devchat/workflow/path.py,sha256=VOZbxZxUFYAgiD-FgXsLkSrKq4g_xyb0KLBIGuyvE8Y,1355
|
||||||
|
@ -22,6 +22,16 @@ def setup_logger(file_path: Optional[str] = None):
|
|||||||
logging.root.handlers = [handler]
|
logging.root.handlers = [handler]
|
||||||
|
|
||||||
|
|
||||||
|
def get_logging_file() -> Optional[str]:
|
||||||
|
"""
|
||||||
|
Get the file path of the global file log handler.
|
||||||
|
"""
|
||||||
|
for handler in logging.root.handlers:
|
||||||
|
if isinstance(handler, logging.FileHandler):
|
||||||
|
return handler.baseFilename
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_logger(name: str = None, handler: logging.Handler = None) -> logging.Logger:
|
def get_logger(name: str = None, handler: logging.Handler = None) -> logging.Logger:
|
||||||
local_logger = logging.getLogger(name)
|
local_logger = logging.getLogger(name)
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
from typing import Dict, Optional, Tuple
|
from typing import Dict, Optional, Tuple
|
||||||
|
|
||||||
from devchat.utils import get_logger
|
from devchat.utils import get_logger, get_logging_file
|
||||||
|
|
||||||
from .envs import MAMBA_BIN_PATH
|
from .envs import MAMBA_BIN_PATH
|
||||||
from .path import ENV_CACHE_DIR, MAMBA_PY_ENVS, MAMBA_ROOT
|
from .path import ENV_CACHE_DIR, MAMBA_PY_ENVS, MAMBA_ROOT
|
||||||
@ -94,6 +94,7 @@ class PyEnvManager:
|
|||||||
if not should_remove_old:
|
if not should_remove_old:
|
||||||
return py
|
return py
|
||||||
|
|
||||||
|
log_file = get_logging_file()
|
||||||
print("\n```Step\n# Setting up workflow environment\n", flush=True)
|
print("\n```Step\n# Setting up workflow environment\n", flush=True)
|
||||||
if should_remove_old:
|
if should_remove_old:
|
||||||
print(f"- Dependencies of {env_name} have been changed.", flush=True)
|
print(f"- Dependencies of {env_name} have been changed.", flush=True)
|
||||||
@ -104,11 +105,11 @@ class PyEnvManager:
|
|||||||
print(f"- Creating {env_name} with {py_version}...", flush=True)
|
print(f"- Creating {env_name} with {py_version}...", flush=True)
|
||||||
create_ok, msg = self.create(env_name, py_version)
|
create_ok, msg = self.create(env_name, py_version)
|
||||||
if not create_ok:
|
if not create_ok:
|
||||||
print(f"- Failed to create {env_name}", flush=True)
|
print(f"- Failed to create {env_name}.", flush=True)
|
||||||
|
print(f"\nFor more details, check {log_file}.", flush=True)
|
||||||
print("\n```", flush=True)
|
print("\n```", flush=True)
|
||||||
print(
|
print(
|
||||||
f"\n\nFailed to create {env_name}, the workflow will not run."
|
f"\n\nFailed to create {env_name}, the workflow will not run.",
|
||||||
f"\n\nPlease try again later.",
|
|
||||||
flush=True,
|
flush=True,
|
||||||
)
|
)
|
||||||
logger.warning(f"Failed to create {env_name}: {msg}")
|
logger.warning(f"Failed to create {env_name}: {msg}")
|
||||||
@ -121,11 +122,11 @@ class PyEnvManager:
|
|||||||
print(f"- Installing dependencies from {filename}...", flush=True)
|
print(f"- Installing dependencies from {filename}...", flush=True)
|
||||||
install_ok, msg = self.install(env_name, reqirements_file)
|
install_ok, msg = self.install(env_name, reqirements_file)
|
||||||
if not install_ok:
|
if not install_ok:
|
||||||
print(f"- Failed to install dependencies from {filename}", flush=True)
|
print(f"- Failed to install dependencies from {filename}.", flush=True)
|
||||||
|
print(f"\nFor more details, check {log_file}.", flush=True)
|
||||||
print("\n```", flush=True)
|
print("\n```", flush=True)
|
||||||
print(
|
print(
|
||||||
"\n\nFailed to install dependencies, the workflow will not run."
|
"\n\nFailed to install dependencies, the workflow will not run.",
|
||||||
"\n\nPlease try again later.",
|
|
||||||
flush=True,
|
flush=True,
|
||||||
)
|
)
|
||||||
logger.warning(f"Failed to install dependencies: {msg}")
|
logger.warning(f"Failed to install dependencies: {msg}")
|
||||||
@ -198,7 +199,7 @@ class PyEnvManager:
|
|||||||
"""
|
"""
|
||||||
is_exist = os.path.exists(os.path.join(MAMBA_PY_ENVS, env_name))
|
is_exist = os.path.exists(os.path.join(MAMBA_PY_ENVS, env_name))
|
||||||
if is_exist:
|
if is_exist:
|
||||||
return True
|
return True, ""
|
||||||
|
|
||||||
# create the environment
|
# create the environment
|
||||||
cmd = [
|
cmd = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user