-
Notifications
You must be signed in to change notification settings - Fork 161
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
(feat): add async
versions of {write,read}_{elem,dispatched}
#1902
base: main
Are you sure you want to change the base?
Conversation
Benchmark changes
Warning Some benchmarks failed Comparison: https://github.com/scverse/anndata/compare/3a472c77287154746874a99e5aaa8d99bf63c1b4..8855231ff71cce6fda2de01cc6fb0b3fc8bd51fc More details: https://github.com/scverse/anndata/pull/1902/checks?check_run_id=38719466194 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1902 +/- ##
==========================================
- Coverage 86.47% 80.13% -6.35%
==========================================
Files 45 45
Lines 6774 6739 -35
==========================================
- Hits 5858 5400 -458
- Misses 916 1339 +423
🚀 New features to boost your workflow:
|
@@ -42,6 +43,32 @@ def read_dispatched( | |||
return reader.read_elem(elem) | |||
|
|||
|
|||
async def read_dispatched_async( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this doesn’t need to be a separate function.
We could just check if the callback returns something awaitable, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we would have just
def read_dispatched (...) -> Coroutine | AnnData
and then it would be up to users to deal with it? Or you mean that all of the "duplicated" code should be made to just handle coroutines and not (which I kind of like)
async
versions of read_{elem,dispatched}
async
versions of {write,read}_{elem,dispatched}
I haven't checked the code, but i see |
@Koncopd yes I am aware. This was just a first pass - we are going a different route with this feature, I think. Message me on zulip if you want more information, happy to chat. |
Yeah, i think the correct way here is to create an event loop in a separate thread and execute all async functions using this event loop, like |
async
internally forread_elem
andwrite_elem
#1897