BUG-Running Core Service twice will break Core without explaining why
AlexandreSajus opened this issue · comments
Description
I created a Core project from the scenario-management template. Following the Scenario Management Overview, I created a scenario on one of the pages. The problem with my approach is that it ran the Core Service twice (tp.Core().run()
), once in main and once on the page. When I tried to execute my scenario from the Core GUI element, it would report that all the nodes were not found:
I could not find a way to debug this until the almighty God above us all, Mr. Jacta, looked at my code and found out that I had committed the ultimate sin: running the Core service twice.
How to reproduce
Kind of hard to reproduce but try to load a scenario using GUI Core Elements while running Core service twice, once in main and once on the page.
Expected behavior
There should be a red warning when running Core service twice so the user can debug this himself.
Runtime environment
- Taipy version: 3.0.0.dev3
- OS: Windows 11
Are you running the Core service on 2 different folders?
Are you running the Core service on 2 different folders?
Yes, once in pages/Drift/Drift.py and once in main.py
Why do you run the Core service on a dedicated page?
You want to run it only once with the gui in the main.py.
core = Core()
gui = Gui()
taipy.run(core, gui)
We should handle your use case in a log message or even by raising an error.
I ran the service twice instinctively when following the scenario management tutorial with the scenario-management template. Yes, I agree. I don't think this needs a fix. This is more about warning the user that he ran the service twice and that it might induce errors.
I know what the problem might be. We can work on adding a warning
Oh, so everything works properly... unfortunately.
We should definitely raise an error when running the Core service twice.