Skip to content

Commit 718b833

Browse files
Olivia-liufacebook-github-bot
authored andcommitted
Basic "CLI" (#546)
Summary: Pull Request resolved: #546 Differential Revision: D49758493 fbshipit-source-id: 549797dd0b64f88f6fcb7640a7dc262e1d3dc51e
1 parent b1dcd99 commit 718b833

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

sdk/etdb/TARGETS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary")
12
load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
23

34
oncall("executorch")
@@ -44,6 +45,12 @@ python_library(
4445
],
4546
)
4647

48+
python_binary(
49+
name = "inspector_cli",
50+
main_module = "executorch.sdk.etdb.inspector",
51+
deps = [":inspector"],
52+
)
53+
4754
python_library(
4855
name = "inspector_utils",
4956
srcs = [

sdk/etdb/inspector.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7+
import argparse
78
import dataclasses
89
import logging
910
from collections import defaultdict, OrderedDict
@@ -489,3 +490,24 @@ def get_exported_program(self, graph: Optional[str] = None) -> ExportedProgram:
489490
if graph is None:
490491
return self._etrecord.edge_dialect_program
491492
return self._etrecord.graph_map.get(graph)
493+
494+
495+
if __name__ == "__main__":
496+
parser = argparse.ArgumentParser()
497+
parser.add_argument(
498+
"--etdump_path",
499+
required=True,
500+
help="Provide an ETDump file path.",
501+
)
502+
parser.add_argument(
503+
"--etrecord_path",
504+
required=False,
505+
help="Provide an optional ETRecord file path.",
506+
)
507+
508+
args = parser.parse_args()
509+
510+
inspector = Inspector(
511+
etdump_path=args.etdump_path, etrecord_path=args.etrecord_path
512+
)
513+
inspector.print_data_tabular()

0 commit comments

Comments
 (0)