Remote Debugging Python script with VS code and ttyd console

Peter Haupt

I am running a Python script plus a complex Python library. I can install both via the ttyd terminal and everything is working fine. My productivity problem is that I now have to use a editor like vi and the Python debugger pdb to debug my script. This is pretty anyoing and slow. I would like to use VS code and remote debugging. My understanding is that I need the public IP of the machine and the port to do so. But I cannot find them or the machine is even not accessible via a public IP. How can I do remote debugging with ttyd console and VS code. Thanks for your support in advance.

Comments

2 comments

  • Comment author
    Mike DNAnexus Team

    Hi Peter, please try this method:

    1) Start a ttyd job, wait for the job to start running then run dx describe job-xxxx --json | jq .host to get the host address (ex: ec2-11-22-33-44.eu-west-2.compute.amazonaws.com). Or dx describe job-xxxx --json and copy the host address.

    2) In a local terminal, ssh into the job with dx ssh job-xxxx.

    3) After 2) is finished you can close the local terminal, in VSCode use Remote-SSH extension and select Connect to Host…

    Select Add New SSH Host…

    Enter ssh -i ~/.dnanexus_config/ssh_id dnanexus@<host_address> (for example: ssh -i ~/.dnanexus_config/ssh_id dnanexus@ec2-11-22-33-44.eu-west-2.compute.amazonaws.com)

    Select the first option, which is in the format of /path/to/.ssh/config.

    4) Open Remote-SSH again and select the created host. VSCode should connect to the ttyd job after some wait time.

    1
  • Comment author
    Zhong Cao
    • Edited

    I’m wondering whether it’s possible to debug code using JupyterLab on the RAP platform. I’ve encountered an issue where debugger extensions cannot be installed due to an incompatible JupyterLab version.

    0

Please sign in to leave a comment.