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

Unable to get notebook filename on JupyterLab 3.0 #551

Open
kangwoo opened this issue Feb 27, 2021 · 0 comments · May be fixed by #552
Open

Unable to get notebook filename on JupyterLab 3.0 #551

kangwoo opened this issue Feb 27, 2021 · 0 comments · May be fixed by #552
Labels

Comments

@kangwoo
Copy link

kangwoo commented Feb 27, 2021

/kind bug

What steps did you take and what happened:

  • The following code was executed in JupyterLab 3.0.
    import uuid
    from kubeflow import fairing

    CONTAINER_REGISTRY = 'kangwoo'

    namespace = 'admin'
    job_name = f'fairing-notebook-append-job-{uuid.uuid4().hex[:4]}'

    fairing.config.set_builder('append', registry=CONTAINER_REGISTRY, image_name="fairing-notebook-append-job",
                               base_image="tensorflow/tensorflow:2.1.0-py3")

    fairing.config.set_deployer('job', namespace=namespace, job_name=job_name, cleanup=False, stream_log=True)

    fairing.config.run()
  • Error
~/.local/lib/python3.6/site-packages/kubeflow/fairing/preprocessors/converted_notebook.py in preprocess(self)
    119         exporter = nbconvert.PythonExporter()
    120         exporter.register_preprocessor(self.notebook_preprocessor, enabled=True)
--> 121         contents, _ = exporter.from_filename(self.notebook_file)
    122         converted_notebook = Path(self.notebook_file).with_suffix('.py')
    123         if converted_notebook.exists() and not self.overwrite:

/usr/local/lib/python3.6/dist-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

/usr/lib/python3.6/posixpath.py in split(p)
    105     """Split a pathname.  Returns tuple "(head, tail)" where "tail" is
    106     everything after the final slash.  Either part may be empty."""
--> 107     p = os.fspath(p)
    108     sep = _get_sep(p)
    109     i = p.rfind(sep) + 1

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

What did you expect to happen:

Anything else you would like to add:
Utility function does not return file name.
In[]

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

Out[]

None

Environment:

  • Fairing version: 1.0.2
  • Kubeflow version: 1.2.0
  • Minikube version:
  • Kubernetes version: 1.20.1
  • OS (e.g. from /etc/os-release): Ubuntu 20.04.2 LTS

NOTE:

@kangwoo kangwoo changed the title Unable to get notebook filename from JupyterLab 3.0 Unable to get notebook filename on JupyterLab 3.0 Feb 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants