torchrunx icon indicating copy to clipboard operation
torchrunx copied to clipboard

Support debugger

Open apoorvkh opened this issue 1 year ago • 2 comments

apoorvkh avatar Sep 29 '24 18:09 apoorvkh

https://github.com/microsoft/debugpy

apoorvkh avatar Nov 03 '24 02:11 apoorvkh

https://code.visualstudio.com/docs/python/debugging#_remote-script-debugging-with-ssh

Basically the way this would work:

  • Selected worker (which the debugger will connect to) will start the debugging server (and wait for the connection), right before executing worker_args.function(). All workers should also set a barrier().
import debugpy

local_ip: str
random_port: int

debugpy.listen((local_ip, random_port))
debugpy.wait_for_client()
  • Launcher should start a TCP tunnel (via SSH forwarding) to that port. Launcher should print the local mapped port.
  • User can attach Python debugger in vscode to that local port.

apoorvkh avatar Feb 16 '25 04:02 apoorvkh