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

Issue in kubeflow fairing library while using in vscode #558

Open
Roma110 opened this issue Aug 24, 2021 · 4 comments
Open

Issue in kubeflow fairing library while using in vscode #558

Roma110 opened this issue Aug 24, 2021 · 4 comments

Comments

@Roma110
Copy link

Roma110 commented Aug 24, 2021

/kind bug

Hi All,
Getting issue while using fairing library from VSCode GUI.
Has fairing library been tested in VSCode notebook ?
Because when i checked the code, i got the below error:

kernel_id = re.search('kernel-(.*).json', ipykernel.connect.get_connection_file()).group(1)

**Output:
/opt/conda/lib/python3.8/site-packages/kubeflow/fairing/notebook/notebook_util.py in get_notebook_name()
10 def get_notebook_name(): #pylint:disable=inconsistent-return-statements
11 """Return the full path of the jupyter notebook. """
---> 12 kernel_id = re.search('kernel-(.*).json',
13 ipykernel.connect.get_connection_file()).group(1)
14 servers = list_running_servers()

AttributeError: 'NoneType' object has no attribute 'group'

After modifying the code as below, this is the output:

import ipykernel
import re
kernel_id = re.search('(.*.json)',  ipykernel.connect.get_connection_file()).group(1)
print(kernel_id)

Output:
/tmp/tmp-3030pDALWEp8bRZ.json

The kernel name starts with "tmp- " in VSCode
But in jupyterlab , kernel name starts with "kernel-"
For example: kernel-5c890661-1206-4d97-abb7-b69c9d4610ed.json

How kubeflow-fairing can be used for vscode ?

@Roma110
Copy link
Author

Roma110 commented Sep 2, 2021

/kind bug

@Roma110
Copy link
Author

Roma110 commented Sep 2, 2021

/priority p2

@Roma110
Copy link
Author

Roma110 commented Sep 2, 2021

@jinchihe @xauthulei
Could you please respond to this issue.

@Roma110
Copy link
Author

Roma110 commented Sep 2, 2021

Hi All,
After modifying the code as below , the kernel id is fetched :

import ipykernel
import re
**kernel_id = re.search('(.*.json)',  ipykernel.connect.get_connection_file()).group(1)**
print(kernel_id)

After this, i am getting below error:

/opt/conda/lib/python3.8/site-packages/kubeflow/fairing/preprocessors/base.py in context_tar_gz(self, output_file)
    106             _, output_file = tempfile.mkstemp(prefix="/tmp/fairing_context_")
    107         logging.info("Creating docker context: %s", output_file)
--> 108         self.input_files = self.preprocess()
    109         with tarfile.open(output_file, "w:gz", dereference=True) as tar:
    110             for dst, src in self.context_map().items():

/opt/conda/lib/python3.8/site-packages/kubeflow/fairing/preprocessors/converted_notebook.py in preprocess(self)
    122         exporter.register_preprocessor(self.notebook_preprocessor, enabled=True)
    123         print(self.notebook_file)
--> 124         contents, _ = exporter.from_filename(self.notebook_file)
    125         converted_notebook = Path(self.notebook_file).with_suffix('.py')
    126         if converted_notebook.exists() and not self.overwrite:

/opt/conda/lib/python3.8/site-packages/nbconvert/exporters/exporter.py in from_filename(self, filename, resources, **kw)
    165         if not 'metadata' in resources or resources['metadata'] == '':
    166             resources['metadata'] = ResourcesDict()
--> 167         path, basename = os.path.split(filename)
    168         notebook_name = os.path.splitext(basename)[0]
    169         resources['metadata']['name'] = notebook_name

/opt/conda/lib/python3.8/posixpath.py in split(p)
    101     """Split a pathname.  Returns tuple "(head, tail)" where "tail" is
    102     everything after the final slash.  Either part may be empty."""
--> 103     p = os.fspath(p)
    104     sep = _get_sep(p)
    105     i = p.rfind(sep) + 1

TypeError: expected str, bytes or os.PathLike object, not NoneType

function does not return file name.

from kubeflow.fairing.notebook import notebook_util
print(notebook_util.get_notebook_name())

Output:
None

Could you please check ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants