Skip to content

Conversation

@FindHao
Copy link
Member

@FindHao FindHao commented Dec 2, 2025

Summary

This PR adds support for loading gzip-compressed NDJSON files in the load_ndjson() function, fixing an issue where the CLI claimed to support .ndjson.gz files but the function only used open().

Supported Formats

Format Extension Description
Uncompressed .ndjson Standard NDJSON (existing)
Gzip compressed .ndjson.gz Whole file compressed
Gzip member concatenation .bin.ndjson Each line compressed separately

Changes

  • tools/prettify_ndjson.py:

    • Added import gzip
    • Added _is_gzip_file() helper function to detect compressed files
    • Modified load_ndjson() to use gzip.open() for compressed files
    • Updated docstring to document supported formats
  • tests/test_tritonparse.py:

    • Added test_load_ndjson_gzip_support() test using existing .ndjson.gz test file

Testing

Uses existing test file: tests/example_output/parsed_output_complex/dedicated_log_triton_trace_findhao__mapped.ndjson.gz

- Support .ndjson.gz (gzip compressed) files
- Support .bin.ndjson (gzip member concatenation) files
- Add _is_gzip_file() helper function
- Add test using existing .ndjson.gz test file
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Dec 2, 2025
@FindHao FindHao marked this pull request as ready for review December 2, 2025 17:07
@meta-codesync
Copy link

meta-codesync bot commented Dec 2, 2025

@FindHao has imported this pull request. If you are a Meta employee, you can view this in D88171069.

@meta-codesync
Copy link

meta-codesync bot commented Dec 3, 2025

@FindHao merged this pull request in 24e002e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. Merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants