diff --git a/api/core/workflow/nodes/base_node.py b/api/core/workflow/nodes/base_node.py index b83a0ae19..f42cee4cc 100644 --- a/api/core/workflow/nodes/base_node.py +++ b/api/core/workflow/nodes/base_node.py @@ -115,7 +115,7 @@ class BaseNode(ABC): ) @classmethod - def extract_variable_selector_to_variable_mapping(cls, config: dict) -> dict[str, list[str]]: + def extract_variable_selector_to_variable_mapping(cls, config: dict): """ Extract variable selector to variable mapping :param config: node config @@ -125,14 +125,13 @@ class BaseNode(ABC): return cls._extract_variable_selector_to_variable_mapping(node_data) @classmethod - @abstractmethod - def _extract_variable_selector_to_variable_mapping(cls, node_data: BaseNodeData) -> dict[str, list[str]]: + def _extract_variable_selector_to_variable_mapping(cls, node_data: BaseNodeData) -> Mapping[str, Sequence[str]]: """ Extract variable selector to variable mapping :param node_data: node data :return: """ - raise NotImplementedError + return {} @classmethod def get_default_config(cls, filters: Optional[dict] = None) -> dict: diff --git a/api/core/workflow/workflow_engine_manager.py b/api/core/workflow/workflow_engine_manager.py index c3b80c5b9..32f0dbba0 100644 --- a/api/core/workflow/workflow_engine_manager.py +++ b/api/core/workflow/workflow_engine_manager.py @@ -389,11 +389,10 @@ class WorkflowEngineManager: environment_variables=workflow.environment_variables, ) + if node_cls is None: + raise ValueError('Node class not found') # variable selector to variable mapping - try: - variable_mapping = node_cls.extract_variable_selector_to_variable_mapping(node_config) - except NotImplementedError: - variable_mapping = {} + variable_mapping = node_cls.extract_variable_selector_to_variable_mapping(node_config) self._mapping_user_inputs_to_variable_pool( variable_mapping=variable_mapping, @@ -473,10 +472,9 @@ class WorkflowEngineManager: for node_config in iteration_nested_nodes: # mapping user inputs to variable pool node_cls = node_classes.get(NodeType.value_of(node_config.get('data', {}).get('type'))) - try: - variable_mapping = node_cls.extract_variable_selector_to_variable_mapping(node_config) - except NotImplementedError: - variable_mapping = {} + if node_cls is None: + raise ValueError('Node class not found') + variable_mapping = node_cls.extract_variable_selector_to_variable_mapping(node_config) # remove iteration variables variable_mapping = { @@ -942,7 +940,7 @@ class WorkflowEngineManager: return new_value def _mapping_user_inputs_to_variable_pool(self, - variable_mapping: dict, + variable_mapping: Mapping[str, Sequence[str]], user_inputs: dict, variable_pool: VariablePool, tenant_id: str,