Improved Results Handling and System Robustness#3
Merged
Conversation
…ispatch loop - core: import and catch `queue.Empty` on `ipc_queue.get(timeout)`, log a warning on timeout and continue until subprocesses finish - trace-player: replace `asyncio.wait_for(..., timeout=0.1)` with non‐blocking `get_nowait()`, catch `asyncio.QueueEmpty`, sleep briefly, and cleanly exit on shutdown flag
- introduce `--output-dir` option (defaults to `tracestorm_results/{timestamp}`) for customizable result storage
- add `--plot` flag (disabled by default) to control generation of performance plots
- ensure raw results JSON is always saved to the specified output directory
There was a problem hiding this comment.
Pull Request Overview
This PR improves the system’s robustness and usability by enhancing result handling, introducing new CLI options, and expanding test coverage. Key changes include:
- Overhauled request dispatching in TracePlayer to eliminate busy-waiting and enable graceful shutdown.
- Improved IPC queue timeout handling in run_load_test with enhanced logging.
- Addition of new CLI options (--output-dir, --plot) and associated tests.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tracestorm/trace_player.py | Refactored sender_worker and schedule_requests logic for better async flow |
| tracestorm/core.py | Updated exception handling to improve timeout recovery in result collection |
| tracestorm/cli.py | Added new CLI options for output directory and plotting, with directory setup |
| tests/test_replayer.py | Introduced tests for sender_worker behavior under varying queue conditions |
| tests/test_cli.py | Added tests validating the behavior of CLI options including custom output dir and plotting |
- Added `--include-raw-results` flag to control whether raw results are saved
XuehengWang
approved these changes
May 17, 2025
Collaborator
XuehengWang
left a comment
There was a problem hiding this comment.
I tried some tests and everything works
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.
This PR introduces better control over test result storage, visualization options, and fixes critical race conditions in the request handling system.
Changes
Enhanced CLI Options
--output-dirparameter to control where results are stored (defaults totracestorm_results/{timestamp}/)--plotflag to make visualization optional (off by default)Improved Stability
queue.EmptyexceptionsAdded Test Coverage
Testing
--plotThese improvements make the system more robust when handling slow or unresponsive API endpoints, provide better control over where results are stored, and make plot generation optional to support automated testing environments.