Working from Remote
As an alternative to working in the UI, you can also work from remote. The features include:
- Easy ssh / scp into the pod (instead of cumbersome kubectl exec/cp)
- Jupyter Notebook frontend inside vs-code
- Full Python debugger (including setting breakpoints in dependent python modules, etc.)
- Enable ssh in the jupyter pod (either at creation or after the fact by using the
- On the desktop add an entry for the pod to
~/.ssh/config. For example, with a pod at address
Host vmdev76.admin.jupyter2 HostName default-tenant.app.vmdev76.lab.iguazeng.com User iguazio // notice the 'i' is not capital - unlike in the GUI produced message Port 30003 PreferredAuthentications publickey IdentityFile /home/<uname>/.ssh/id_rsa_vmdev76_jupyter2 // the private key is copied from the GUI ForwardAgent yes
- chmod the IdentityFile to 600.
- Check that ssh into the pod works:
Setting up the Remote Workspace
- Install vs-code Remote-ssh extension.
- From vs-code command-pallet select
Remote-ssh: Connect to hostand provide the pod address (for example, vmdev76.admin.jupyter2).
open-folderfrom the vs-code menu, and enter
/v3io/users/<user>to add the home-dir of user
as a folder in the vs-code workspace.
- Install extensions in the remote: python, jupyter (might need to switch to a pre-release version).
- Select python interpreter "base" (/conda/bin/python).
- Open the notebook of interest from remote (
open-file), or your desktop (check
show-localin the open-file dialog box).
See more details in Remote Development using SSH.
Full Python Debugging
To debug a cell, first press
execute-above-cells (located above and to the right of the cell) to execute all cells up to the cell of interest.
Then, select between these two options for debugging the cell:
- Run by line — Press
execute-above-cells(located above and to the right of the cell) to execute all cells up to this cell.
- Debug cell — Press
Debug cellto run the individual cell with full python debugger (adding debug breakpoints as usual in vs-code).
Adding Packages of Interest (mlrun, storey, etc.) for
To find the location of the package (for example storey package)
- Run from a python shell (inside the jupyter pod):
help (storey): prints the path to the package, should be at
- From vs-code menu select:
- If setting breakpoints in dependent modules is required, you can set
"jupyter.debugJustMyCode": falseto disable the “Just My Code” debug feature, meaning it steps through library code, in addition to your code. Alternatively (if debugJustMyCode does not work), you can patch pydevd.py by:
Find the file to patch:
import pydevd print(pydevd._file_)
(should be similar to
use_libraries_filter=Falseas its the first line.
Restart the kernel.