Skip to content

Commit 753839d

Browse files
fix(tidy3d): FXC-5400-misleading-re-run-warning-for-batch-run
1 parent 623c128 commit 753839d

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4242
- Fixed sliver polygon artifacts in 2D material subdivision by filtering polygons based on grid cell size, preventing numerical issues with large-coordinate geometries.
4343
- Fixed `CustomMedium` gradient calculation when field coordinates exactly align with boundaries.
4444
- Fixed adjoint simulation `grid_spec` to align exactly with forward simulation for correct `FieldData` adjoint source power.
45+
- Fixed redundant logging when `Batch.download()` skips existing files, and added `replace_existing` to `Batch.run()` so overwrite behavior can be controlled directly.
4546

4647
## [2.10.2] - 2026-01-21
4748

tidy3d/web/api/container.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,7 @@ def run(
799799
self,
800800
path_dir: PathLike = DEFAULT_DATA_DIR,
801801
priority: Optional[int] = None,
802+
replace_existing: bool = False,
802803
) -> BatchData:
803804
"""Upload and run each simulation in :class:`Batch`.
804805
@@ -809,6 +810,9 @@ def run(
809810
priority: int = None
810811
Priority of the simulation in the Virtual GPU (vGPU) queue (1 = lowest, 10 = highest).
811812
It affects only simulations from vGPU licenses and does not impact simulations using FlexCredits.
813+
replace_existing : bool = False
814+
Downloads the data even if path exists (overwriting the existing). Applies when
815+
downloading cached results or when `download_on_success=True`.
812816
Returns
813817
------
814818
:class:`BatchData`
@@ -838,12 +842,16 @@ def run(
838842
self.start()
839843
else:
840844
self.start(priority=priority)
841-
self.monitor(path_dir=path_dir, download_on_success=True)
845+
self.monitor(
846+
path_dir=path_dir,
847+
download_on_success=True,
848+
replace_existing=replace_existing,
849+
)
842850
else:
843851
if self.verbose:
844852
console = get_logging_console()
845853
console.log("Found all simulations in cache.")
846-
self.download(path_dir=path_dir) # moves cache files
854+
self.download(path_dir=path_dir, replace_existing=replace_existing) # moves cache files
847855
return self.load(path_dir=path_dir, skip_download=True)
848856

849857
@cached_property
@@ -1258,10 +1266,10 @@ def download(
12581266
)
12591267
if num_existing > 0:
12601268
files_plural = "files have" if num_existing > 1 else "file has"
1261-
log.warning(
1262-
f"{num_existing} {files_plural} already been downloaded "
1263-
f"and will be skipped. To forcibly overwrite existing files, invoke "
1264-
"the load or download function with `replace_existing=True`.",
1269+
log.info(
1270+
f"{num_existing} {files_plural} already been downloaded and will be skipped. "
1271+
"To forcibly overwrite existing files, invoke the run, load, or download "
1272+
"function with `replace_existing=True`.",
12651273
log_once=True,
12661274
)
12671275

@@ -1276,9 +1284,9 @@ def download(
12761284

12771285
if job_path.exists():
12781286
if replace_existing:
1279-
log.info(f"File '{job_path}' already exists. Overwriting.")
1287+
log.debug(f"File '{job_path}' already exists. Overwriting.")
12801288
else:
1281-
log.info(f"File '{job_path}' already exists. Skipping.")
1289+
log.debug(f"File '{job_path}' already exists. Skipping.")
12821290
continue
12831291

12841292
if job.load_if_cached:

0 commit comments

Comments
 (0)