mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-07 19:34:04 +00:00
chore: Import cloudpickle Optional
This commit is contained in:
parent
f8ce7d4580
commit
9042ee238d
@ -36,7 +36,7 @@ def initialize_components(
|
|||||||
system_app.register(
|
system_app.register(
|
||||||
DefaultExecutorFactory, max_workers=param.default_thread_pool_size
|
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_instance(controller)
|
||||||
system_app.register(ConnectorManager)
|
system_app.register(ConnectorManager)
|
||||||
|
|
||||||
|
@ -2,12 +2,12 @@ import inspect
|
|||||||
from io import StringIO
|
from io import StringIO
|
||||||
from typing import Any, Dict, Optional, TextIO
|
from typing import Any, Dict, Optional, TextIO
|
||||||
|
|
||||||
import cloudpickle
|
|
||||||
|
|
||||||
|
|
||||||
def check_serializable(
|
def check_serializable(
|
||||||
obj: Any, obj_name: str = "Object", error_msg: str = "Object is not serializable"
|
obj: Any, obj_name: str = "Object", error_msg: str = "Object is not serializable"
|
||||||
):
|
):
|
||||||
|
import cloudpickle
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cloudpickle.dumps(obj)
|
cloudpickle.dumps(obj)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -27,6 +27,8 @@ class SerializabilityInspector:
|
|||||||
self.stream.write(f"{indent}{message}\n")
|
self.stream.write(f"{indent}{message}\n")
|
||||||
|
|
||||||
def inspect(self, obj: Any, name: str, depth: int = 3) -> bool:
|
def inspect(self, obj: Any, name: str, depth: int = 3) -> bool:
|
||||||
|
import cloudpickle
|
||||||
|
|
||||||
self.log(f"Inspecting '{name}'")
|
self.log(f"Inspecting '{name}'")
|
||||||
self.indent_level += 1
|
self.indent_level += 1
|
||||||
|
|
||||||
|
25
setup.py
25
setup.py
@ -190,6 +190,11 @@ def get_cpu_avx_support() -> Tuple[OSType, AVXType]:
|
|||||||
print("Current platform is windows, use avx2 as default cpu architecture")
|
print("Current platform is windows, use avx2 as default cpu architecture")
|
||||||
elif system == "Linux":
|
elif system == "Linux":
|
||||||
os_type = OSType.LINUX
|
os_type = OSType.LINUX
|
||||||
|
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(
|
result = subprocess.run(
|
||||||
["lscpu"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
["lscpu"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||||
)
|
)
|
||||||
@ -443,6 +448,7 @@ def core_requires():
|
|||||||
"termcolor",
|
"termcolor",
|
||||||
# https://github.com/eosphoros-ai/DB-GPT/issues/551
|
# https://github.com/eosphoros-ai/DB-GPT/issues/551
|
||||||
# TODO: remove pandas dependency
|
# TODO: remove pandas dependency
|
||||||
|
# alpine can't install pandas by default
|
||||||
"pandas==2.0.3",
|
"pandas==2.0.3",
|
||||||
# numpy should less than 2.0.0
|
# numpy should less than 2.0.0
|
||||||
"numpy>=1.21.0,<2.0.0",
|
"numpy>=1.21.0,<2.0.0",
|
||||||
@ -459,6 +465,8 @@ def core_requires():
|
|||||||
"SQLAlchemy>=2.0.25,<2.0.29",
|
"SQLAlchemy>=2.0.25,<2.0.29",
|
||||||
# for cache
|
# for cache
|
||||||
"msgpack",
|
"msgpack",
|
||||||
|
# for AWEL operator serialization
|
||||||
|
"cloudpickle",
|
||||||
# for cache
|
# for cache
|
||||||
# TODO: pympler has not been updated for a long time and needs to
|
# TODO: pympler has not been updated for a long time and needs to
|
||||||
# find a new toolkit.
|
# find a new toolkit.
|
||||||
@ -500,6 +508,22 @@ def core_requires():
|
|||||||
"graphviz",
|
"graphviz",
|
||||||
# For security
|
# For security
|
||||||
"cryptography",
|
"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()
|
core_requires()
|
||||||
|
code_execution_requires()
|
||||||
torch_requires()
|
torch_requires()
|
||||||
llama_cpp_requires()
|
llama_cpp_requires()
|
||||||
quantization_requires()
|
quantization_requires()
|
||||||
|
Loading…
Reference in New Issue
Block a user