Closed trgiangdo closed 1 year ago
current status: ✅
Overall Coverage
Lines Covered Coverage Threshold Status 7370 7081 96% 85% 🟢 New Files
No new covered files...
Modified Files
File Coverage Status src/taipy/core/_repository/_filesystem_repository.py 97% 🟢 src/taipy/core/common/_utils.py 100% 🟢 src/taipy/core/common/typing.py 100% 🟢 src/taipy/core/config/core_section.py 97% 🟢 src/taipy/core/exceptions/exceptions.py 91% 🟢 TOTAL 97% 🟢 updated for commit:
966f002
by action🐍
0.5s is also kinda long IMO, for decent computer storage should be pretty fast, 0.2s seem more reasonable for me for almost "instant" feedback.
Agree. A 0.1 or 0.2 seconds sleep should be enough
There is something I don't understand.
We changed the default Core config to set the retry nb to 3. Right? Before the change, it was not by default in Core but it was set to 3 in Taipy Core viz elements library.
So, in the end, I don't understand why the behavior is different. It should be the exact same behavior from the Core viz elements standpoint.
As I understand, the read_entity_retry
was set to 3 in src/taipy/gui_core/GuiCoreLib.py
in taipy.
In src/taipy/__init__.py
, Core is initialized before GuiCoreLib, so probably setting the read_entity_retry
did not take effect at all (because the value of Config.global_config.read_entity_retry is already passed to the wrapper).
Which is really weird
@toan-quach @jrobinAV I implemented Toan's idea, however, there was an issue.
The _load()
method always need to raise the ModelNotFound exception when there is an error (for the _Manager_get()
method).
If we modify the catch on manager level, it can cause hidden bug (since we have multiple repository types).
Instead, I notice that we only want to retry_read_entity when reading a file. So I split the responsibility to a separate private method, and only retry at that level.
There is 1 more question remains: Do we only retry when the file can not be read, or do we also retry when the file doesn't exist?
Please let me know what you think.
There is 1 more question remains: Do we only retry when the file can not be read, or do we also retry when the file doesn't exist?
I believe only when the file exists and cannot be read. There is no point retrying when the file does not exist yet.
Thx,
https://github.com/Avaiga/taipy-core/issues/697
The issue is that when creating the first scenario on FS repository, several necessary files are not created yet, which makes the
_load()
method raises theModelNotFound
exception.And since the default
read_entity_retry
value is 3, it would take about 2-3 seconds to finish creating the scenario, based on how many exception raised.However, when creating the second scenario, it will be just fine.
Test code:
Result:
You can see that in the result, the time to create scenario_2 is 0.03 second, which is just fine.
There are 2 possible solutions that I can think of.
json.JSONDecodeError
, which was raised by Fred a while ago. (The exception that is causing the performance issue isModelNotFound
, which is catch at the_Manager._get()
method). This is also what I implemented.read_entity_retry
to 1, and maybe reduce the sleep time (0.5s maybe too long, idk). This will let the creation performance of the first scenario be worse than the next. It won't be too long anyway.