Singularity remote debug support

Answered

I am trying to adapt the remote debug setup as described here: https://www.jetbrains.com/help/pycharm/remote-debugging-with-product.html

However, I am stuck at getting the SSH server up and running inside a Singuarity container. A support request has been submitted here: https://github.com/sylabs/singularity/issues/4319

The SSH server support by Singularity may take some time, so I ask pyCharm developers for an alternative:

Can I connect to a Singularity shell from pyCharm to carry out remote debugging of python code?

The connection will be like this: Laptop running pyCharm -> SSH to Singularity Host -> run singularity shell instance://<instancename> -> Debug

Currently, at the final step of adding a remote interpreter, the sanity check refuse a call to the python inside a running instance (see image below)

 

5 comments
Comment actions Permalink

Progress so far:

I created a wrapper script on remote host at /home/user/bin/spython:

```

#!/usr/bin/env bash
singularity exec instance://sshd /usr/bin/python3 "$@"

```

 

And insert " /home/user/bin/spython" into that interpreter path, it seems to be working for a simple debug. I still don't see how it will behave with a more complex codebase

0
Comment actions Permalink

Hi,

There is no support for that at the moment. Feel free to vote for the corresponding feature request https://youtrack.jetbrains.com/issue/IDEA-197405 and leave comments. (visible to Registered Users only)

0
Comment actions Permalink

Hi,

The wrapper trick did not work for me as pycharm (2018.3 PRO) has detected it is not a proper interpreter.

I will go with pydevd remote debugging. It worked fine in any remote/scheduled/unusual situation we had so far.

0
Comment actions Permalink

@Michael

I tried with pyCharm Pro 2019.2

0
Comment actions Permalink

I have a decent solution with pydevd and BashSupport

I installed pydevd in my singularity image

    python3 -m pip install pydevd

Prepared a remote python debugger in pycharm and add pydevd.settrace in my code

       pydevd.settrace('localhost', port=6643, stdoutToServer=True, stderrToServer=True)

Prepared a bash run configuration where:

- singularity is the interpreter

- interpreter option are my singularity options + the local python command

- the script is my python main

- the program argument are my python executable arguments

 

I start the remote debug console from pycharm and keep it running

Then I can start/stop/restart the singularity configuration and it automatically connect/reconnect to the remote debug

0

Please sign in to leave a comment.