Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Fix problem that unable to get notebook filename on JupyterLab 3.0 #552

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion kubeflow/fairing/notebook/notebook_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@
from notebook.notebookapp import list_running_servers
import requests
from requests.compat import urljoin
import importlib


def get_notebook_name(): #pylint:disable=inconsistent-return-statements
"""Return the full path of the jupyter notebook. """
kernel_id = re.search('kernel-(.*).json',
ipykernel.connect.get_connection_file()).group(1)
servers = list_running_servers()
jupyter_server_spec = importlib.util.find_spec("jupyter_server")
if jupyter_server_spec is not None:
from jupyter_server import serverapp
servers = serverapp.list_running_servers()
else:
servers = list_running_servers()
for ss in servers:
response = requests.get(urljoin(ss['url'], 'api/sessions'),
params={'token': ss.get('token', '')})
Expand Down