You've already forked DataMate
fix(dataset): 解决操作符查找失败时的错误处理
- 当操作符在任何注册表中都找不到时抛出ImportError异常 - 对无效的注册表内容类型抛出更具体的ImportError异常 - 提供更清晰的错误信息帮助用户诊断问题
This commit is contained in:
@@ -136,6 +136,10 @@ class RayDataset(BasicDataset):
|
||||
if registry_content is None:
|
||||
from core.base_op import OPERATORS as RELATIVE_OPERATORS
|
||||
registry_content = RELATIVE_OPERATORS.modules.get(op_name)
|
||||
|
||||
if registry_content is None:
|
||||
raise ImportError(f"Operator '{op_name}' not found in any registry. Please check if the operator name is correct.")
|
||||
|
||||
if isinstance(registry_content, str):
|
||||
# registry_content是module的路径
|
||||
submodule = importlib.import_module(registry_content)
|
||||
@@ -148,7 +152,7 @@ class RayDataset(BasicDataset):
|
||||
# registry_content是module本身
|
||||
res = registry_content
|
||||
else:
|
||||
res = None
|
||||
raise ImportError(f"Invalid registry content for operator '{op_name}': expected str or BaseOp subclass, got {type(registry_content)}")
|
||||
return res
|
||||
|
||||
def _run_single_op(self, operators_cls, init_kwargs, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user