(proto_dir: Path)
| 398 | |
| 399 | |
| 400 | def load_bench_pb2(proto_dir: Path): |
| 401 | bench_pb2_path = proto_dir / "bench_pb2.py" |
| 402 | if not bench_pb2_path.exists(): |
| 403 | raise FileNotFoundError( |
| 404 | f"{bench_pb2_path} does not exist. Run benchmarks/python/run.sh first to generate protobuf bindings." |
| 405 | ) |
| 406 | proto_dir_abs = str(proto_dir.resolve()) |
| 407 | if proto_dir_abs not in sys.path: |
| 408 | sys.path.insert(0, proto_dir_abs) |
| 409 | import bench_pb2 # type: ignore |
| 410 | |
| 411 | return bench_pb2 |
| 412 | |
| 413 | |
| 414 | def to_pb_struct(bench_pb2, obj: NumericStruct): |