Skip to content

feat(bindings/python): Enable BlockingLayer for non-blocking services that don't support blocking#3198

Merged
Xuanwo merged 1 commit intoapache:mainfrom
messense:python-blocking-layer
Sep 28, 2023
Merged

feat(bindings/python): Enable BlockingLayer for non-blocking services that don't support blocking#3198
Xuanwo merged 1 commit intoapache:mainfrom
messense:python-blocking-layer

Conversation

@messense
Copy link
Copy Markdown
Member

Not sure why but it doesn't really work currently.

Python 3.11.0 (main, Oct 25 2022, 16:25:24) [Clang 14.0.0 (clang-1400.0.29.102)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.9.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import opendal

In [2]: op = opendal.Operator("s3", bucket="test", region="us-east-1")

In [3]: op.list("/")
---------------------------------------------------------------------------
Error                                     Traceback (most recent call last)
Cell In[3], line 1
----> 1 op.list("/")

Error: Unsupported (permanent) at blocking_list, context: { service: s3, path: / } => operation is not supported

@github-actions github-actions Bot added the releases-note/feat The PR implements a new feature or has a title that begins with "feat" label Sep 27, 2023
@Xuanwo
Copy link
Copy Markdown
Member

Xuanwo commented Sep 28, 2023

Not sure why but it doesn't really work currently.

Seems it's not the latest code. I tested this PR locally with pyo3_runtime.PanicException error:

:) python
>>> import opendal
>>> op = opendal.Operator("s3", bucket="test", region="us-east-1")
thread '<unnamed>' panicked at 'blocking layer must be created: Unexpected (permanent) at  => failed to get current handle
', bindings/python/src/lib.rs:70:59
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
pyo3_runtime.PanicException: blocking layer must be created: Unexpected (permanent) at  => failed to get current handle

@messense
Copy link
Copy Markdown
Member Author

That's odd, I've definitely rebased onto main before building... Anyway, it'd be nice to be able to use Operator with services that doesn't support blocking operations natively in Python.

Comment thread bindings/python/src/lib.rs
@messense messense force-pushed the python-blocking-layer branch from 27f883a to 9141d57 Compare September 28, 2023 03:59
@messense messense changed the title feat(bindings/python): Enable BlockLayer for on-blocking services that don't support blocking feat(bindings/python): Enable BlockLayer for non-blocking services that don't support blocking Sep 28, 2023
@messense messense changed the title feat(bindings/python): Enable BlockLayer for non-blocking services that don't support blocking feat(bindings/python): Enable BlockingLayer for non-blocking services that don't support blocking Sep 28, 2023
@messense messense force-pushed the python-blocking-layer branch from 9141d57 to 81354a2 Compare September 28, 2023 04:01
Copy link
Copy Markdown
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Xuanwo Xuanwo merged commit 838cea9 into apache:main Sep 28, 2023
@messense messense deleted the python-blocking-layer branch September 28, 2023 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bindings/python releases-note/feat The PR implements a new feature or has a title that begins with "feat"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants