diff --git a/dbgpt/app/component_configs.py b/dbgpt/app/component_configs.py index 418d9eae1..e50ec5679 100644 --- a/dbgpt/app/component_configs.py +++ b/dbgpt/app/component_configs.py @@ -36,7 +36,7 @@ def initialize_components( system_app.register( DefaultExecutorFactory, max_workers=param.default_thread_pool_size ) - system_app.register(DefaultScheduler) + system_app.register(DefaultScheduler, scheduler_enable=CFG.SCHEDULER_ENABLED) system_app.register_instance(controller) system_app.register(ConnectorManager) diff --git a/dbgpt/util/serialization/check.py b/dbgpt/util/serialization/check.py index 10a86edb2..d10d308b7 100644 --- a/dbgpt/util/serialization/check.py +++ b/dbgpt/util/serialization/check.py @@ -2,12 +2,12 @@ import inspect from io import StringIO from typing import Any, Dict, Optional, TextIO -import cloudpickle - def check_serializable( obj: Any, obj_name: str = "Object", error_msg: str = "Object is not serializable" ): + import cloudpickle + try: cloudpickle.dumps(obj) except Exception as e: @@ -27,6 +27,8 @@ class SerializabilityInspector: self.stream.write(f"{indent}{message}\n") def inspect(self, obj: Any, name: str, depth: int = 3) -> bool: + import cloudpickle + self.log(f"Inspecting '{name}'") self.indent_level += 1 diff --git a/setup.py b/setup.py index 214f82f70..c92428207 100644 --- a/setup.py +++ b/setup.py @@ -190,10 +190,15 @@ def get_cpu_avx_support() -> Tuple[OSType, AVXType]: print("Current platform is windows, use avx2 as default cpu architecture") elif system == "Linux": os_type = OSType.LINUX - result = subprocess.run( - ["lscpu"], stdout=subprocess.PIPE, stderr=subprocess.PIPE - ) - output = result.stdout.decode() + if os.path.exists("/etc/alpine-release"): + # For Alpine, we'll check /proc/cpuinfo directly + with open("/proc/cpuinfo", "r") as f: + output = f.read() + else: + result = subprocess.run( + ["lscpu"], stdout=subprocess.PIPE, stderr=subprocess.PIPE + ) + output = result.stdout.decode() elif system == "Darwin": os_type = OSType.DARWIN result = subprocess.run( @@ -443,6 +448,7 @@ def core_requires(): "termcolor", # https://github.com/eosphoros-ai/DB-GPT/issues/551 # TODO: remove pandas dependency + # alpine can't install pandas by default "pandas==2.0.3", # numpy should less than 2.0.0 "numpy>=1.21.0,<2.0.0", @@ -459,6 +465,8 @@ def core_requires(): "SQLAlchemy>=2.0.25,<2.0.29", # for cache "msgpack", + # for AWEL operator serialization + "cloudpickle", # for cache # TODO: pympler has not been updated for a long time and needs to # find a new toolkit. @@ -500,6 +508,22 @@ def core_requires(): "graphviz", # For security "cryptography", + # For high performance RPC communication in code execution + "pyzmq", + ] + + +def code_execution_requires(): + """ + pip install "dbgpt[code]" + + Code execution dependencies. For building a docker image. + """ + setup_spec.extras["code"] = setup_spec.extras["core"] + [ + "pyzmq", + "msgpack", + # for AWEL operator serialization + "cloudpickle", ] @@ -715,6 +739,7 @@ def init_install_requires(): core_requires() +code_execution_requires() torch_requires() llama_cpp_requires() quantization_requires()