Skip to content

Commit

Permalink
Ignore trace stats file in fmt command
Browse files Browse the repository at this point in the history
The command was failing for snapshot directories containing both trace
and trace stats snapshots because it assumes that all json files are
trace snapshots.

Just ignore the trace stats snapshots for now.
  • Loading branch information
Kyle-Verhoog committed Apr 1, 2022
1 parent 1ea0020 commit ee9c03c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions ddapm_test_agent/fmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,18 @@ def main(args: Optional[List[str]] = None) -> None:
resolved_files = _resolve_files(parsed_args.files)
log.info("Found %d snapshot files to process", len(resolved_files))

trace_files = []
trace_stats_files = []
for f in resolved_files:
if f.endswith("_tracestats.json"):
trace_stats_files.append(f)
else:
trace_files.append(f)
log.info("Found %d trace snapshot files to process", len(trace_files))
log.info("Found %d trace stats snapshot files to process", len(trace_stats_files))

has_errors = False
for fname in resolved_files:
for fname in trace_files:
log.debug("Checking snapshot file %r", fname)
try:
# Read the original file data
Expand All @@ -107,7 +117,7 @@ def main(args: Optional[List[str]] = None) -> None:
log.info("Snapshot file %r was formatted", fname)

except Exception:
log.error("Error processing file %r", fname)
log.exception("Error processing file %r", fname)
has_errors = True

if has_errors:
Expand Down

0 comments on commit ee9c03c

Please sign in to comment.