-
Notifications
You must be signed in to change notification settings - Fork 66
fix(tidy3d): FXC-3884-mode-solver-cache-hashing #2944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 files reviewed, 1 comment
1d4633a to
eacd348
Compare
Diff CoverageDiff: origin/develop...HEAD, staged and unstaged changes
Summary
tidy3d/web/api/webapi.pytidy3d/web/cache.py |
lucas-flexcompute
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, PF should use now the Job class to upload, start and load back results to enable caching for model solver, right? And it should also work for other simulation types, since Job.load calls web.load. Looks good.
Not necessarily - both storing and loading should work with any of |
|
@lucas-flexcompute or would you target another usage of it? In principle, you could also directly use |
Using |
yaugenst-flex
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @marcorudolphflex looks great!
a85d3eb to
b87144c
Compare
b87144c to
623d7ac
Compare
Previous state
Mode simulations never write to the new local cache because store_result can’t find stub_data.simulation.
Changes
web.load does not store ModeSolver data in cache, instead wrapping functions do that with new helper
_store_mode_solver_in_cacheGreptile Overview
Updated On: 2025-10-30 12:33:17 UTC
Greptile Summary
Fixed ModeSolver simulation results not being cached locally by introducing a specialized cache storage path that passes the simulation object directly instead of relying on
stub_data.simulation.Key Changes
LocalCache.store_result()intidy3d/web/cache.py:315to accept an optionalsimulationparameter and return a boolean indicating success/failure_store_mode_solver_in_cache()intidy3d/web/cache.py:550to encapsulate ModeSolver-specific cache storage logicweb.load()intidy3d/web/api/webapi.py:1420to skip generic cache storage for MODE_SOLVER workflow typesweb.run(),Job.load(), andBatch.load()to explicitly call the new cache helper after loading ModeSolver resultsIssues Found
download()call inBatch.load()attidy3d/web/api/container.py:1439-1440(already called on line 1420)Confidence Score: 4/5
stub_data.simulationwas unavailable for ModeSolvertidy3d/web/api/container.py- contains duplicate download() call that needs removalImportant Files Changed
File Analysis
_store_mode_solver_in_cacheand modifiedstore_resultto accept optional simulation parameter, fixing ModeSolver cache storagerun()andload()to use new ModeSolver cache helper, excluding MODE_SOLVER workflow from generic cache storage in load()_test_mode_solver_cachingcovering all code paths (run, Job, Batch) for ModeSolver cache functionalitySequence Diagram
sequenceDiagram participant User participant web.run/Job/Batch participant load() participant LocalCache participant _store_mode_solver_in_cache() alt Mode Solver Run User->>web.run/Job/Batch: run(ModeSolver) web.run/Job/Batch->>load(): load(task_id, path) load()->>LocalCache: Check if MODE_SOLVER type Note over load(),LocalCache: Skip generic store_result<br/>for MODE_SOLVER load()-->>web.run/Job/Batch: return data web.run/Job/Batch->>_store_mode_solver_in_cache(): Store with simulation param _store_mode_solver_in_cache()->>LocalCache: store_result(simulation=mode_solver) LocalCache->>LocalCache: Hash simulation object LocalCache->>LocalCache: Store with cache key web.run/Job/Batch->>User: return data end alt Regular Simulation Run User->>web.run/Job/Batch: run(Simulation) web.run/Job/Batch->>load(): load(task_id, path) load()->>LocalCache: store_result(stub_data) Note over load(),LocalCache: Uses stub_data.simulation<br/>for hashing load()-->>web.run/Job/Batch: return data web.run/Job/Batch->>User: return data end