Toan Quach пре 7 месеци
родитељ
комит
ed678d2506

+ 1 - 10
taipy/core/_orchestrator/_dispatcher/_development_job_dispatcher.py

@@ -12,8 +12,6 @@
 import datetime
 from typing import Optional
 
-from ...common._check_dependencies import _TAIPY_ENTERPRISE_CORE_MODULE, _using_enterprise
-from ...common._utils import _load_fct
 from ...job.job import Job
 from .._abstract_orchestrator import _AbstractOrchestrator
 from ._job_dispatcher import _JobDispatcher
@@ -48,13 +46,6 @@ class _DevelopmentJobDispatcher(_JobDispatcher):
             job (Job^): The job to submit on an executor with an available worker.
         """
         job.execution_started_at = datetime.datetime.now()
-        if _using_enterprise():
-            task_fct_wrapper = _load_fct(
-                _TAIPY_ENTERPRISE_CORE_MODULE + "._orchestrator._dispatcher._task_function_wrapper",
-                "_TaskFunctionWrapper",
-            )
-        else:
-            task_fct_wrapper = _TaskFunctionWrapper
-        rs = task_fct_wrapper(job.id, job.task).execute()
+        rs = _TaskFunctionWrapper(job.id, job.task).execute()
         self._update_job_status(job, rs)
         job.execution_ended_at = datetime.datetime.now()

+ 1 - 12
taipy/core/_orchestrator/_dispatcher/_standalone_job_dispatcher.py

@@ -19,8 +19,6 @@ from typing import Callable, Optional
 from taipy.config._serializer._toml_serializer import _TomlSerializer
 from taipy.config.config import Config
 
-from ...common._check_dependencies import _TAIPY_ENTERPRISE_CORE_MODULE, _using_enterprise
-from ...common._utils import _load_fct
 from ...job.job import Job
 from .._abstract_orchestrator import _AbstractOrchestrator
 from ._job_dispatcher import _JobDispatcher
@@ -64,16 +62,7 @@ class _StandaloneJobDispatcher(_JobDispatcher):
         config_as_string = _TomlSerializer()._serialize(Config._applied_config)  # type: ignore[attr-defined]
 
         job.execution_started_at = datetime.datetime.now()
-
-        if _using_enterprise():
-            task_fct_wrapper = _load_fct(
-                _TAIPY_ENTERPRISE_CORE_MODULE + "._orchestrator._dispatcher._task_function_wrapper",
-                "_TaskFunctionWrapper",
-            )
-        else:
-            task_fct_wrapper = _TaskFunctionWrapper
-
-        future = self._executor.submit(task_fct_wrapper(job.id, job.task), config_as_string=config_as_string)
+        future = self._executor.submit(_TaskFunctionWrapper(job.id, job.task), config_as_string=config_as_string)
         future.add_done_callback(partial(self._update_job_status_from_future, job))
 
     def _update_job_status_from_future(self, job: Job, ft):

+ 5 - 3
taipy/core/_orchestrator/_orchestrator_factory.py

@@ -50,14 +50,16 @@ class _OrchestratorFactory:
     def _build_dispatcher(cls, force_restart=False) -> Optional[_JobDispatcher]:
         if not cls._orchestrator:
             raise OrchestratorNotBuilt
-        if Config.job_config.is_standalone:
+
+        if util.find_spec(cls._TAIPY_ENTERPRISE_MODULE):
+            cls.__build_enterprise_job_dispatcher(force_restart=force_restart)
+        elif Config.job_config.is_standalone:
             cls.__build_standalone_job_dispatcher(force_restart=force_restart)
         elif Config.job_config.is_development:
             cls.__build_development_job_dispatcher()
-        elif util.find_spec(cls._TAIPY_ENTERPRISE_MODULE):
-            cls.__build_enterprise_job_dispatcher(force_restart=force_restart)
         else:
             raise ModeNotAvailable(f"Job mode {Config.job_config.mode} is not available.")
+
         return cls._dispatcher
 
     @classmethod