Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pickling: jupyter notebooks #557

Open
zlobober opened this issue Apr 29, 2024 · 5 comments
Open

Pickling: jupyter notebooks #557

zlobober opened this issue Apr 29, 2024 · 5 comments
Labels
SDK SDK related

Comments

@zlobober
Copy link
Collaborator

Pickling is known not to be working when working in Jupyter/IPyNotebook.
It would be great to investigate the root cause of that and, ideally, to come up with a workaround.

Reproduce: yt.run_map(identity, ...) where identity is def identity(record): yield record.

@Kontakter Kontakter added the SDK SDK related label Apr 30, 2024
@thenno
Copy link
Contributor

thenno commented Apr 30, 2024

Jupyterlab works on macbook m1. How to reproduce:

  1. Install pyenv https://github.com/pyenv/pyenv
  2. Install python 3.8: pyenv install 3.8 (this version works on our cluster by default)
  3. Create and activate venv pyenv virtualenv 3.8 ytwrappertest && pyenv activate ytwrappertest
  4. Install yt client and jupyter lab pip install jupyterlab==4.1.8 ytsaurus-client==0.13.14 ytsaurus-yson==0.4.5
  5. Run jupyterlab YT_TOKEN="my token" YT_PROXY="my yt cluster" jupyter lab
  6. Run notebook https://github.com/thenno/yt-on-jupyter-lab-example/blob/main/ytwrapperplusjupyter.ipynb

Maybe there are some differences between jupyter notebook / jupyter lab, but as far as I know the differences are only in the frontend.

@thenno
Copy link
Contributor

thenno commented May 1, 2024

There is a problem using class-based operations. For some reason yt client can't pickle classes.

How to reproduce: https://github.com/thenno/yt-on-jupyter-lab-example/blob/main/ytwrapperplusjupyter_broken.ipynb

Traceback (most recent call last):
  File "_py_runner.py", line 174, in <module>
    main()
  File "_py_runner.py", line 170, in main
    yt.wrapper.py_runner_helpers.process_rows(__operation_dump_filename, __config_dump_filename, start_time=start_time)
  File "/slot/sandbox/./tmpfs/modules/yt/wrapper/py_runner_helpers.py", line 309, in process_rows
    operation, params = unpickler.load(f_operation_dump)
  File "/slot/sandbox/./tmpfs/modules/yt/packages/dill/_dill.py", line 373, in load
    return Unpickler(file, ignore=ignore, **kwds).load()
  File "/slot/sandbox/./tmpfs/modules/yt/packages/dill/_dill.py", line 647, in load
    obj = StockUnpickler.load(self)
  File "/slot/sandbox/./tmpfs/modules/yt/packages/dill/_dill.py", line 637, in find_class
    return StockUnpickler.find_class(self, module, name)
AttributeError: Can't get attribute 'Mapper' on <module '_main_module' from '/slot/sandbox/_main_module.py'>

@dmi-feo
Copy link
Contributor

dmi-feo commented May 3, 2024

For some reason yt client can't pickle classes.

minor, but: it seems it can pickle, but can't unpickle, according to your traceback

@dmi-feo
Copy link
Contributor

dmi-feo commented May 6, 2024

The issue is not reproduced if pickling/framework set to cloudpickle, which is designed to work with stuff like jupyter notebooks

@dmi-feo
Copy link
Contributor

dmi-feo commented May 6, 2024

robot-piglet pushed a commit that referenced this issue May 15, 2024
#557

---
7d5c4588dd4fce50b32af6ab89c6c9586b86d5e4

Pull Request resolved: #582

Co-authored-by: ignat <ignat@ytsaurus.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SDK SDK related
Projects
None yet
Development

No branches or pull requests

4 participants