Skip to content

Commit c8b25c0

Browse files
masnesralChao1Han
authored andcommitted
Call internal log_compilation_event if it exists (pytorch#164855)
Summary: For internal conda on mast jobs, call the internal version of log_compilation_event if it exists. Test Plan: Ran a simple test job that just calls the API: https://fburl.com/scuba/dynamo_compile/dqx8d10g Pull Request resolved: pytorch#164855 Approved by: https://github.com/c00w
1 parent 68d206e commit c8b25c0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

torch/_utils_internal.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
from torch._strobelight.compile_time_profiler import StrobelightCompileTimeProfiler
1414

1515

16+
try:
17+
from pt2_internal import ( # type: ignore[import-not-found]
18+
log_compilation_event as internal_log_compilation_event,
19+
)
20+
except ImportError:
21+
internal_log_compilation_event = None
22+
1623
_T = TypeVar("_T")
1724
_P = ParamSpec("_P")
1825

@@ -128,7 +135,10 @@ def add_mlhub_insight(category: str, insight: str, insight_description: str):
128135

129136

130137
def log_compilation_event(metrics):
131-
log.info("%s", metrics)
138+
if internal_log_compilation_event:
139+
internal_log_compilation_event(vars(metrics))
140+
else:
141+
log.info("%s", metrics)
132142

133143

134144
def upload_graph(graph):

0 commit comments

Comments
 (0)