Skip to content

Commit 7a0a13e

Browse files
committed
refactor: Taking out DesignSpace._run_batch
1 parent 9138b28 commit 7a0a13e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tidy3d/plugins/design/design.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,12 @@ def fn_combined(self, args_list: list[dict[str, Any]]) -> list[Any]:
312312

313313
return handler
314314

315+
@staticmethod
316+
def _run_batch(batch: Batch, path_dir: str) -> BatchData:
317+
"""Run a batch and return the BatchData."""
318+
batch_out = batch.run(path_dir=path_dir)
319+
return batch_out
320+
315321
def _fn_mid(
316322
self, pre_out: dict[int, Any], sim_counter: int, console: Console
317323
) -> Union[dict[int, Any], BatchData]:
@@ -387,16 +393,17 @@ def _find_and_map(
387393
console.log(f"Running {run_statement}")
388394

389395
# Running simulations and batches
390-
sims_out = Batch(
396+
batch = Batch(
391397
simulations=named_sims,
392398
folder_name=self.folder_name,
393399
simulation_type="tidy3d_design",
394400
verbose=False, # Using a custom output instead of Batch.monitor updates
395-
).run(path_dir=self.path_dir)
401+
)
402+
sims_out = self._run_batch(batch, path_dir=self.path_dir)
396403

397404
batch_results = {}
398405
for batch_key, batch in batches.items():
399-
batch_out = batch.run(path_dir=self.path_dir)
406+
batch_out = self._run_batch(batch, path_dir=self.path_dir)
400407
batch_results[batch_key] = batch_out
401408

402409
def _return_to_dict(return_dict: dict, key: str, return_obj: Any) -> None:

0 commit comments

Comments
 (0)