mirror of
https://github.com/wassname/ray.git
synced 2026-07-16 11:21:10 +08:00
Fix continue for debugger (#12862)
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user