Repository navigation
feat(testing): Add dummy-io simulation support for zero-data-transfer benchmarking and testing - #1020
raj-prince wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a dummy I/O mode for gcsfs to simulate read operations without network data transfer, allowing users to simulate latency and bandwidth delays. The review feedback highlights several critical issues in the implementation: a missing weakref import, a potential resource leak due to an unregistered finalizer when overwriting _mrd_pool_cache, a parameter name mismatch with the parent class, a unit mismatch where megabits are treated as megabytes in delay calculations, and significant code duplication in DummyMRDPoolCache.get that could be refactored.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1020 +/- ##
==========================================
+ Coverage 89.68% 90.02% +0.33%
==========================================
Files 16 16
Lines 3579 3650 +71
==========================================
+ Hits 3210 3286 +76
+ Misses 369 364 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Please fix the patch codecov failure |
|
Consider moving DummyDelaySimulator, DummyMRD, DummyMRDPool, and DummyGcsFileSystem entirely out of the main package and into the test suite (gcsfs/tests/). Can see if possible to use Dependency Injection or unittest.mock.patch within your test files to swap out the production filesystem or MRDPool with your mock during test execution, rather than altering gcsfs/init.py to conditionally load a dummy file system. Adding "dummy" or "mock" classes to production code is an anti-pattern which we should avoid if possible. |
Summary
This PR introduces a Dummy I/O Simulation Suite (
DummyGcsFileSystem,DummyMRD,DummyMRDPool,DummyDelaySimulator) withingcsfs/tests/to simulate read operations against Google Cloud Storage without performing real network data transfers.Motivation:
Deterministic Offline Benchmarking- Measure application CPU bottlenecks and I/O concurrency independently of network fluctuations.Usage Instructions
1. Direct Instantiation in Python Scripts
Instantiate
DummyGcsFileSystemdirectly and pass simulated latency/bandwidth limits:2. Transparent Integration via
fsspecFor downstream libraries (e.g., PyTorch
DataLoader, Ray, Pandas) that usefsspec.open("gs://..."), registerDummyGcsFileSystemglobally without modifying application code:3. Environment Variable Configuration
Simulation parameters can be configured dynamically via environment variables:
GCSFS_DUMMY_IO_TTFB_MSfloat0.0GCSFS_DUMMY_IO_BANDWIDTH_MEGABYTES_PER_SECfloatNone(unlimited)