Skip to content

Commit 76f767f

Browse files
Revert "[PROTON] Fix hook manager when a session is deactivated multiple times (#7743)"
This reverts commit d354fe1.
1 parent 2b212d2 commit 76f767f

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

third_party/proton/proton/hooks/hook.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,8 @@ def deactivate(session: Optional[int] = None) -> None:
7777
deactivated_hooks = set()
7878
for session in sessions:
7979
for hook in HookManager.session_hooks[session]:
80-
if hook in HookManager.active_hooks:
81-
deactivated_hooks.add(hook)
8280
HookManager.session_hooks[session][hook] = False
81+
deactivated_hooks.add(hook)
8382

8483
# Check if any other sessions rely on this hook
8584
for hook in deactivated_hooks:

third_party/proton/test/test_api.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import json
22
import triton.profiler as proton
33
import pathlib
4-
from triton.profiler.hooks.hook import HookManager
54

65

76
def test_profile_single_session(tmp_path: pathlib.Path):
@@ -100,14 +99,6 @@ def test_hook(tmp_path: pathlib.Path):
10099
temp_file = tmp_path / "test_hook.hatchet"
101100
session_id0 = proton.start(str(temp_file.with_suffix("")), hook="triton")
102101
proton.activate(session_id0)
103-
proton.activate(session_id0)
104-
assert len(
105-
HookManager.active_hooks) == 1, ("Activate a session multiple times should maintain a single instance of hook")
106-
assert list(HookManager.session_hooks[session_id0].values())[0] is True
107-
proton.deactivate(session_id0)
108-
assert list(HookManager.session_hooks[session_id0].values())[0] is False
109-
assert len(HookManager.active_hooks) == 0
110-
# Deactivate a session multiple times should not raise an error
111102
proton.deactivate(session_id0)
112103
proton.finalize(None)
113104
assert temp_file.exists()

0 commit comments

Comments
 (0)