Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

BUG-Error when loading a config with no storage type #464

Closed
FlorianJacta opened this issue Feb 3, 2023 · 0 comments
Closed

BUG-Error when loading a config with no storage type #464

FlorianJacta opened this issue Feb 3, 2023 · 0 comments
Assignees

Comments

@FlorianJacta
Copy link
Member

Description

An error is raised when trying to load a Config TOML file that 'should be working'. It comes from the fact that no storage type has been written in the Config file for Data Nodes. No issue is raised when storage_type = "pickle" are added to the Config for Data Nodes.

This is the error:

Traceback (most recent call last):
  File "C:\Users\jacta\AppData\Local\R-MINI~1\envs\tp_2_1\Lib\site-packages\taipy\core\data\_data_manager.py", line 78, in __create
    return cls.__DATA_NODE_CLASS_MAP[data_node_config.storage_type](  # type: ignore
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\jacta\Desktop\Stage\Avaiga\Code\taipy-getting-started-core-git\taipy-getting-started-core\src\step_01_toml.py", line 20, in <module>
    scenario = tp.create_scenario(scenario_cfg)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jacta\AppData\Local\R-MINI~1\envs\tp_2_1\Lib\site-packages\taipy\core\taipy.py", line 437, in create_scenario
    return _ScenarioManagerFactory._build_manager()._create(config, creation_date, name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jacta\AppData\Local\R-MINI~1\envs\tp_2_1\Lib\site-packages\taipy\core\scenario\_scenario_manager.py", line 103, in _create
    pipelines = [
                ^
  File "C:\Users\jacta\AppData\Local\R-MINI~1\envs\tp_2_1\Lib\site-packages\taipy\core\scenario\_scenario_manager.py", line 104, in <listcomp>
    _PipelineManagerFactory._build_manager()._get_or_create(p_config, cycle.id if cycle else None, scenario_id)       
  File "C:\Users\jacta\AppData\Local\R-MINI~1\envs\tp_2_1\Lib\site-packages\taipy\core\pipeline\_pipeline_manager.py", line 86, in _get_or_create
    tasks = task_manager._bulk_get_or_create(pipeline_config.task_configs, cycle_id, scenario_id, pipeline_id)        
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jacta\AppData\Local\R-MINI~1\envs\tp_2_1\Lib\site-packages\taipy\core\task\_task_manager.py", line 57, in _bulk_get_or_create
    data_nodes = _DataManagerFactory._build_manager()._bulk_get_or_create(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jacta\AppData\Local\R-MINI~1\envs\tp_2_1\Lib\site-packages\taipy\core\data\_data_manager.py", line 57, in _bulk_get_or_create
    return {
           ^
  File "C:\Users\jacta\AppData\Local\R-MINI~1\envs\tp_2_1\Lib\site-packages\taipy\core\data\_data_manager.py", line 58, in <dictcomp>
    dn_config: data_nodes.get((dn_config, owner_id)) or cls._create_and_set(dn_config, owner_id, None)
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jacta\AppData\Local\R-MINI~1\envs\tp_2_1\Lib\site-packages\taipy\core\data\_data_manager.py", line 66, in _create_and_set
    data_node = cls.__create(data_node_config, owner_id, parent_ids)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jacta\AppData\Local\R-MINI~1\envs\tp_2_1\Lib\site-packages\taipy\core\data\_data_manager.py", line 88, in __create
    raise InvalidDataNodeType(data_node_config.storage_type)
taipy.core.exceptions.exceptions.InvalidDataNodeType: None

How to reproduce
config.toml file:

[TAIPY]

[DATA_NODE.input]
scope = "SCENARIO:SCOPE"
default_data = "21:int"

[DATA_NODE.output]
scope = "SCENARIO:SCOPE"

[TASK.double]
inputs = [ "input:SECTION",]
function = "__main__.double:function"
outputs = [ "output:SECTION",]
skippable = "False:bool"

[PIPELINE.my_pipeline]
tasks = [ "double:SECTION",]

[SCENARIO.my_scenario]
pipelines = [ "my_pipeline:SECTION",]

[SCENARIO.my_scenario.comparators]

main.py file:

from taipy import Config
import taipy as tp

# Normal function used by Taipy
def double(nb):
    return nb * 2


Config.load('config.toml')

if __name__ == '__main__':    
    # my_scenario is the id of the scenario configured
    scenario_cfg = Config.scenarios['my_scenario']


    # Run of the Core
    tp.Core().run()

    # Creation of the scenario and execution
    scenario = tp.create_scenario(scenario_cfg)
    tp.submit(scenario)

    print("Value at the end of task", scenario.output.read())

Expected behavior
No error should be expected. The scenario should be created and run.

Runtime environment
Taipy Core & Config: 2.1

@toan-quach toan-quach self-assigned this Feb 7, 2023
toan-quach added a commit that referenced this issue Feb 8, 2023
…fig-error

bug/464 fix error mapping storage type is None to DATA_NODE_CLASS_MAP
toan-quach added a commit that referenced this issue Feb 8, 2023
…-type-None

[hotfix2.1] fix error mapping storage type when is None to DATA_NODE_CLASS_MAP
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants