Skip to content

Commit

Permalink
Merge pull request #711 from Avaiga/bugfix/orechestrator_init
Browse files Browse the repository at this point in the history
🐛 Fix orchestrator being initialised at each call
  • Loading branch information
gmarabout authored Jan 18, 2024
2 parents 1c5fbb6 + 961fc91 commit 98a3fdf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions taipy/core/_orchestrator/_orchestrator_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class _OrchestratorFactory:

@classmethod
def _build_orchestrator(cls) -> Type[_AbstractOrchestrator]:
if cls._orchestrator:
return cls._orchestrator # type: ignore
if util.find_spec(cls._TAIPY_ENTERPRISE_MODULE) is not None:
cls._orchestrator = _load_fct(
cls._TAIPY_ENTERPRISE_CORE_ORCHESTRATOR_MODULE,
Expand Down
1 change: 1 addition & 0 deletions tests/core/_orchestrator/test_orchestrator_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def test_build_orchestrator():
with mock.patch("taipy.core._orchestrator._orchestrator_factory._OrchestratorFactory._build_dispatcher") as bd:
with mock.patch("taipy.core._orchestrator._orchestrator._Orchestrator.initialize") as initialize:
orchestrator = _OrchestratorFactory._build_orchestrator()
_OrchestratorFactory._build_orchestrator() # Call it one more time!
assert orchestrator == _Orchestrator
assert _OrchestratorFactory._orchestrator == _Orchestrator
initialize.assert_called_once()
Expand Down

0 comments on commit 98a3fdf

Please sign in to comment.