Load and return the 'traceEvents' list from a gzip-compressed JSON trace file.
(trace_file_path: Path)
| 58 | |
| 59 | |
| 60 | def get_trace_file_objects(trace_file_path: Path) -> list[Dict[str, Any]]: |
| 61 | """ |
| 62 | Load and return the 'traceEvents' list from a gzip-compressed JSON trace file. |
| 63 | """ |
| 64 | try: |
| 65 | with gzip.open(trace_file_path, "rt", encoding="utf-8") as file: |
| 66 | data = json.load(file) |
| 67 | except (OSError, json.JSONDecodeError) as e: |
| 68 | raise ValueError(f"Failed to read or parse trace file {trace_file_path}: {e}") |
| 69 | |
| 70 | if "traceEvents" not in data: |
| 71 | raise KeyError(f"'traceEvents' key not found in {trace_file_path}") |
| 72 | |
| 73 | return data["traceEvents"] |
| 74 | |
| 75 | |
| 76 | def get_subops(df_group: pd.DataFrame) -> set: |
no test coverage detected