You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Xuanwo (via GitHub)" <gi...@apache.org> on 2023/11/04 02:15:15 UTC
[I] bindings/python: Use GILProtected instead to Mutex [incubator-opendal]
Xuanwo opened a new issue, #3482:
URL: https://github.com/apache/incubator-opendal/issues/3482
We might be able to use [`GILProtected`](https://docs.rs/pyo3/0.19.2/pyo3/sync/struct.GILProtected.html) instead of `Mutex` here since python object access is already synchronized with Python GIL.
_Originally posted by @messense in https://github.com/apache/incubator-opendal/pull/3474#discussion_r1382307159_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bindings/python: Use GILProtected instead to Mutex [incubator-opendal]
Posted by "Justin-Xiang (via GitHub)" <gi...@apache.org>.
Justin-Xiang commented on issue #3482:
URL: https://github.com/apache/incubator-opendal/issues/3482#issuecomment-1798235280
Thank You! @Xuanwo
Hi, @messense , I'm Justin, I'm trying to replace Mutex with GILProtected.
take `fn close` for example, I can change state this way based on the GILProtected document.
```rust
pub struct GILFile(Ars GILProtected‹GILFileState>>);
enum GILFileState{
Reader(ocore::Reader),
Writer(ocore::Writer),
Closed,
}
impl GILFile{
fn close<'p>(&'p mut self, py: Python<'p>) -> PyResult<()> {
Python::with_gil(|py| {
let mut state = self.0.get(py);
*state.borrow_mut() = &GILFileState::Closed;
});
Ok(())
}
}
```
But I don't know how to convert this to `future`, I can't put them in the `async move` function body
Anyone else who knows how to deal with it can make a PR though I'm the assignee.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bindings/python: Use GILProtected instead to Mutex [incubator-opendal]
Posted by "hanxuanliang (via GitHub)" <gi...@apache.org>.
hanxuanliang commented on issue #3482:
URL: https://github.com/apache/incubator-opendal/issues/3482#issuecomment-1804070850
Can I have a try? Recently learning some usage of PyO3, want to try to contribute
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bindings/python: Use GILProtected instead to Mutex [incubator-opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on issue #3482:
URL: https://github.com/apache/incubator-opendal/issues/3482#issuecomment-1810185261
Thanks for the effort from @Justin-Xiang and @hanxuanliang. It seems not funcational to use `GILProtected` to replace `Mutex`. I will close this issue now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bindings/python: Use GILProtected instead to Mutex [incubator-opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on issue #3482:
URL: https://github.com/apache/incubator-opendal/issues/3482#issuecomment-1804112601
> Can I have a try? Recently learning some usage of PyO3, want to try to contribute
Thanks a lot!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bindings/python: Use GILProtected instead to Mutex [incubator-opendal]
Posted by "messense (via GitHub)" <gi...@apache.org>.
messense commented on issue #3482:
URL: https://github.com/apache/incubator-opendal/issues/3482#issuecomment-1809785515
Thanks for investing time into it, I took a look, it seems that it's not easy to implement due to how `pyo3-asyncio` and async Rust work, probably very hard to making it compile.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bindings/python: Use GILProtected instead to Mutex [incubator-opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on issue #3482:
URL: https://github.com/apache/incubator-opendal/issues/3482#issuecomment-1797877614
Hi, @Justin-Xiang, you can post your questions here. @messense is one of the committers of pyo3.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bindings/python: Use GILProtected instead to Mutex [incubator-opendal]
Posted by "hanxuanliang (via GitHub)" <gi...@apache.org>.
hanxuanliang commented on issue #3482:
URL: https://github.com/apache/incubator-opendal/issues/3482#issuecomment-1809508212
Can I submit a draft PR first? I'm not sure if my changes are correct.
@messense
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bindings/python: Use GILProtected instead to Mutex [incubator-opendal]
Posted by "Justin-Xiang (via GitHub)" <gi...@apache.org>.
Justin-Xiang commented on issue #3482:
URL: https://github.com/apache/incubator-opendal/issues/3482#issuecomment-1803840094
unassign me since I'm focusing on the tests part right now
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bindings/python: Use GILProtected instead to Mutex [incubator-opendal]
Posted by "messense (via GitHub)" <gi...@apache.org>.
messense commented on issue #3482:
URL: https://github.com/apache/incubator-opendal/issues/3482#issuecomment-1800901105
@Justin-Xiang Could you open a draft PR with what you have written so far?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bindings/python: Use GILProtected instead to Mutex [incubator-opendal]
Posted by "Justin-Xiang (via GitHub)" <gi...@apache.org>.
Justin-Xiang commented on issue #3482:
URL: https://github.com/apache/incubator-opendal/issues/3482#issuecomment-1793312632
@Xuanwo Hi, I'd like to do this job.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bindings/python: Use GILProtected instead to Mutex [incubator-opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on issue #3482:
URL: https://github.com/apache/incubator-opendal/issues/3482#issuecomment-1793312759
> @Xuanwo Hi, I'd like to do this job.
Welcome!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bindings/python: Use GILProtected instead to Mutex [incubator-opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo closed issue #3482: bindings/python: Use GILProtected instead to Mutex
URL: https://github.com/apache/incubator-opendal/issues/3482
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org