Closed AlexandreSajus closed 4 months ago
From what I remember, you tried to use a generic Data Node right? And then, deleted the code to configure it?
Yes
Without a reproducible path, we cannot do much. Do you have a piece of code, a sequence of changes to exhibit the problem? Or at least a real stack trace?
You are right.
The code that triggers this issue is here: https://github.com/Avaiga/demo-mlp-regularization/tree/bug_lambda
When I ran it with my previous user_data and .taipy folder, it triggered this (I tried reproducing this exact trace but can't find a reliable way):
Traceback (most recent call last):
File "C:\Users\asaju\Desktop\demo-mlp-regularization\main.py", line 36, in <module>
core.run()
File "C:\Users\asaju\Desktop\demo-mlp-regularization\venv\Lib\site-packages\taipy\core\_core.py", line 63, in run
self._manage_version_and_block_config()
File "C:\Users\asaju\Desktop\demo-mlp-regularization\venv\Lib\site-packages\taipy\core\_core.py", line 100, in _manage_version_and_block_config
cls.__manage_version()
File "C:\Users\asaju\Desktop\demo-mlp-regularization\venv\Lib\site-packages\taipy\core\_core.py", line 110, in __manage_version
_VersionManagerFactory._build_manager()._manage_version()
File "C:\Users\asaju\Desktop\demo-mlp-regularization\venv\Lib\site-packages\taipy\core\_version\_version_manager.py", line 190, in _manage_version
clean_all_entities(current_version_number)
File "C:\Users\asaju\Desktop\demo-mlp-regularization\venv\Lib\site-packages\taipy\core\taipy.py", line 930, in clean_all_entities
_DataManagerFactory._build_manager()._delete_by_version(version_number)
File "C:\Users\asaju\Desktop\demo-mlp-regularization\venv\Lib\site-packages\taipy\core\data\_data_manager.py", line 164, in _delete_by_version
data_nodes = cls._get_all(version_number)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\asaju\Desktop\demo-mlp-regularization\venv\Lib\site-packages\taipy\core\data\_data_manager.py", line 113, in _get_all
return cls._repository._load_all(filters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\asaju\Desktop\demo-mlp-regularization\venv\Lib\site-packages\taipy\core\_repository\_filesystem_repository.py", line 87, in _load_all
entities.append(self.__file_content_to_entity(data))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\asaju\Desktop\demo-mlp-regularization\venv\Lib\site-packages\taipy\core\_repository\_filesystem_repository.py", line 228, in __file_content_to_entity
entity = self.converter._model_to_entity(model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\asaju\Desktop\demo-mlp-regularization\venv\Lib\site-packages\taipy\core\data\_data_converter.py", line 281, in _model_to_entity
data_node_properties = cls.__deserialize_generic_dn_properties(data_node_properties)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\asaju\Desktop\demo-mlp-regularization\venv\Lib\site-packages\taipy\core\data\_data_converter.py", line 170, in __deserialize_generic_dn_properties
datanode_model_properties[GenericDataNode._OPTIONAL_READ_FUNCTION_PROPERTY] = _load_fct(
^^^^^^^^^^
File "C:\Users\asaju\Desktop\demo-mlp-regularization\venv\Lib\site-packages\taipy\core\common\_utils.py", line 25, in _load_fct
return attrgetter(fct_name)(module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'config.config' has no attribute '<lambda>'
When I ran it after deleting user_data and .taipy, it triggers this:
Traceback (most recent call last):
File "C:\Users\asaju\Desktop\demo-mlp-regularization\main.py", line 39, in <module>
scenario = tp.create_scenario(default_scenario_cfg, name=f"alpha {alpha:.2f}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\asaju\Desktop\demo-mlp-regularization\venv\Lib\site-packages\taipy\core\taipy.py", line 860, in create_scenario
return _ScenarioManagerFactory._build_manager()._create(config, creation_date, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\asaju\Desktop\demo-mlp-regularization\venv\Lib\site-packages\taipy\core\scenario\_scenario_manager.py", line 127, in _create
_task_manager._bulk_get_or_create(config.task_configs, cycle_id, scenario_id) if config.task_configs else []
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\asaju\Desktop\demo-mlp-regularization\venv\Lib\site-packages\taipy\core\task\_task_manager.py", line 74, in _bulk_get_or_create
scope = min(dn.scope for dn in task_config_data_nodes) if len(task_config_data_nodes) != 0 else Scope.GLOBAL
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\asaju\Desktop\demo-mlp-regularization\venv\Lib\site-packages\taipy\core\task\_task_manager.py", line 74, in <genexpr>
scope = min(dn.scope for dn in task_config_data_nodes) if len(task_config_data_nodes) != 0 else Scope.GLOBAL
^^^^^^^^
File "C:\Users\asaju\Desktop\demo-mlp-regularization\venv\Lib\site-packages\taipy\core\data\data_node.py", line 293, in __getattr__
raise AttributeError(f"{attribute_name} is not an attribute of data node {self.id}")
AttributeError: scope is not an attribute of data node DATANODE_X_81f06841-45f4-40ae-8718-89668a4cf839. Did you mean: '_scope'?
Both traces are hard to debug as a solo since they start on core.run
or on tp.create_scenario
and the error messages are not very descriptive
OK, that's great. We'll have a look. Thx.
@AlexandreSajus I tried running main.py
but couldn't reproduce the error. Is there anything I should do to recreate it?
I have not found a reliable way to reproduce it. It was something about changing the configuration after a run. You can try running the code and switching between the develop and bug_lambda branches of this project: https://github.com/Avaiga/demo-mlp-regularization/tree/develop
@AlexandreSajus
For the lambda error, since you are using a lambda function for the read_fct, we cannot retrieve the function name and its module -> we couldn't serialize the function into the repository. This is not the practice we want to encourage 😅 Please try to create a new function for it, I know it's a pain but lambda has too much limitations for us to overcome 😓
As for the scope is not an attribute of data node
, seems to me that after converting the lambda function into a conventional function will do the trick also.
Can you try it out and let me know if it helps?
@AlexandreSajus please respond and give a path to resolution.
I unfortunately don't have the bandwidth to try this out. Toan's fix probably works. As for module "config.config" has no attribute "<lambda>"
, I still can't reproduce it. Feel free to close this issue
Sometimes Core will fail with Error
I can't reproduce it since I don't know what caused it and the error message tells me nothing. All I know is that you can fix it by deleting all
user_data
and.taipy
folders (only after losing an hour of your time trying to undo your changes). So it might have something to do with running the app with a config, changing the config, and running it again.Good luck