Skip to content

Commit 73f699a

Browse files
Olivia-liufacebook-github-bot
authored andcommitted
Remove Inspector API usage from lib.py (#327)
Summary: Pull Request resolved: #327 Revert what I did to lib.py in D48456830. Reasoning: 1. We redesigned the Inspector interface in D49099840, so the Inspector won't work with the lib.py on master anymore; 2. We initially wanted to invoke Inspector from lib.py, but then later decided to have the user interact with Inspector directly. Users will be able to enter a CLI debugging flow from the Inspector directly. Once that's implemented and landed, we can then work on removing duplicated CLI features from lib.py. Reviewed By: Jack-Khuu Differential Revision: D49249836 fbshipit-source-id: 7d5a8a59764e639db699c2f3a52723d112698841
1 parent c5fecc8 commit 73f699a

File tree

2 files changed

+2
-39
lines changed

2 files changed

+2
-39
lines changed

sdk/TARGETS

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ python_library(
1212
deps = [
1313
"//executorch/sdk/edir:et_schema",
1414
"//executorch/sdk/etdb:etdb",
15-
"//executorch/sdk/etdb:inspector",
1615
"//executorch/sdk/etrecord:etrecord",
1716
],
1817
)
@@ -24,7 +23,6 @@ python_binary(
2423
deps = [
2524
"//executorch/sdk/edir:et_schema",
2625
"//executorch/sdk/etdb:etdb",
27-
"//executorch/sdk/etdb:inspector",
2826
"//executorch/sdk/etrecord:etrecord",
2927
],
3028
)

sdk/lib.py

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
import argparse
88
import asyncio
99
import os
10-
from typing import Mapping, Optional, Union
10+
from typing import Mapping, Optional
1111

1212
from executorch.sdk.edir.et_schema import (
1313
FXOperatorGraph,
1414
InferenceRun,
1515
OperatorGraphWithStats,
1616
)
1717
from executorch.sdk.etdb.etdb import debug_graphs
18-
from executorch.sdk.etdb.inspector import Inspector
1918
from executorch.sdk.etrecord import ETRecord, parse_etrecord
2019

2120
"""
@@ -87,30 +86,6 @@ def debug_etrecord_path(
8786
debug_etrecord(parse_etrecord(etrecord_path), et_dump_path, verbose)
8887

8988

90-
def gen_inspector_from_etrecord(
91-
etrecord: Union[str, ETRecord],
92-
etdump_path: Optional[str] = None,
93-
show_stack_trace: Optional[bool] = False,
94-
verbose: Optional[bool] = False,
95-
) -> Inspector:
96-
"""
97-
API that creates an Inspector instance based on a file path to an ETRecord instance
98-
or an ETRecord instance and optional parameters including a file path to an ETDump
99-
"""
100-
if isinstance(etrecord, str):
101-
etrecord = parse_etrecord(etrecord_path=str(etrecord))
102-
103-
op_graph_dict: Mapping[str, OperatorGraphWithStats] = _gen_graphs_from_etrecord(
104-
etrecord=etrecord
105-
)
106-
if etdump_path is not None:
107-
_gen_and_attach_metadata(op_graph_dict=op_graph_dict, et_dump_path=etdump_path)
108-
109-
return Inspector(
110-
op_graph_dict=op_graph_dict, show_stack_trace=show_stack_trace, verbose=verbose
111-
)
112-
113-
11489
"""
11590
SDK Binary
11691
"""
@@ -125,10 +100,6 @@ def parse_args():
125100
action="store_true",
126101
help="Whether the terminal should display in verbose mode",
127102
)
128-
parser.add_argument(
129-
"--show_stack_trace",
130-
help="Whether to show stack trace in the output tables",
131-
)
132103
return parser.parse_args()
133104

134105

@@ -139,13 +110,7 @@ async def main() -> int:
139110
Only required argument is an et_record path
140111
"""
141112
args = parse_args()
142-
et_inspector = gen_inspector_from_etrecord(
143-
etrecord=args.et_record,
144-
etdump_path=args.et_dump,
145-
show_stack_trace=args.show_stack_trace,
146-
verbose=args.verbose,
147-
)
148-
et_inspector.cli_flow()
113+
debug_etrecord_path(args.et_record, args.et_dump, args.verbose)
149114
return 0
150115

151116

0 commit comments

Comments
 (0)