[BUG] async not working?
See original GitHub issueWhat happened:
As a warmup, we’ve been trying to do async fs.exists()
for abfs
and are unsure if async is not supported, version issue, bug on our end, etc
What you expected to happen:
Async existence check returns True
/ False
, not an exception
Minimal Complete Verifiable Example:
fs = fsspec.filesystem('abfs', asynchronous=True, account_name='...', account_key='...')
#session = await fs.set_session() # exn: no method defined
await fs.exists('abfs://container/folder/file') # exn: Loop is not running
Anything else we need to know?:
Environment:
- Dask version:
2021.04.0
- fsspec:
2021.06.01
- adlfs:
v0.7.3
- Python version: 3.7
- Operating System: Ubuntu
- Install method (conda, pip, source): conda (rapids 0.19) + updates
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
[BUG] async not working? · Issue #253 · fsspec/adlfs - GitHub
As a warmup, we've been trying to do async fs.exists() for abfs and are unsure if async is not supported, version issue, bug...
Read more >Async inside async function bug - node.js - Stack Overflow
I am trying to call simple view and within that I am making another query with the data from the view. My problem...
Read more >Error handling with async/await and promises, n² ... - CatchJS
Async await error handling has a bunch of edge cases. Here's the full run down of how to ... Using the .catch(() =>...
Read more >Async/await - The Modern JavaScript Tutorial
So, async ensures that the function returns a promise, and wraps non-promises in it. Simple enough, right? But not only that. There's another ......
Read more >An Async Example - Jest
error : `User with ${userID} not found.`, }), ); }); }. Now let's write a test for our async functionality. __tests__/user-test.js.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
At this point in time, the asynchronous parameter introduced by fsspec will not enable adlfs to be called asynchronously (i.e. using the
await
keyword). Instead, operations within the package are executed asynchronously, such that traditional sync calls (i.e.fs.exists()
) triggers async execution under the hood.Adding direct async calls under the hood is on the roadmap.
@lmeyerov , have you tried (note the underscore)
?
This is how it is spelled in the other async implementations. In async mode, you must not call any of the methods that call
sync()
.Simpler than implementing and exposing a lock, would be to make the filecache threadsafe. It’s the updating of the metadata file that can cause (occasional) races, if someone wants to have a go. (It is also possible that two threads download the same file simultaneously, which is not critical, but would be wasteful). The same is true for blockcache, although it should be checked whether the same file can be opened from multiple threads.
Correct, if you have asynchronous=True, you should be using await and coroutines only, and the loop is the current running loop. By default, fsspec has its own loop in a thread. Tthe parameter is there for two cases:
Yes, we have talked about the possibility to treat IO tasks differently in dask, but no concrete work yet. In some cases, IO can use significant CPU (e.g., HTTP automatic compression/encryption); what really sets IO apart is high latency. It may be reasonable for a dask thread to secede during an fsspec blocking call.