Fix continue for debugger (#12862)

This commit is contained in:
Philipp Moritz
2020-12-16 16:09:13 -08:00
committed by GitHub
parent dd522a71a1
commit ad036fd564
2 changed files with 34 additions and 0 deletions
+27
View File
@@ -37,6 +37,33 @@ def test_ray_debugger_breakpoint(shutdown_only):
ray.get(result)
@pytest.mark.skipif(
platform.system() == "Windows", reason="Failing on Windows.")
def test_ray_debugger_commands(shutdown_only):
ray.init(num_cpus=2)
@ray.remote
def f():
ray.util.pdb.set_trace()
result1 = f.remote()
result2 = f.remote()
# Make sure that calling "continue" in the debugger
# gives back control to the debugger loop:
p = pexpect.spawn("ray debug")
p.expect("Enter breakpoint index or press enter to refresh: ")
p.sendline("0")
p.expect("-> ray.util.pdb.set_trace()")
p.sendline("c")
p.expect("Enter breakpoint index or press enter to refresh: ")
p.sendline("0")
p.expect("-> ray.util.pdb.set_trace()")
p.sendline("c")
ray.get([result1, result2])
@pytest.mark.skipif(
platform.system() == "Windows", reason="Failing on Windows.")
def test_ray_debugger_stepping(shutdown_only):
+7
View File
@@ -125,6 +125,13 @@ class RemotePdb(Pdb):
do_q = do_exit = do_quit
def do_continue(self, arg):
self.__restore()
self.handle.connection.close()
return Pdb.do_continue(self, arg)
do_c = do_continue
def set_trace(self, frame=None):
if frame is None:
frame = sys._getframe().f_back