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

Fix copy file operation #200

Merged
merged 4 commits into from
May 23, 2024
Merged

Conversation

mahendrapaipuri
Copy link
Contributor

@mahendrapaipuri mahendrapaipuri commented May 13, 2024

jupyter-fs's MetaManager is overriding the copy method of AsyncContentsManager. But the method get is asynchronous and hence the operation fails with following stack trace:

HTTPServerRequest(protocol='https', host='redacted', method='POST', uri='/user/redacted/jupyter_0/api/contents/tests?1715595030371', version='HTTP/1.1', remote_ip='redacted')
Traceback (most recent call last):
  File "/redacted/lib/python3.11/site-packages/tornado/web.py", line 1790, in _execute
    result = await result
             ^^^^^^^^^^^^
  File "/redacted/lib/python3.11/site-packages/jupyter_server/auth/decorator.py", line 73, in inner
    return await out
           ^^^^^^^^^
  File "/redacted/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 278, in post
    await self._copy(copy_from, path)
  File "/redactedlib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 216, in _copy
    model = await ensure_async(self.contents_manager.copy(copy_from, copy_to))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/redacted/lib/python3.11/site-packages/jupyter_core/utils/__init__.py", line 198, in ensure_async
    result = await obj
             ^^^^^^^^^
  File "/redacted/lib/python3.11/site-packages/jupyterfs/metamanager.py", line 177, in copy
    model.pop("path", None)
    ^^^^^^^^^
AttributeError: 'coroutine' object has no attribute 'pop'
[W 2024-05-13 12:10:30.398 ServerApp] wrote error: 'Unhandled error'
    Traceback (most recent call last):
      File "/redacted/lib/python3.11/site-packages/tornado/web.py", line 1790, in _execute
        result = await result
                 ^^^^^^^^^^^^
      File "/redacted/lib/python3.11/site-packages/jupyter_server/auth/decorator.py", line 73, in inner
        return await out
               ^^^^^^^^^
      File "/redacted/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 278, in post
        await self._copy(copy_from, path)
      File "/redacted/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 216, in _copy
        model = await ensure_async(self.contents_manager.copy(copy_from, copy_to))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/redacted/lib/python3.11/site-packages/jupyter_core/utils/__init__.py", line 198, in ensure_async
        result = await obj
                 ^^^^^^^^^
      File "/redacted/lib/python3.11/site-packages/jupyterfs/metamanager.py", line 177, in copy
        model.pop("path", None)
        ^^^^^^^^^
    AttributeError: 'coroutine' object has no attribute 'pop'
/redacted/lib/python3.11/site-packages/tornado/web.py:1801: RuntimeWarning: coroutine 'path_first_arg.<locals>._wrapper' was never awaited
  if self._prepared_future is not None and not self._prepared_future.done():
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Seems like the overloaded method is vestigial and this PR removes that part of the code.

* Copying files is broken with Jlab 4 due to seemingly vestigial code

* Add packages to pyproject.toml as package name does not match with directory name

Signed-off-by: Mahendra Paipuri <[email protected]>
Copy link

Binder Launch a binder notebook on branch mahendrapaipuri/jupyter-fs/fix_copy

@timkpaine timkpaine merged commit 1a84b01 into jpmorganchase:main May 23, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants