Skip to content

Commit

Permalink
fix: should only check for children config_id when they exists and ar…
Browse files Browse the repository at this point in the history
…e proper Config objects
  • Loading branch information
trgiangdo committed Aug 8, 2024
1 parent 08135e9 commit 5c01851
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
34 changes: 18 additions & 16 deletions taipy/core/config/checkers/_scenario_config_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,24 @@ def _check(self) -> IssueCollector:
def _check_if_children_config_id_is_overlapping_with_properties(
self, scenario_config_id: str, scenario_config: ScenarioConfig
):
for task in scenario_config.tasks:
if task.id in scenario_config.properties:
self._error(
TaskConfig._ID_KEY,
task.id,
f"The id of the TaskConfig `{task.id}` is overlapping with the "
f"property `{task.id}` of ScenarioConfig `{scenario_config_id}`.",
)
for data_node in scenario_config.data_nodes:
if data_node.id in scenario_config.properties:
self._error(
DataNodeConfig._ID_KEY,
data_node.id,
f"The id of the DataNodeConfig `{data_node.id}` is overlapping with the "
f"property `{data_node.id}` of ScenarioConfig `{scenario_config_id}`.",
)
if scenario_config.tasks:
for task in scenario_config.tasks:
if isinstance(task, TaskConfig) and task.id in scenario_config.properties:
self._error(
TaskConfig._ID_KEY,
task.id,
f"The id of the TaskConfig `{task.id}` is overlapping with the "
f"property `{task.id}` of ScenarioConfig `{scenario_config_id}`.",
)
if scenario_config.data_nodes:
for data_node in scenario_config.data_nodes:
if isinstance(data_node, DataNodeConfig) and data_node.id in scenario_config.properties:
self._error(
DataNodeConfig._ID_KEY,
data_node.id,
f"The id of the DataNodeConfig `{data_node.id}` is overlapping with the "
f"property `{data_node.id}` of ScenarioConfig `{scenario_config_id}`.",
)

def _check_task_configs(self, scenario_config_id: str, scenario_config: ScenarioConfig):
self._check_children(
Expand Down
2 changes: 1 addition & 1 deletion taipy/core/config/checkers/_task_config_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def _check(self) -> IssueCollector:

def _check_if_children_config_id_is_overlapping_with_properties(self, task_config_id: str, task_config: TaskConfig):
for data_node in task_config.input_configs + task_config.output_configs:
if data_node.id in task_config.properties:
if isinstance(data_node, DataNodeConfig) and data_node.id in task_config.properties:
self._error(
DataNodeConfig._ID_KEY,
data_node.id,
Expand Down

0 comments on commit 5c01851

Please sign in to comment.