idmtools.entities.templated_simulation module¶
-
idmtools.entities.templated_simulation.
simulation_generator
(builders, new_sim_func, additional_sims=None, batch_size=10)¶
-
class
idmtools.entities.templated_simulation.
TemplatedSimulations
(builders: Set[idmtools.builders.simulation_builder.SimulationBuilder] = <factory>, base_simulation: idmtools.entities.simulation.Simulation = None, base_task: idmtools.entities.itask.ITask = None, parent: Experiment = None, tags: dataclasses.InitVar = <property object>, _TemplatedSimulations__extra_simulations: List[idmtools.entities.simulation.Simulation] = <factory>)¶ Bases:
object
Class for building templated simulations and commonly used with SimulationBuilder class.
Examples
Add tags to all simulations via base task:
ts = TemplatedSimulations(base_task=task) ts.tags = {'a': 'test', 'b': 9} ts.add_builder(builder)
Add tags to a specific simulation:
experiment = Experiment.from_builder(builder, task, name=expname) experiment.simulations = list(experiment.simulations) experiment.simulations[2].tags['test']=123
-
builders
: Set[idmtools.builders.simulation_builder.SimulationBuilder]¶
-
base_simulation
: idmtools.entities.simulation.Simulation = None¶
-
base_task
: idmtools.entities.itask.ITask = None¶
-
parent
: Experiment = None¶
-
property
builder
¶ For backward-compatibility purposes.
- Returns
The last
TExperimentBuilder
.
-
add_builder
(builder: idmtools.builders.simulation_builder.SimulationBuilder) → None¶ Add builder to builder collection.
- Parameters
builder – A builder to be added.
- Returns
None
-
property
pickle_ignore_fields
¶
-
display
()¶
-
simulations
() → Generator[idmtools.entities.simulation.Simulation, None, None]¶
-
extra_simulations
() → List[idmtools.entities.simulation.Simulation]¶ Returns the extra simulations defined on template
- Returns
Returns the extra simulations defined
-
add_simulation
(simulation: idmtools.entities.simulation.Simulation)¶ Add a simulation that was built outside template engine to template generator. This is useful we you can build most simulations through a template but need a some that cannot. This is especially true for large simulation sets
- Parameters
simulation – Simulation to add
Returns:
-
add_simulations
(simulations: List[idmtools.entities.simulation.Simulation])¶ Add multiple simulations without templating. See add_simulation
- Parameters
simulations – Simulation to add
Returns:
-
new_simulation
()¶ Return a new simulation object. The simulation will be copied from the base simulation of the experiment.
- Returns
The created simulation.
-
classmethod
from_task
(task: idmtools.entities.itask.ITask, tags: Dict[str, Any] = None) → idmtools.entities.templated_simulation.TemplatedSimulations¶
-