mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2025-12-19 14:01:20 +00:00
add: prcxi res
fix: startup slow
This commit is contained in:
@@ -53,7 +53,7 @@ class Registry:
|
||||
# 其他状态变量
|
||||
# self.is_host_mode = False # 移至BasicConfig中
|
||||
|
||||
def setup(self, complete_registry=False):
|
||||
def setup(self, complete_registry=False, upload_registry=False):
|
||||
# 检查是否已调用过setup
|
||||
if self._setup_called:
|
||||
logger.critical("[UniLab Registry] setup方法已被调用过,不允许多次调用")
|
||||
@@ -160,14 +160,14 @@ class Registry:
|
||||
sys.path.append(str(sys_path))
|
||||
self.load_device_types(path, complete_registry)
|
||||
if BasicConfig.enable_resource_load:
|
||||
self.load_resource_types(path, complete_registry)
|
||||
self.load_resource_types(path, complete_registry, upload_registry)
|
||||
else:
|
||||
logger.warning("跳过了资源注册表加载!")
|
||||
logger.info("[UniLab Registry] 注册表设置完成")
|
||||
# 标记setup已被调用
|
||||
self._setup_called = True
|
||||
|
||||
def load_resource_types(self, path: os.PathLike, complete_registry: bool):
|
||||
def load_resource_types(self, path: os.PathLike, complete_registry: bool, upload_registry: bool):
|
||||
abs_path = Path(path).absolute()
|
||||
resource_path = abs_path / "resources"
|
||||
files = list(resource_path.glob("*/*.yaml"))
|
||||
@@ -194,7 +194,12 @@ class Registry:
|
||||
resource_info["handles"] = []
|
||||
if "init_param_schema" not in resource_info:
|
||||
resource_info["init_param_schema"] = {}
|
||||
if complete_registry:
|
||||
if "config_info" in resource_info:
|
||||
del resource_info["config_info"]
|
||||
if "file_path" in resource_info:
|
||||
del resource_info["file_path"]
|
||||
complete_data[resource_id] = copy.deepcopy(dict(sorted(resource_info.items())))
|
||||
if upload_registry:
|
||||
class_info = resource_info.get("class", {})
|
||||
if len(class_info) and "module" in class_info:
|
||||
if class_info.get("type") == "pylabrobot":
|
||||
@@ -205,7 +210,6 @@ class Registry:
|
||||
res_instance = res_class(res_class.__name__)
|
||||
res_ulr = tree_to_list([resource_plr_to_ulab(res_instance)])
|
||||
resource_info["config_info"] = res_ulr
|
||||
complete_data[resource_id] = copy.deepcopy(dict(sorted(resource_info.items()))) # 稍后dump到文件
|
||||
resource_info["registry_type"] = "resource"
|
||||
resource_info["file_path"] = str(file.absolute()).replace("\\", "/")
|
||||
complete_data = dict(sorted(complete_data.items()))
|
||||
@@ -629,7 +633,7 @@ class Registry:
|
||||
lab_registry = Registry()
|
||||
|
||||
|
||||
def build_registry(registry_paths=None, complete_registry=False):
|
||||
def build_registry(registry_paths=None, complete_registry=False, upload_registry=False):
|
||||
"""
|
||||
构建或获取Registry单例实例
|
||||
|
||||
@@ -653,6 +657,6 @@ def build_registry(registry_paths=None, complete_registry=False):
|
||||
lab_registry.registry_paths.append(path)
|
||||
|
||||
# 初始化注册表
|
||||
lab_registry.setup(complete_registry)
|
||||
lab_registry.setup(complete_registry, upload_registry)
|
||||
|
||||
return lab_registry
|
||||
|
||||
@@ -4,9 +4,7 @@ hplc_plate:
|
||||
class:
|
||||
module: unilabos.devices.resource_container.container:PlateContainer
|
||||
type: python
|
||||
config_info: []
|
||||
description: HPLC板
|
||||
file_path: C:/Users/10230/PycharmProjects/Uni-Lab-OS/unilabos/registry/resources/common/resource_container.yaml
|
||||
handles: []
|
||||
icon: ''
|
||||
init_param_schema: {}
|
||||
@@ -28,9 +26,7 @@ plate_96_high:
|
||||
class:
|
||||
module: unilabos.devices.resource_container.container:PlateContainer
|
||||
type: python
|
||||
config_info: []
|
||||
description: 96孔板
|
||||
file_path: C:/Users/10230/PycharmProjects/Uni-Lab-OS/unilabos/registry/resources/common/resource_container.yaml
|
||||
handles: []
|
||||
icon: ''
|
||||
init_param_schema: {}
|
||||
@@ -52,9 +48,7 @@ tiprack_96_high:
|
||||
class:
|
||||
module: unilabos.devices.resource_container.container:TipRackContainer
|
||||
type: python
|
||||
config_info: []
|
||||
description: 96孔板
|
||||
file_path: C:/Users/10230/PycharmProjects/Uni-Lab-OS/unilabos/registry/resources/common/resource_container.yaml
|
||||
handles: []
|
||||
icon: ''
|
||||
init_param_schema: {}
|
||||
|
||||
@@ -4,9 +4,7 @@ OTDeck:
|
||||
class:
|
||||
module: pylabrobot.resources.opentrons.deck:OTDeck
|
||||
type: pylabrobot
|
||||
config_info: []
|
||||
description: Opentrons deck
|
||||
file_path: C:/Users/10230/PycharmProjects/Uni-Lab-OS/unilabos/registry/resources/opentrons/deck.yaml
|
||||
handles: []
|
||||
icon: ''
|
||||
init_param_schema: {}
|
||||
@@ -21,9 +19,7 @@ hplc_station:
|
||||
class:
|
||||
module: unilabos.devices.resource_container.container:DeckContainer
|
||||
type: python
|
||||
config_info: []
|
||||
description: hplc_station deck
|
||||
file_path: C:/Users/10230/PycharmProjects/Uni-Lab-OS/unilabos/registry/resources/opentrons/deck.yaml
|
||||
handles: []
|
||||
icon: ''
|
||||
init_param_schema: {}
|
||||
|
||||
@@ -4,34 +4,7 @@ Opentrons_96_adapter_Vb:
|
||||
class:
|
||||
module: pylabrobot.resources.opentrons.plate_adapters:Opentrons_96_adapter_Vb
|
||||
type: pylabrobot
|
||||
config_info:
|
||||
- children: []
|
||||
class: ''
|
||||
config:
|
||||
barcode: null
|
||||
category: plate_adapter
|
||||
model: Opentrons_96_adapter_Vb
|
||||
rotation:
|
||||
type: Rotation
|
||||
x: 0
|
||||
y: 0
|
||||
z: 0
|
||||
size_x: 127.76
|
||||
size_y: 85.48
|
||||
size_z: 18.55
|
||||
type: PlateAdapter
|
||||
data: {}
|
||||
id: Opentrons_96_adapter_Vb
|
||||
name: Opentrons_96_adapter_Vb
|
||||
parent: null
|
||||
position:
|
||||
x: 0
|
||||
y: 0
|
||||
z: 0
|
||||
sample_id: null
|
||||
type: container
|
||||
description: Opentrons 96 adapter Vb
|
||||
file_path: C:/Users/10230/PycharmProjects/Uni-Lab-OS/unilabos/registry/resources/opentrons/plate_adapters.yaml
|
||||
handles: []
|
||||
icon: ''
|
||||
init_param_schema: {}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -4,9 +4,7 @@ container:
|
||||
class:
|
||||
module: unilabos.resources.container:RegularContainer
|
||||
type: unilabos
|
||||
config_info: []
|
||||
description: regular organic container
|
||||
file_path: C:/Users/10230/PycharmProjects/Uni-Lab-OS/unilabos/registry/resources/organic/container.yaml
|
||||
handles:
|
||||
- data_key: fluid_in
|
||||
data_source: handle
|
||||
|
||||
12
unilabos/registry/resources/prcxi/plates.yaml
Normal file
12
unilabos/registry/resources/prcxi/plates.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
prcxi_96_wellplate_360ul_flat:
|
||||
category:
|
||||
- plates
|
||||
class:
|
||||
module: unilabos.devices.liquid_handling.prcxi.prcxi_res:prcxi_96_wellplate_360ul_flat
|
||||
type: pylabrobot
|
||||
description: prcxi_96_wellplate_360ul_flat
|
||||
handles: []
|
||||
icon: ''
|
||||
init_param_schema: {}
|
||||
registry_type: resource
|
||||
version: 1.0.0
|
||||
12
unilabos/registry/resources/prcxi/tip_racks.yaml
Normal file
12
unilabos/registry/resources/prcxi/tip_racks.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
prcxi_opentrons_96_tiprack_10ul:
|
||||
category:
|
||||
- tip_racks
|
||||
class:
|
||||
module: unilabos.devices.liquid_handling.prcxi.prcxi_res:prcxi_opentrons_96_tiprack_10ul
|
||||
type: pylabrobot
|
||||
description: prcxi_opentrons_96_tiprack_10ul
|
||||
handles: []
|
||||
icon: ''
|
||||
init_param_schema: {}
|
||||
registry_type: resource
|
||||
version: 1.0.0
|
||||
12
unilabos/registry/resources/prcxi/trash.yaml
Normal file
12
unilabos/registry/resources/prcxi/trash.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
prcxi_trash:
|
||||
category:
|
||||
- trash
|
||||
class:
|
||||
module: unilabos.devices.liquid_handling.prcxi.prcxi_res:prcxi_trash
|
||||
type: pylabrobot
|
||||
description: prcxi_trash
|
||||
handles: []
|
||||
icon: ''
|
||||
init_param_schema: {}
|
||||
registry_type: resource
|
||||
version: 1.0.0
|
||||
Reference in New Issue
Block a user