|
@@ -9,11 +9,11 @@
|
|
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
# specific language governing permissions and limitations under the License.
|
|
# specific language governing permissions and limitations under the License.
|
|
import typing
|
|
import typing
|
|
-from importlib import util
|
|
|
|
from typing import Optional, Type
|
|
from typing import Optional, Type
|
|
|
|
|
|
from taipy.config.config import Config
|
|
from taipy.config.config import Config
|
|
|
|
|
|
|
|
+from ..common._check_dependencies import _TAIPY_ENTERPRISE_MODULE, _using_enterprise
|
|
from ..common._utils import _load_fct
|
|
from ..common._utils import _load_fct
|
|
from ..exceptions.exceptions import ModeNotAvailable, OrchestratorNotBuilt
|
|
from ..exceptions.exceptions import ModeNotAvailable, OrchestratorNotBuilt
|
|
from ._abstract_orchestrator import _AbstractOrchestrator
|
|
from ._abstract_orchestrator import _AbstractOrchestrator
|
|
@@ -22,7 +22,6 @@ from ._orchestrator import _Orchestrator
|
|
|
|
|
|
|
|
|
|
class _OrchestratorFactory:
|
|
class _OrchestratorFactory:
|
|
- _TAIPY_ENTERPRISE_MODULE = "taipy.enterprise"
|
|
|
|
_TAIPY_ENTERPRISE_CORE_ORCHESTRATOR_MODULE = _TAIPY_ENTERPRISE_MODULE + ".core._orchestrator._orchestrator"
|
|
_TAIPY_ENTERPRISE_CORE_ORCHESTRATOR_MODULE = _TAIPY_ENTERPRISE_MODULE + ".core._orchestrator._orchestrator"
|
|
_TAIPY_ENTERPRISE_CORE_DISPATCHER_MODULE = _TAIPY_ENTERPRISE_MODULE + ".core._orchestrator._dispatcher"
|
|
_TAIPY_ENTERPRISE_CORE_DISPATCHER_MODULE = _TAIPY_ENTERPRISE_MODULE + ".core._orchestrator._dispatcher"
|
|
__TAIPY_ENTERPRISE_BUILD_DISPATCHER_METHOD = "_build_dispatcher"
|
|
__TAIPY_ENTERPRISE_BUILD_DISPATCHER_METHOD = "_build_dispatcher"
|
|
@@ -34,7 +33,7 @@ class _OrchestratorFactory:
|
|
def _build_orchestrator(cls) -> Type[_AbstractOrchestrator]:
|
|
def _build_orchestrator(cls) -> Type[_AbstractOrchestrator]:
|
|
if cls._orchestrator:
|
|
if cls._orchestrator:
|
|
return cls._orchestrator # type: ignore
|
|
return cls._orchestrator # type: ignore
|
|
- if util.find_spec(cls._TAIPY_ENTERPRISE_MODULE) is not None:
|
|
|
|
|
|
+ if _using_enterprise():
|
|
cls._orchestrator = _load_fct(
|
|
cls._orchestrator = _load_fct(
|
|
cls._TAIPY_ENTERPRISE_CORE_ORCHESTRATOR_MODULE,
|
|
cls._TAIPY_ENTERPRISE_CORE_ORCHESTRATOR_MODULE,
|
|
"Orchestrator",
|
|
"Orchestrator",
|
|
@@ -51,7 +50,7 @@ class _OrchestratorFactory:
|
|
if not cls._orchestrator:
|
|
if not cls._orchestrator:
|
|
raise OrchestratorNotBuilt
|
|
raise OrchestratorNotBuilt
|
|
|
|
|
|
- if util.find_spec(cls._TAIPY_ENTERPRISE_MODULE):
|
|
|
|
|
|
+ if _using_enterprise():
|
|
cls.__build_enterprise_job_dispatcher(force_restart=force_restart)
|
|
cls.__build_enterprise_job_dispatcher(force_restart=force_restart)
|
|
elif Config.job_config.is_standalone:
|
|
elif Config.job_config.is_standalone:
|
|
cls.__build_standalone_job_dispatcher(force_restart=force_restart)
|
|
cls.__build_standalone_job_dispatcher(force_restart=force_restart)
|
|
@@ -77,7 +76,7 @@ class _OrchestratorFactory:
|
|
else:
|
|
else:
|
|
return
|
|
return
|
|
|
|
|
|
- if util.find_spec(cls._TAIPY_ENTERPRISE_MODULE) is not None:
|
|
|
|
|
|
+ if _using_enterprise():
|
|
cls._dispatcher = _load_fct(
|
|
cls._dispatcher = _load_fct(
|
|
cls._TAIPY_ENTERPRISE_CORE_DISPATCHER_MODULE, cls.__TAIPY_ENTERPRISE_BUILD_DISPATCHER_METHOD
|
|
cls._TAIPY_ENTERPRISE_CORE_DISPATCHER_MODULE, cls.__TAIPY_ENTERPRISE_BUILD_DISPATCHER_METHOD
|
|
)(cls._orchestrator)
|
|
)(cls._orchestrator)
|
|
@@ -90,7 +89,7 @@ class _OrchestratorFactory:
|
|
if isinstance(cls._dispatcher, _StandaloneJobDispatcher):
|
|
if isinstance(cls._dispatcher, _StandaloneJobDispatcher):
|
|
cls._dispatcher.stop()
|
|
cls._dispatcher.stop()
|
|
|
|
|
|
- if util.find_spec(cls._TAIPY_ENTERPRISE_MODULE) is not None:
|
|
|
|
|
|
+ if _using_enterprise():
|
|
cls._dispatcher = _load_fct(
|
|
cls._dispatcher = _load_fct(
|
|
cls._TAIPY_ENTERPRISE_CORE_DISPATCHER_MODULE, cls.__TAIPY_ENTERPRISE_BUILD_DISPATCHER_METHOD
|
|
cls._TAIPY_ENTERPRISE_CORE_DISPATCHER_MODULE, cls.__TAIPY_ENTERPRISE_BUILD_DISPATCHER_METHOD
|
|
)(cls._orchestrator)
|
|
)(cls._orchestrator)
|