refactor(api/core/workflow/nodes/base_node.py): Update extract_variable_selector_to_variable_mapping method signature. (#6733)
Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
@@ -115,7 +115,7 @@ class BaseNode(ABC):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@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
|
Extract variable selector to variable mapping
|
||||||
:param config: node config
|
:param config: node config
|
||||||
@@ -125,14 +125,13 @@ class BaseNode(ABC):
|
|||||||
return cls._extract_variable_selector_to_variable_mapping(node_data)
|
return cls._extract_variable_selector_to_variable_mapping(node_data)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@abstractmethod
|
def _extract_variable_selector_to_variable_mapping(cls, node_data: BaseNodeData) -> Mapping[str, Sequence[str]]:
|
||||||
def _extract_variable_selector_to_variable_mapping(cls, node_data: BaseNodeData) -> dict[str, list[str]]:
|
|
||||||
"""
|
"""
|
||||||
Extract variable selector to variable mapping
|
Extract variable selector to variable mapping
|
||||||
:param node_data: node data
|
:param node_data: node data
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
return {}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_default_config(cls, filters: Optional[dict] = None) -> dict:
|
def get_default_config(cls, filters: Optional[dict] = None) -> dict:
|
||||||
|
@@ -389,11 +389,10 @@ class WorkflowEngineManager:
|
|||||||
environment_variables=workflow.environment_variables,
|
environment_variables=workflow.environment_variables,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if node_cls is None:
|
||||||
|
raise ValueError('Node class not found')
|
||||||
# variable selector to variable mapping
|
# variable selector to variable mapping
|
||||||
try:
|
|
||||||
variable_mapping = node_cls.extract_variable_selector_to_variable_mapping(node_config)
|
variable_mapping = node_cls.extract_variable_selector_to_variable_mapping(node_config)
|
||||||
except NotImplementedError:
|
|
||||||
variable_mapping = {}
|
|
||||||
|
|
||||||
self._mapping_user_inputs_to_variable_pool(
|
self._mapping_user_inputs_to_variable_pool(
|
||||||
variable_mapping=variable_mapping,
|
variable_mapping=variable_mapping,
|
||||||
@@ -473,10 +472,9 @@ class WorkflowEngineManager:
|
|||||||
for node_config in iteration_nested_nodes:
|
for node_config in iteration_nested_nodes:
|
||||||
# mapping user inputs to variable pool
|
# mapping user inputs to variable pool
|
||||||
node_cls = node_classes.get(NodeType.value_of(node_config.get('data', {}).get('type')))
|
node_cls = node_classes.get(NodeType.value_of(node_config.get('data', {}).get('type')))
|
||||||
try:
|
if node_cls is None:
|
||||||
|
raise ValueError('Node class not found')
|
||||||
variable_mapping = node_cls.extract_variable_selector_to_variable_mapping(node_config)
|
variable_mapping = node_cls.extract_variable_selector_to_variable_mapping(node_config)
|
||||||
except NotImplementedError:
|
|
||||||
variable_mapping = {}
|
|
||||||
|
|
||||||
# remove iteration variables
|
# remove iteration variables
|
||||||
variable_mapping = {
|
variable_mapping = {
|
||||||
@@ -942,7 +940,7 @@ class WorkflowEngineManager:
|
|||||||
return new_value
|
return new_value
|
||||||
|
|
||||||
def _mapping_user_inputs_to_variable_pool(self,
|
def _mapping_user_inputs_to_variable_pool(self,
|
||||||
variable_mapping: dict,
|
variable_mapping: Mapping[str, Sequence[str]],
|
||||||
user_inputs: dict,
|
user_inputs: dict,
|
||||||
variable_pool: VariablePool,
|
variable_pool: VariablePool,
|
||||||
tenant_id: str,
|
tenant_id: str,
|
||||||
|
Reference in New Issue
Block a user