|
@@ -18,7 +18,6 @@ from taipy.config.common.scope import Scope
|
|
from taipy.logger._taipy_logger import _TaipyLogger
|
|
from taipy.logger._taipy_logger import _TaipyLogger
|
|
|
|
|
|
from ._entity._entity import _Entity
|
|
from ._entity._entity import _Entity
|
|
-from ._entity._reload import _get_manager
|
|
|
|
from ._version._version_manager_factory import _VersionManagerFactory
|
|
from ._version._version_manager_factory import _VersionManagerFactory
|
|
from .common._check_instance import (
|
|
from .common._check_instance import (
|
|
_is_cycle,
|
|
_is_cycle,
|
|
@@ -55,6 +54,7 @@ from .sequence.sequence import Sequence
|
|
from .sequence.sequence_id import SequenceId
|
|
from .sequence.sequence_id import SequenceId
|
|
from .submission._submission_manager_factory import _SubmissionManagerFactory
|
|
from .submission._submission_manager_factory import _SubmissionManagerFactory
|
|
from .submission.submission import Submission, SubmissionId
|
|
from .submission.submission import Submission, SubmissionId
|
|
|
|
+from .task._task_manager_factory import _TaskManagerFactory
|
|
from .task.task import Task
|
|
from .task.task import Task
|
|
from .task.task_id import TaskId
|
|
from .task.task_id import TaskId
|
|
|
|
|
|
@@ -71,15 +71,15 @@ def set(entity: Union[DataNode, Task, Sequence, Scenario, Cycle]):
|
|
entity to save or update.
|
|
entity to save or update.
|
|
"""
|
|
"""
|
|
if _is_cycle(entity):
|
|
if _is_cycle(entity):
|
|
- return _get_manager(Cycle._MANAGER_NAME)._set(entity)
|
|
|
|
|
|
+ return _CycleManagerFactory._build_manager()._set(entity)
|
|
if _is_scenario(entity):
|
|
if _is_scenario(entity):
|
|
- return _get_manager(Scenario._MANAGER_NAME)._set(entity)
|
|
|
|
|
|
+ return _ScenarioManagerFactory._build_manager()._set(entity)
|
|
if _is_sequence(entity):
|
|
if _is_sequence(entity):
|
|
- return _get_manager(Sequence._MANAGER_NAME)._set(entity)
|
|
|
|
|
|
+ return _SequenceManagerFactory._build_manager()._set(entity)
|
|
if _is_task(entity):
|
|
if _is_task(entity):
|
|
- return _get_manager(Task._MANAGER_NAME)._set(entity)
|
|
|
|
|
|
+ return _TaskManagerFactory._build_manager()._set(entity)
|
|
if _is_data_node(entity):
|
|
if _is_data_node(entity):
|
|
- return _get_manager(DataNode._MANAGER_NAME)._set(entity)
|
|
|
|
|
|
+ return _DataManagerFactory._build_manager()._set(entity)
|
|
|
|
|
|
|
|
|
|
def is_submittable(entity: Union[Scenario, ScenarioId, Sequence, SequenceId, Task, TaskId]) -> bool:
|
|
def is_submittable(entity: Union[Scenario, ScenarioId, Sequence, SequenceId, Task, TaskId]) -> bool:
|
|
@@ -91,11 +91,11 @@ def is_submittable(entity: Union[Scenario, ScenarioId, Sequence, SequenceId, Tas
|
|
True if the given entity can be submitted. False otherwise.
|
|
True if the given entity can be submitted. False otherwise.
|
|
"""
|
|
"""
|
|
if _is_scenario(entity):
|
|
if _is_scenario(entity):
|
|
- return _get_manager(Scenario._MANAGER_NAME)._is_submittable(entity) # type: ignore
|
|
|
|
|
|
+ return _ScenarioManagerFactory._build_manager()._is_submittable(entity)
|
|
if _is_sequence(entity):
|
|
if _is_sequence(entity):
|
|
- return _get_manager(Sequence._MANAGER_NAME)._is_submittable(entity) # type: ignore
|
|
|
|
|
|
+ return _SequenceManagerFactory._build_manager()._is_submittable(entity)
|
|
if _is_task(entity):
|
|
if _is_task(entity):
|
|
- return _get_manager(Task._MANAGER_NAME)._is_submittable(entity) # type: ignore
|
|
|
|
|
|
+ return _TaskManagerFactory._build_manager()._is_submittable(entity)
|
|
return False
|
|
return False
|
|
|
|
|
|
|
|
|
|
@@ -125,19 +125,19 @@ def is_editable(
|
|
True if the given entity can be edited. False otherwise.
|
|
True if the given entity can be edited. False otherwise.
|
|
"""
|
|
"""
|
|
if _is_cycle(entity):
|
|
if _is_cycle(entity):
|
|
- return _get_manager(Cycle._MANAGER_NAME)._is_editable(entity)
|
|
|
|
|
|
+ return _CycleManagerFactory._build_manager()._is_editable(entity)
|
|
if _is_scenario(entity):
|
|
if _is_scenario(entity):
|
|
- return _get_manager(Scenario._MANAGER_NAME)._is_editable(entity)
|
|
|
|
|
|
+ return _ScenarioManagerFactory._build_manager()._is_editable(entity)
|
|
if _is_sequence(entity):
|
|
if _is_sequence(entity):
|
|
- return _get_manager(Sequence._MANAGER_NAME)._is_editable(entity)
|
|
|
|
|
|
+ return _SequenceManagerFactory._build_manager()._is_editable(entity)
|
|
if _is_task(entity):
|
|
if _is_task(entity):
|
|
- return _get_manager(Task._MANAGER_NAME)._is_editable(entity)
|
|
|
|
|
|
+ return _TaskManagerFactory._build_manager()._is_editable(entity)
|
|
if _is_job(entity):
|
|
if _is_job(entity):
|
|
- return _get_manager(Job._MANAGER_NAME)._is_editable(entity)
|
|
|
|
|
|
+ return _JobManagerFactory._build_manager()._is_editable(entity)
|
|
if _is_data_node(entity):
|
|
if _is_data_node(entity):
|
|
- return _get_manager(DataNode._MANAGER_NAME)._is_editable(entity)
|
|
|
|
|
|
+ return _DataManagerFactory._build_manager()._is_editable(entity)
|
|
if _is_submission(entity):
|
|
if _is_submission(entity):
|
|
- return _get_manager(Submission._MANAGER_NAME)._is_editable(entity)
|
|
|
|
|
|
+ return _SubmissionManagerFactory._build_manager()._is_editable(entity)
|
|
return False
|
|
return False
|
|
|
|
|
|
|
|
|
|
@@ -167,19 +167,19 @@ def is_readable(
|
|
True if the given entity can be read. False otherwise.
|
|
True if the given entity can be read. False otherwise.
|
|
"""
|
|
"""
|
|
if _is_cycle(entity):
|
|
if _is_cycle(entity):
|
|
- return _get_manager(Cycle._MANAGER_NAME)._is_readable(entity)
|
|
|
|
|
|
+ return _CycleManagerFactory._build_manager()._is_readable(entity)
|
|
if _is_scenario(entity):
|
|
if _is_scenario(entity):
|
|
- return _get_manager(Scenario._MANAGER_NAME)._is_readable(entity)
|
|
|
|
|
|
+ return _ScenarioManagerFactory._build_manager()._is_readable(entity)
|
|
if _is_sequence(entity):
|
|
if _is_sequence(entity):
|
|
- return _get_manager(Sequence._MANAGER_NAME)._is_readable(entity)
|
|
|
|
|
|
+ return _SequenceManagerFactory._build_manager()._is_readable(entity)
|
|
if _is_task(entity):
|
|
if _is_task(entity):
|
|
- return _get_manager(Task._MANAGER_NAME)._is_readable(entity)
|
|
|
|
|
|
+ return _TaskManagerFactory._build_manager()._is_readable(entity)
|
|
if _is_job(entity):
|
|
if _is_job(entity):
|
|
- return _get_manager(Job._MANAGER_NAME)._is_readable(entity)
|
|
|
|
|
|
+ return _JobManagerFactory._build_manager()._is_readable(entity)
|
|
if _is_data_node(entity):
|
|
if _is_data_node(entity):
|
|
- return _get_manager(DataNode._MANAGER_NAME)._is_readable(entity)
|
|
|
|
|
|
+ return _DataManagerFactory._build_manager()._is_readable(entity)
|
|
if _is_submission(entity):
|
|
if _is_submission(entity):
|
|
- return _get_manager(Submission._MANAGER_NAME)._is_readable(entity)
|
|
|
|
|
|
+ return _SubmissionManagerFactory._build_manager()._is_readable(entity)
|
|
return False
|
|
return False
|
|
|
|
|
|
|
|
|
|
@@ -212,15 +212,11 @@ def submit(
|
|
- If a `Task^` is provided, it will return the created `Job^`.
|
|
- If a `Task^` is provided, it will return the created `Job^`.
|
|
"""
|
|
"""
|
|
if _is_scenario(entity):
|
|
if _is_scenario(entity):
|
|
- return _get_manager(Scenario._MANAGER_NAME)._submit( # type: ignore
|
|
|
|
- entity, force=force, wait=wait, timeout=timeout
|
|
|
|
- )
|
|
|
|
|
|
+ return _ScenarioManagerFactory._build_manager()._submit(entity, force=force, wait=wait, timeout=timeout)
|
|
if _is_sequence(entity):
|
|
if _is_sequence(entity):
|
|
- return _get_manager(Sequence._MANAGER_NAME)._submit( # type: ignore
|
|
|
|
- entity, force=force, wait=wait, timeout=timeout
|
|
|
|
- )
|
|
|
|
|
|
+ return _SequenceManagerFactory._build_manager()._submit(entity, force=force, wait=wait, timeout=timeout)
|
|
if _is_task(entity):
|
|
if _is_task(entity):
|
|
- return _get_manager(Task._MANAGER_NAME)._submit(entity, force=force, wait=wait, timeout=timeout) # type: ignore
|
|
|
|
|
|
+ return _TaskManagerFactory._build_manager()._submit(entity, force=force, wait=wait, timeout=timeout)
|
|
return None
|
|
return None
|
|
|
|
|
|
|
|
|
|
@@ -288,19 +284,19 @@ def exists(entity_id: Union[TaskId, DataNodeId, SequenceId, ScenarioId, JobId, C
|
|
based on their respective identifier prefixes.
|
|
based on their respective identifier prefixes.
|
|
"""
|
|
"""
|
|
if _is_job(entity_id):
|
|
if _is_job(entity_id):
|
|
- return _get_manager(Job._MANAGER_NAME)._exists(JobId(entity_id))
|
|
|
|
|
|
+ return _JobManagerFactory._build_manager()._exists(JobId(entity_id))
|
|
if _is_cycle(entity_id):
|
|
if _is_cycle(entity_id):
|
|
- return _get_manager(Cycle._MANAGER_NAME)._exists(CycleId(entity_id))
|
|
|
|
|
|
+ return _CycleManagerFactory._build_manager()._exists(CycleId(entity_id))
|
|
if _is_scenario(entity_id):
|
|
if _is_scenario(entity_id):
|
|
- return _get_manager(Scenario._MANAGER_NAME)._exists(ScenarioId(entity_id))
|
|
|
|
|
|
+ return _ScenarioManagerFactory._build_manager()._exists(ScenarioId(entity_id))
|
|
if _is_sequence(entity_id):
|
|
if _is_sequence(entity_id):
|
|
- return _get_manager(Sequence._MANAGER_NAME)._exists(SequenceId(entity_id))
|
|
|
|
|
|
+ return _SequenceManagerFactory._build_manager()._exists(SequenceId(entity_id))
|
|
if _is_task(entity_id):
|
|
if _is_task(entity_id):
|
|
- return _get_manager(Task._MANAGER_NAME)._exists(TaskId(entity_id))
|
|
|
|
|
|
+ return _TaskManagerFactory._build_manager()._exists(TaskId(entity_id))
|
|
if _is_data_node(entity_id):
|
|
if _is_data_node(entity_id):
|
|
- return _get_manager(DataNode._MANAGER_NAME)._exists(DataNodeId(entity_id))
|
|
|
|
|
|
+ return _DataManagerFactory._build_manager()._exists(DataNodeId(entity_id))
|
|
if _is_submission(entity_id):
|
|
if _is_submission(entity_id):
|
|
- return _get_manager(Submission._MANAGER_NAME)._exists(SubmissionId(entity_id))
|
|
|
|
|
|
+ return _SubmissionManagerFactory._build_manager()._exists(SubmissionId(entity_id))
|
|
|
|
|
|
raise ModelNotFound("NOT_DETERMINED", entity_id)
|
|
raise ModelNotFound("NOT_DETERMINED", entity_id)
|
|
|
|
|
|
@@ -368,19 +364,19 @@ def get(
|
|
ModelNotFound^: If the provided *entity_id* does not match any known entity pattern.
|
|
ModelNotFound^: If the provided *entity_id* does not match any known entity pattern.
|
|
"""
|
|
"""
|
|
if _is_job(entity_id):
|
|
if _is_job(entity_id):
|
|
- return _get_manager(Job._MANAGER_NAME)._get(JobId(entity_id))
|
|
|
|
|
|
+ return _JobManagerFactory._build_manager()._get(JobId(entity_id))
|
|
if _is_cycle(entity_id):
|
|
if _is_cycle(entity_id):
|
|
- return _get_manager(Cycle._MANAGER_NAME)._get(CycleId(entity_id))
|
|
|
|
|
|
+ return _CycleManagerFactory._build_manager()._get(CycleId(entity_id))
|
|
if _is_scenario(entity_id):
|
|
if _is_scenario(entity_id):
|
|
- return _get_manager(Scenario._MANAGER_NAME)._get(ScenarioId(entity_id))
|
|
|
|
|
|
+ return _ScenarioManagerFactory._build_manager()._get(ScenarioId(entity_id))
|
|
if _is_sequence(entity_id):
|
|
if _is_sequence(entity_id):
|
|
- return _get_manager(Sequence._MANAGER_NAME)._get(SequenceId(entity_id))
|
|
|
|
|
|
+ return _SequenceManagerFactory._build_manager()._get(SequenceId(entity_id))
|
|
if _is_task(entity_id):
|
|
if _is_task(entity_id):
|
|
- return _get_manager(Task._MANAGER_NAME)._get(TaskId(entity_id))
|
|
|
|
|
|
+ return _TaskManagerFactory._build_manager()._get(TaskId(entity_id))
|
|
if _is_data_node(entity_id):
|
|
if _is_data_node(entity_id):
|
|
- return _get_manager(DataNode._MANAGER_NAME)._get(DataNodeId(entity_id))
|
|
|
|
|
|
+ return _DataManagerFactory._build_manager()._get(DataNodeId(entity_id))
|
|
if _is_submission(entity_id):
|
|
if _is_submission(entity_id):
|
|
- return _get_manager(Submission._MANAGER_NAME)._get(SubmissionId(entity_id))
|
|
|
|
|
|
+ return _SubmissionManagerFactory._build_manager()._get(SubmissionId(entity_id))
|
|
|
|
|
|
raise ModelNotFound("NOT_DETERMINED", entity_id)
|
|
raise ModelNotFound("NOT_DETERMINED", entity_id)
|
|
|
|
|
|
@@ -393,7 +389,7 @@ def get_tasks() -> List[Task]:
|
|
Returns:
|
|
Returns:
|
|
A list containing all the tasks.
|
|
A list containing all the tasks.
|
|
"""
|
|
"""
|
|
- return _get_manager(Task._MANAGER_NAME)._get_all()
|
|
|
|
|
|
+ return _TaskManagerFactory._build_manager()._get_all()
|
|
|
|
|
|
|
|
|
|
def is_deletable(entity: Union[Scenario, Job, Submission, ScenarioId, JobId, SubmissionId]) -> bool:
|
|
def is_deletable(entity: Union[Scenario, Job, Submission, ScenarioId, JobId, SubmissionId]) -> bool:
|
|
@@ -410,11 +406,11 @@ def is_deletable(entity: Union[Scenario, Job, Submission, ScenarioId, JobId, Sub
|
|
True if the given scenario, job or submission can be deleted. False otherwise.
|
|
True if the given scenario, job or submission can be deleted. False otherwise.
|
|
"""
|
|
"""
|
|
if _is_job(entity):
|
|
if _is_job(entity):
|
|
- return _get_manager(Job._MANAGER_NAME)._is_deletable(entity) # type: ignore
|
|
|
|
|
|
+ return _JobManagerFactory._build_manager()._is_deletable(entity)
|
|
if _is_scenario(entity):
|
|
if _is_scenario(entity):
|
|
- return _get_manager(Scenario._MANAGER_NAME)._is_deletable(entity) # type: ignore
|
|
|
|
|
|
+ return _ScenarioManagerFactory._build_manager()._is_deletable(entity)
|
|
if _is_submission(entity):
|
|
if _is_submission(entity):
|
|
- return _get_manager(Submission._MANAGER_NAME)._is_deletable(entity) # type: ignore
|
|
|
|
|
|
+ return _SubmissionManagerFactory._build_manager()._is_deletable(entity)
|
|
return True
|
|
return True
|
|
|
|
|
|
|
|
|
|
@@ -444,20 +440,20 @@ def delete(entity_id: Union[TaskId, DataNodeId, SequenceId, ScenarioId, JobId, C
|
|
ModelNotFound: No entity corresponds to the specified *entity_id*.
|
|
ModelNotFound: No entity corresponds to the specified *entity_id*.
|
|
"""
|
|
"""
|
|
if _is_job(entity_id):
|
|
if _is_job(entity_id):
|
|
- job_manager = _get_manager(Job._MANAGER_NAME)
|
|
|
|
- return job_manager._delete(job_manager._get(JobId(entity_id))) # type: ignore
|
|
|
|
|
|
+ job_manager = _JobManagerFactory._build_manager()
|
|
|
|
+ return job_manager._delete(job_manager._get(JobId(entity_id)))
|
|
if _is_cycle(entity_id):
|
|
if _is_cycle(entity_id):
|
|
- return _get_manager(Cycle._MANAGER_NAME)._hard_delete(CycleId(entity_id)) # type: ignore
|
|
|
|
|
|
+ return _CycleManagerFactory._build_manager()._hard_delete(CycleId(entity_id))
|
|
if _is_scenario(entity_id):
|
|
if _is_scenario(entity_id):
|
|
- return _get_manager(Scenario._MANAGER_NAME)._hard_delete(ScenarioId(entity_id)) # type: ignore
|
|
|
|
|
|
+ return _ScenarioManagerFactory._build_manager()._hard_delete(ScenarioId(entity_id))
|
|
if _is_sequence(entity_id):
|
|
if _is_sequence(entity_id):
|
|
- return _get_manager(Sequence._MANAGER_NAME)._hard_delete(SequenceId(entity_id)) # type: ignore
|
|
|
|
|
|
+ return _SequenceManagerFactory._build_manager()._hard_delete(SequenceId(entity_id))
|
|
if _is_task(entity_id):
|
|
if _is_task(entity_id):
|
|
- return _get_manager(Task._MANAGER_NAME)._hard_delete(TaskId(entity_id)) # type: ignore
|
|
|
|
|
|
+ return _TaskManagerFactory._build_manager()._hard_delete(TaskId(entity_id))
|
|
if _is_data_node(entity_id):
|
|
if _is_data_node(entity_id):
|
|
- return _get_manager(DataNode._MANAGER_NAME)._delete(DataNodeId(entity_id)) # type: ignore
|
|
|
|
|
|
+ return _DataManagerFactory._build_manager()._delete(DataNodeId(entity_id))
|
|
if _is_submission(entity_id):
|
|
if _is_submission(entity_id):
|
|
- return _get_manager(Submission._MANAGER_NAME)._hard_delete(SubmissionId(entity_id)) # type: ignore
|
|
|
|
|
|
+ return _SubmissionManagerFactory._build_manager()._hard_delete(SubmissionId(entity_id))
|
|
raise ModelNotFound("NOT_DETERMINED", entity_id)
|
|
raise ModelNotFound("NOT_DETERMINED", entity_id)
|
|
|
|
|
|
|
|
|
|
@@ -477,15 +473,16 @@ def get_scenarios(cycle: Optional[Cycle] = None, tag: Optional[str] = None) -> L
|
|
The list of scenarios filtered by cycle or tag. If no filtering criteria
|
|
The list of scenarios filtered by cycle or tag. If no filtering criteria
|
|
are provided, this method returns all existing scenarios.
|
|
are provided, this method returns all existing scenarios.
|
|
"""
|
|
"""
|
|
|
|
+ scenario_manager = _ScenarioManagerFactory._build_manager()
|
|
if not cycle and not tag:
|
|
if not cycle and not tag:
|
|
- return _get_manager(Scenario._MANAGER_NAME)._get_all()
|
|
|
|
|
|
+ return scenario_manager._get_all()
|
|
if cycle and not tag:
|
|
if cycle and not tag:
|
|
- return _get_manager(Scenario._MANAGER_NAME)._get_all_by_cycle(cycle) # type: ignore
|
|
|
|
|
|
+ return scenario_manager._get_all_by_cycle(cycle)
|
|
if not cycle and tag:
|
|
if not cycle and tag:
|
|
- return _get_manager(Scenario._MANAGER_NAME)._get_all_by_tag(tag) # type: ignore
|
|
|
|
|
|
+ return scenario_manager._get_all_by_tag(tag)
|
|
if cycle and tag:
|
|
if cycle and tag:
|
|
- cycles_scenarios = _get_manager(Scenario._MANAGER_NAME)._get_all_by_cycle(cycle) # type: ignore
|
|
|
|
- return [scenario for scenario in cycles_scenarios if scenario.has_tag(tag)] # type: ignore
|
|
|
|
|
|
+ cycles_scenarios = scenario_manager._get_all_by_cycle(cycle)
|
|
|
|
+ return [scenario for scenario in cycles_scenarios if scenario.has_tag(tag)]
|
|
return []
|
|
return []
|
|
|
|
|
|
|
|
|
|
@@ -807,11 +804,11 @@ def create_global_data_node(config: DataNodeConfig) -> DataNode:
|
|
"""
|
|
"""
|
|
# Check if the data node config has GLOBAL scope
|
|
# Check if the data node config has GLOBAL scope
|
|
if config.scope is not Scope.GLOBAL:
|
|
if config.scope is not Scope.GLOBAL:
|
|
- raise DataNodeConfigIsNotGlobal(config.id) # type: ignore
|
|
|
|
|
|
+ raise DataNodeConfigIsNotGlobal(config.id)
|
|
|
|
|
|
- if dns := _get_manager(DataNode._MANAGER_NAME)._get_by_config_id(config.id): # type: ignore
|
|
|
|
|
|
+ if dns := _DataManagerFactory._build_manager()._get_by_config_id(config.id):
|
|
return dns[0]
|
|
return dns[0]
|
|
- return _get_manager(DataNode._MANAGER_NAME)._create_and_set(config, None, None) # type: ignore
|
|
|
|
|
|
+ return _DataManagerFactory._build_manager()._create_and_set(config, None, None)
|
|
|
|
|
|
|
|
|
|
def clean_all_entities_by_version(version_number=None) -> bool:
|
|
def clean_all_entities_by_version(version_number=None) -> bool:
|
|
@@ -838,12 +835,12 @@ def clean_all_entities_by_version(version_number=None) -> bool:
|
|
__logger.warning(f"{e.message} Abort cleaning the entities of version '{version_number}'.")
|
|
__logger.warning(f"{e.message} Abort cleaning the entities of version '{version_number}'.")
|
|
return False
|
|
return False
|
|
|
|
|
|
- _get_manager(Job._MANAGER_NAME)._delete_by_version(version_number)
|
|
|
|
- _get_manager(Scenario._MANAGER_NAME)._delete_by_version(version_number)
|
|
|
|
- _get_manager(Sequence._MANAGER_NAME)._delete_by_version(version_number)
|
|
|
|
- _get_manager(Task._MANAGER_NAME)._delete_by_version(version_number)
|
|
|
|
- _get_manager(DataNode._MANAGER_NAME)._delete_by_version(version_number)
|
|
|
|
- _get_manager(Submission._MANAGER_NAME)._delete_by_version(version_number)
|
|
|
|
|
|
+ _SubmissionManagerFactory._build_manager()._delete_by_version(version_number)
|
|
|
|
+ _ScenarioManagerFactory._build_manager()._delete_by_version(version_number)
|
|
|
|
+ _SequenceManagerFactory._build_manager()._delete_by_version(version_number)
|
|
|
|
+ _TaskManagerFactory._build_manager()._delete_by_version(version_number)
|
|
|
|
+ _DataManagerFactory._build_manager()._delete_by_version(version_number)
|
|
|
|
+ _SubmissionManagerFactory._build_manager()._delete_by_version(version_number)
|
|
|
|
|
|
version_manager._delete(version_number)
|
|
version_manager._delete(version_number)
|
|
try:
|
|
try:
|
|
@@ -870,24 +867,24 @@ def export_scenario(
|
|
|
|
|
|
manager = _ScenarioManagerFactory._build_manager()
|
|
manager = _ScenarioManagerFactory._build_manager()
|
|
scenario = manager._get(scenario_id)
|
|
scenario = manager._get(scenario_id)
|
|
- entity_ids = manager._get_children_entity_ids(scenario) # type: ignore
|
|
|
|
|
|
+ entity_ids = manager._get_children_entity_ids(scenario)
|
|
entity_ids.scenario_ids = {scenario_id}
|
|
entity_ids.scenario_ids = {scenario_id}
|
|
entity_ids.cycle_ids = {scenario.cycle.id}
|
|
entity_ids.cycle_ids = {scenario.cycle.id}
|
|
|
|
|
|
shutil.rmtree(folder_path, ignore_errors=True)
|
|
shutil.rmtree(folder_path, ignore_errors=True)
|
|
|
|
|
|
for data_node_id in entity_ids.data_node_ids:
|
|
for data_node_id in entity_ids.data_node_ids:
|
|
- _get_manager(DataNode._MANAGER_NAME)._export(data_node_id, folder_path)
|
|
|
|
|
|
+ _DataManagerFactory._build_manager()._export(data_node_id, folder_path)
|
|
for task_id in entity_ids.task_ids:
|
|
for task_id in entity_ids.task_ids:
|
|
- _get_manager(Task._MANAGER_NAME)._export(task_id, folder_path)
|
|
|
|
|
|
+ _TaskManagerFactory._build_manager()._export(task_id, folder_path)
|
|
for sequence_id in entity_ids.sequence_ids:
|
|
for sequence_id in entity_ids.sequence_ids:
|
|
- _get_manager(Sequence._MANAGER_NAME)._export(sequence_id, folder_path)
|
|
|
|
|
|
+ _SequenceManagerFactory._build_manager()._export(sequence_id, folder_path)
|
|
for cycle_id in entity_ids.cycle_ids:
|
|
for cycle_id in entity_ids.cycle_ids:
|
|
- _get_manager(Cycle._MANAGER_NAME)._export(cycle_id, folder_path)
|
|
|
|
|
|
+ _CycleManagerFactory._build_manager()._export(cycle_id, folder_path)
|
|
for scenario_id in entity_ids.scenario_ids:
|
|
for scenario_id in entity_ids.scenario_ids:
|
|
- _get_manager(Scenario._MANAGER_NAME)._export(scenario_id, folder_path)
|
|
|
|
|
|
+ _ScenarioManagerFactory._build_manager()._export(scenario_id, folder_path)
|
|
for job_id in entity_ids.job_ids:
|
|
for job_id in entity_ids.job_ids:
|
|
- _get_manager(Job._MANAGER_NAME)._export(job_id, folder_path)
|
|
|
|
|
|
+ _JobManagerFactory._build_manager()._export(job_id, folder_path)
|
|
|
|
|
|
|
|
|
|
def get_parents(
|
|
def get_parents(
|
|
@@ -920,7 +917,7 @@ def get_parents(
|
|
parent_dict[k] = value
|
|
parent_dict[k] = value
|
|
|
|
|
|
if isinstance(entity, str):
|
|
if isinstance(entity, str):
|
|
- entity = get(entity) # type: ignore
|
|
|
|
|
|
+ entity = get(entity)
|
|
|
|
|
|
parent_dict = parent_dict or dict()
|
|
parent_dict = parent_dict or dict()
|
|
|
|
|
|
@@ -983,10 +980,10 @@ def get_entities_by_config_id(
|
|
|
|
|
|
entities: List = []
|
|
entities: List = []
|
|
|
|
|
|
- if entities := _get_manager(Scenario._MANAGER_NAME)._get_by_config_id(config_id): # type: ignore
|
|
|
|
|
|
+ if entities := _ScenarioManagerFactory._build_manager()._get_by_config_id(config_id):
|
|
return entities
|
|
return entities
|
|
- if entities := _get_manager(Task._MANAGER_NAME)._get_by_config_id(config_id): # type: ignore
|
|
|
|
|
|
+ if entities := _TaskManagerFactory._build_manager()._get_by_config_id(config_id):
|
|
return entities
|
|
return entities
|
|
- if entities := _get_manager(DataNode._MANAGER_NAME)._get_by_config_id(config_id): # type: ignore
|
|
|
|
|
|
+ if entities := _DataManagerFactory._build_manager()._get_by_config_id(config_id):
|
|
return entities
|
|
return entities
|
|
return entities
|
|
return entities
|