Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Output GHA JSON files to subfolders
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarbuzzi committed Jul 3, 2024
1 parent 0661f10 commit 2da48ab
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions neuralmagic/benchmarks/scripts/logging/gha_benchmark_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ def process(json_file_path: Path) -> Iterable[Type_Record_T]:
GHARecord.from_metric_template(metric, extra=hover_data)), metrics)


def main(args: argparse.Namespace) -> None:
input_directory = Path(args.input_directory)
def process_folder(input_directory: Path):
print(f"processing folder : {input_directory}")

json_file_paths = input_directory.glob('*/*.json')

Expand All @@ -125,6 +125,8 @@ def filter_and_dump_if_non_empty(type_records: List[Type_Record_T],
If there are no records after we filter, don't dump json. otherwise,
dump all records as JSON.
"""
# put output file in matching subdir (e.g. 'benchmark_serving')
output_path = output_path.joinpath(input_directory.parent.name)
# Make output directory if it doesn't exist
output_path.parent.mkdir(parents=True, exist_ok=True)

Expand Down Expand Up @@ -156,6 +158,17 @@ def filter_and_dump_if_non_empty(type_records: List[Type_Record_T],
args.observation_metrics_output_filename))


def main(args: argparse.Namespace) -> None:
groups = ["benchmark_serving", "benchmark_throughput"]
input_base_directory = Path(args.input_directory)
input_directories = [
input_base_directory.joinpath(group) for group in groups
]

for input_directory in input_directories:
process_folder(input_directory)


if __name__ == '__main__':
parser = argparse.ArgumentParser(description="""
Process the benchmark JSONs produced by BenchmarkResult and output JSONs
Expand Down

0 comments on commit 2da48ab

Please sign in to comment.