|
@@ -431,26 +431,43 @@ class Scenario(_Entity, Submittable, _Labeled):
|
|
self,
|
|
self,
|
|
new_creation_date: Optional[datetime] = None,
|
|
new_creation_date: Optional[datetime] = None,
|
|
new_name: Optional[str] = None,
|
|
new_name: Optional[str] = None,
|
|
|
|
+ data_to_duplicate: Union[Set[str], bool] = True
|
|
) -> "Scenario":
|
|
) -> "Scenario":
|
|
"""Duplicate the scenario and return the new one.
|
|
"""Duplicate the scenario and return the new one.
|
|
|
|
|
|
- This method duplicates the scenario, optionally setting a new creation date and name.
|
|
|
|
- The nested tasks and data nodes are duplicated as well. If the scenario belongs to a
|
|
|
|
- cycle, the cycle (corresponding to the creation_date and the configuration frequency
|
|
|
|
- attribute) is created if it does not exist yet.
|
|
|
|
|
|
+ If the scenario belongs to a cycle, the cycle (corresponding to the creation_date
|
|
|
|
+ and the configuration frequency attribute) is created if it does not exist yet.
|
|
|
|
+
|
|
|
|
+ The nested entities are duplicated or not depending on the creation date of the new
|
|
|
|
+ scenario, its cycle, and the various data node scopes.
|
|
|
|
+
|
|
|
|
+ !!! warning "Data and data nodes duplication"
|
|
|
|
+
|
|
|
|
+ Note that for now, Taipy can only duplicate data for file-based data nodes. For
|
|
|
|
+ other types of data nodes (sql, mongo, etc.), the new data nodes are created
|
|
|
|
+ referencing the exact same data as the original data nodes. This can lead to
|
|
|
|
+ conflicts if the data is modified in one of the scenarios.
|
|
|
|
+
|
|
|
|
+ Users must ensure after a duplication that the data nodes' data are correctly
|
|
|
|
+ set for the new scenario.
|
|
|
|
+
|
|
|
|
+ For example, the table name of a SQL table data node must be manually updated to
|
|
|
|
+ avoid conflicts.
|
|
|
|
|
|
Arguments:
|
|
Arguments:
|
|
new_creation_date (Optional[datetime.datetime]): The creation date of the new scenario.
|
|
new_creation_date (Optional[datetime.datetime]): The creation date of the new scenario.
|
|
If None, the current date and time is used.
|
|
If None, the current date and time is used.
|
|
new_name (Optional[str]): The displayable name of the new scenario.
|
|
new_name (Optional[str]): The displayable name of the new scenario.
|
|
If None, the name of the current scenario is used.
|
|
If None, the name of the current scenario is used.
|
|
-
|
|
|
|
|
|
+ data_to_duplicate (Union[Set[str], bool]): A set of data node configuration ids used
|
|
|
|
+ to duplicate only the data nodes' data with the specified configuration ids.
|
|
|
|
+ If True, all data nodes are duplicated. If False, no data nodes are duplicated.
|
|
Returns:
|
|
Returns:
|
|
Scenario: The newly duplicated scenario.
|
|
Scenario: The newly duplicated scenario.
|
|
"""
|
|
"""
|
|
from ._scenario_manager_factory import _ScenarioManagerFactory
|
|
from ._scenario_manager_factory import _ScenarioManagerFactory
|
|
|
|
|
|
- return _ScenarioManagerFactory._build_manager()._duplicate(self, new_creation_date, new_name)
|
|
|
|
|
|
+ return _ScenarioManagerFactory._build_manager()._duplicate(self, new_creation_date, new_name, data_to_duplicate)
|
|
|
|
|
|
def set_primary(self) -> None:
|
|
def set_primary(self) -> None:
|
|
"""Promote the scenario as the primary scenario of its cycle.
|
|
"""Promote the scenario as the primary scenario of its cycle.
|