Fix: Replace time.sleep polling in runtime_e2etest.py#204
Open
Fix: Replace time.sleep polling in runtime_e2etest.py#204
Conversation
Refactored multiple tests within `tsercom/runtime_e2etest.py` to replace `time.sleep()`-based polling loops with `multiprocessing.Event`-based synchronization. This enhances test determinism and reliability. Tests and Runtimes affected: - `test_out_of_process_torch_event_transport` and `StrDataTorchEventRuntime`: Replaced data polling and a fixed sleep with events. - `test_out_of_process_torch_data_torch_event_transport`, `test_out_of_process_torch_tensor_stress`, and `TorchDataTorchEventRuntime`: Replaced polling for initial, event response (for the first test), and stopped data with events. - `test_multiple_runtimes_out_of_process` and `test_client_type_runtime_in_process`: Updated to use the already event-enabled `FakeRuntime` correctly with events, replacing polling loops. - `test_event_broadcast_e2e` and `BroadcastTestFakeRuntime`: Implemented per-listener events to synchronize broadcast data reception. All changes include using a 'spawn' context for multiprocessing events and employing brief, bounded post-event polling loops to robustly handle IPC latencies before asserting on data in aggregators.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refactored multiple tests within
tsercom/runtime_e2etest.pyto replacetime.sleep()-based polling loops withmultiprocessing.Event-based synchronization. This enhances test determinism and reliability.Tests and Runtimes affected:
test_out_of_process_torch_event_transportandStrDataTorchEventRuntime: Replaced data polling and a fixed sleep with events.test_out_of_process_torch_data_torch_event_transport,test_out_of_process_torch_tensor_stress, andTorchDataTorchEventRuntime: Replaced polling for initial, event response (for the first test), and stopped data with events.test_multiple_runtimes_out_of_processandtest_client_type_runtime_in_process: Updated to use the already event-enabledFakeRuntimecorrectly with events, replacing polling loops.test_event_broadcast_e2eandBroadcastTestFakeRuntime: Implemented per-listener events to synchronize broadcast data reception.All changes include using a 'spawn' context for multiprocessing events and employing brief, bounded post-event polling loops to robustly handle IPC latencies before asserting on data in aggregators.