Add JSON output writer and Hydra output=json config#51
Open
izzet wants to merge 3 commits intollnl:developfrom
Open
Add JSON output writer and Hydra output=json config#51izzet wants to merge 3 commits intollnl:developfrom
izzet wants to merge 3 commits intollnl:developfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds JSON output support to the DFAnalyzer tool, allowing users to export analysis results as structured JSON files instead of (or in addition to) the default console output. It includes a new JSONOutput class, a corresponding Hydra configuration dataclass, updated type exports, documentation, and an end-to-end test.
Changes:
- Introduces
JSONOutputclass andJSONOutputConfigdataclass, registered with Hydra's config store underoutput=json - Refactors
_additional_metric_scale_and_unitfromConsoleOutputup to the baseOutputclass so it can be shared withJSONOutput - Adds an end-to-end smoke test validating JSON file creation and schema structure
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
python/dftracer/analyzer/output.py |
Adds JSONOutput class with handle_result, _create_raw_stats, _create_summary_payload, _create_additional_metrics_payload, _resolve_output_path; moves _additional_metric_scale_and_unit to base Output class |
python/dftracer/analyzer/config.py |
Adds JSONOutputConfig dataclass and registers it with Hydra config store |
python/dftracer/analyzer/__init__.py |
Imports and exports JSONOutput, adds it to OutputType union |
tests/test_e2e.py |
Adds test_json_output_file smoke test verifying JSON output creation and schema |
docs/configuration.rst |
Documents JSON output parameters and default behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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 pull request adds support for exporting analysis results in JSON format, including configuration, implementation, and end-to-end tests. The changes introduce a new
JSONOutputclass, update configuration and type definitions to support the new output type, and document the new feature for users.JSON Output Feature
JSONOutputclass topython/dftracer/analyzer/output.pythat saves analysis results as a structured JSON file, including raw stats, per-view summaries, per-layer metrics, and additional metric statistics. The output file path is configurable.JSONOutputConfigdataclass inpython/dftracer/analyzer/config.pyand registered it with Hydra's config store, enabling users to select JSON output via configuration. [1] [2]Type and Import Updates
OutputTypeunion and imports inpython/dftracer/analyzer/__init__.pyto includeJSONOutput, ensuring proper typing and discoverability. [1] [2]Documentation
docs/configuration.rst, describing its contents, configuration parameters, and default behavior.Testing
tests/test_e2e.pyto verify that JSON output is correctly produced, contains expected fields, and is written to the specified file path. [1] [2]