Batch API¶
Parallel simulation execution with thread-pool parallelism.
simulate_batch¶
idfkit.simulation.batch.simulate_batch(jobs, *, energyplus=None, max_workers=None, cache=None, progress=None, fs=None, on_progress=None)
¶
Run multiple EnergyPlus simulations in parallel.
Uses ThreadPoolExecutor to dispatch simulations concurrently. Individual job failures are captured as failed SimulationResult entries -- the batch never raises due to a single job failing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
jobs
|
Sequence[SimulationJob]
|
Sequence of simulation jobs to execute. |
required |
energyplus
|
EnergyPlusConfig | None
|
Shared EnergyPlus configuration (auto-discovered if
|
None
|
max_workers
|
int | None
|
Maximum number of concurrent simulations. Defaults
to |
None
|
cache
|
SimulationCache | None
|
Optional simulation cache for content-hash lookups. |
None
|
progress
|
Callable[..., None] | None
|
Optional callback invoked after each job completes.
Called as |
None
|
fs
|
FileSystem | None
|
Optional file system backend passed through to each simulate call. |
None
|
on_progress
|
Callable[[SimulationProgress], None] | None
|
Optional callback invoked with
SimulationProgress events
during each individual simulation. Events include
|
None
|
Returns:
| Type | Description |
|---|---|
BatchResult
|
A BatchResult with results in the same order as jobs. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If jobs is empty. |
Source code in src/idfkit/simulation/batch.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
SimulationJob¶
idfkit.simulation.batch.SimulationJob
dataclass
¶
Specification for a single simulation within a batch.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
object
|
The EnergyPlus model to simulate. |
weather |
str | Path
|
Path to the weather file. |
label |
str
|
Human-readable label for progress reporting. |
output_dir |
str | Path | None
|
Directory for output files (default: auto temp dir). |
expand_objects |
bool
|
Run ExpandObjects before simulation. |
annual |
bool
|
Run annual simulation. |
design_day |
bool
|
Run design-day-only simulation. |
output_prefix |
str
|
Prefix for output files. |
output_suffix |
Literal['C', 'L', 'D']
|
Output file naming suffix ( |
readvars |
bool
|
Run ReadVarsESO after simulation. |
timeout |
float
|
Maximum runtime in seconds. |
extra_args |
tuple[str, ...] | None
|
Additional command-line arguments. |
Source code in src/idfkit/simulation/batch.py
model
instance-attribute
¶
weather
instance-attribute
¶
label = ''
class-attribute
instance-attribute
¶
output_dir = None
class-attribute
instance-attribute
¶
expand_objects = True
class-attribute
instance-attribute
¶
annual = False
class-attribute
instance-attribute
¶
design_day = False
class-attribute
instance-attribute
¶
output_prefix = 'eplus'
class-attribute
instance-attribute
¶
output_suffix = 'C'
class-attribute
instance-attribute
¶
readvars = False
class-attribute
instance-attribute
¶
timeout = 3600.0
class-attribute
instance-attribute
¶
extra_args = None
class-attribute
instance-attribute
¶
BatchResult¶
idfkit.simulation.batch.BatchResult
dataclass
¶
Aggregated results from a batch simulation run.
Attributes:
| Name | Type | Description |
|---|---|---|
results |
tuple[SimulationResult, ...]
|
Simulation results in the same order as the input jobs. |
total_runtime_seconds |
float
|
Wall-clock time for the entire batch. |