Skip to content

Commit fa412d8

Browse files
fix(tidy3d): FXC-5400-misleading-re-run-warning-for-batch-run
1 parent 0855902 commit fa412d8

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3737
- Fixed frequency accumulation of gradients for custom dispersive media.
3838
- Fixed `snap_box_to_grid` producing zero-size boxes when using `Expand` behavior with very small intervals centered on a grid point.
3939
- Fixed sliver polygon artifacts in 2D material subdivision by filtering polygons based on grid cell size, preventing numerical issues with large-coordinate geometries.
40+
- Fixed redundant logging when `Batch.download()` skips existing files, and added `replace_existing` to `Batch.run()` so overwrite behavior can be controlled directly.
4041

4142
## [2.10.2] - 2026-01-21
4243

tidy3d/web/api/container.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,7 @@ def run(
785785
self,
786786
path_dir: PathLike = DEFAULT_DATA_DIR,
787787
priority: Optional[int] = None,
788+
replace_existing: bool = False,
788789
) -> BatchData:
789790
"""Upload and run each simulation in :class:`Batch`.
790791
@@ -795,6 +796,9 @@ def run(
795796
priority: int = None
796797
Priority of the simulation in the Virtual GPU (vGPU) queue (1 = lowest, 10 = highest).
797798
It affects only simulations from vGPU licenses and does not impact simulations using FlexCredits.
799+
replace_existing : bool = False
800+
Downloads the data even if path exists (overwriting the existing). Applies when
801+
downloading cached results or when `download_on_success=True`.
798802
Returns
799803
------
800804
:class:`BatchData`
@@ -824,12 +828,16 @@ def run(
824828
self.start()
825829
else:
826830
self.start(priority=priority)
827-
self.monitor(path_dir=path_dir, download_on_success=True)
831+
self.monitor(
832+
path_dir=path_dir,
833+
download_on_success=True,
834+
replace_existing=replace_existing,
835+
)
828836
else:
829837
if self.verbose:
830838
console = get_logging_console()
831839
console.log("Found all simulations in cache.")
832-
self.download(path_dir=path_dir) # moves cache files
840+
self.download(path_dir=path_dir, replace_existing=replace_existing) # moves cache files
833841
return self.load(path_dir=path_dir, skip_download=True)
834842

835843
@cached_property
@@ -1245,9 +1253,9 @@ def download(
12451253
if num_existing > 0:
12461254
files_plural = "files have" if num_existing > 1 else "file has"
12471255
log.warning(
1248-
f"{num_existing} {files_plural} already been downloaded "
1249-
f"and will be skipped. To forcibly overwrite existing files, invoke "
1250-
"the load or download function with `replace_existing=True`.",
1256+
f"{num_existing} {files_plural} already been downloaded and will be skipped. "
1257+
"To forcibly overwrite existing files, invoke the run, load, or download "
1258+
"function with `replace_existing=True`.",
12511259
log_once=True,
12521260
)
12531261

@@ -1264,7 +1272,8 @@ def download(
12641272
if replace_existing:
12651273
log.info(f"File '{job_path}' already exists. Overwriting.")
12661274
else:
1267-
log.info(f"File '{job_path}' already exists. Skipping.")
1275+
# we already informed about skipped downloads, more details with debug
1276+
log.debug(f"File '{job_path}' already exists. Skipping.")
12681277
continue
12691278

12701279
if job.load_if_cached:

0 commit comments

Comments
 (0)