(sources: Sequence[Path])
| 41 | |
| 42 | |
| 43 | def _crawl_sources(sources: Sequence[Path]) -> Tuple[pd.DataFrame, Collection[BenchmarkMetadata]]: |
| 44 | results_df_list = [] |
| 45 | results_metadata = [] |
| 46 | visited = set() |
| 47 | queue = list(sources) |
| 48 | while queue: |
| 49 | source = queue.pop() |
| 50 | |
| 51 | source = source.resolve() |
| 52 | assert source.is_dir() |
| 53 | # Sym-links can cause cycles - don't visit the same directory multiple times... |
| 54 | if source in visited: |
| 55 | continue |
| 56 | visited.add(source) |
| 57 | |
| 58 | metrics_df_path = source / "metrics.csv" |
| 59 | metadata_path = source / "metadata.json" |
| 60 | if metrics_df_path.exists() or metadata_path.exists(): |
| 61 | assert metrics_df_path.exists() |
| 62 | assert metadata_path.exists() |
| 63 | results_df_list.append(pd.read_csv(metrics_df_path)) |
| 64 | with open(metadata_path, "rt") as f: |
| 65 | results_metadata.append(BenchmarkMetadata.from_json(json.load(f))) |
| 66 | |
| 67 | for child in source.iterdir(): |
| 68 | if child.is_dir(): |
| 69 | queue.append(child) |
| 70 | |
| 71 | results_df = pd.concat(results_df_list, axis="index", ignore_index=True) |
| 72 | return results_df, results_metadata |
| 73 | |
| 74 | |
| 75 | def plot( |
searching dependent graphs…