feat(tidy3d): FXC-3829-duplicate-convergence-checks-for-non-lazy-post… #2926
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…processing
currently, we observe duplicate log messages on warnings (and possibly multiple log downloads) on warnings when lazy is set to false, as we trigger it in “from_file” via the
on_loadand then again inTidy3dStubData.postprocesstidy3d/tidy3d/components/base.py
Line 408 in 7d63ace
tidy3d/tidy3d/web/api/tidy3d_stub.py
Line 312 in 7d63ace
I just removed the second call in postprocess.
As a little side-fix, I trigger a refresh on the upload progress bar in batches which was displayed as incomplete sometimes.
Greptile Overview
Updated On: 2025-10-24 11:08:10 UTC
Greptile Summary
Fixes duplicate convergence check warnings when
lazy=Falseand improves progress bar refresh behavior for batch uploads.Main Changes:
_check_convergence_and_warnings()call inTidy3dStubData.postprocess()that was causing duplicate log messages whenlazy=False. The convergence check is already triggered via theon_loadcallback infrom_file()(line 407 in base.py), so the second call was unnecessary.BATCH_MONITOR_PROGRESS_REFRESH_TIMEtoBATCH_PROGRESS_REFRESH_TIMEfor consistencyprogress.refresh()and sleep after upload completion in batch processingIssues Found:
container.pyhas a logical issue: the refresh and sleep are placed outside the loop (lines 842-843), executing only once after all uploads complete, which won't resolve incomplete progress displays during uploads. They should be inside the loop.Confidence Score: 3/5
Important Files Changed
File Analysis
Sequence Diagram
sequenceDiagram participant Client participant Tidy3dStubData participant BaseModel participant LazyProxy participant ConvergenceCheck Note over Client,ConvergenceCheck: Postprocess with lazy=False (OLD BEHAVIOR) Client->>Tidy3dStubData: postprocess(file_path, lazy=False) Tidy3dStubData->>BaseModel: from_file(lazy=False, on_load=_check_convergence) BaseModel->>BaseModel: dict_from_file() BaseModel->>BaseModel: parse_obj() BaseModel->>ConvergenceCheck: on_load(_check_convergence) ✓ First call BaseModel-->>Tidy3dStubData: stub_data Note over Tidy3dStubData,ConvergenceCheck: OLD: Duplicate call here Tidy3dStubData->>ConvergenceCheck: _check_convergence(stub_data) ✗ REMOVED Tidy3dStubData-->>Client: stub_data Note over Client,ConvergenceCheck: Postprocess with lazy=True Client->>Tidy3dStubData: postprocess(file_path, lazy=True) Tidy3dStubData->>BaseModel: from_file(lazy=True, on_load=_check_convergence) BaseModel->>LazyProxy: create LazyProxy with on_load callback BaseModel-->>Tidy3dStubData: proxy Tidy3dStubData-->>Client: proxy (not yet loaded) Note over Client,LazyProxy: Later access triggers loading Client->>LazyProxy: access attribute LazyProxy->>LazyProxy: materialize data LazyProxy->>ConvergenceCheck: on_load(_check_convergence) ✓ Called on access LazyProxy-->>Client: data