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

[Discourse] Is it possible to map coroutines in a dask bag? #150

Closed
github-actions bot opened this issue Dec 27, 2021 · 8 comments
Closed

[Discourse] Is it possible to map coroutines in a dask bag? #150

github-actions bot opened this issue Dec 27, 2021 · 8 comments
Assignees
Labels
answered Questions that have been satisfactorily answered discourse Discussion topics coming from Discourse

Comments

@github-actions
Copy link

I was wondering if it is possible to map async functions onto a dask bag, something like:

import dask.bag as bag

async def sqr(n):
    return n**2

bag.from_sequence(range(10)).map(square).compute()

The above script will raise the f…


Would you like to know more?

Read the full article on the following website:

https://dask.discourse.group/t/is-it-possible-to-map-coroutines-in-a-dask-bag/174

@github-actions github-actions bot added awaiting-triage New issues that need to be assessed or assigned discourse Discussion topics coming from Discourse labels Dec 27, 2021
@ian-r-rose ian-r-rose removed the awaiting-triage New issues that need to be assessed or assigned label Jan 3, 2022
@ian-r-rose
Copy link
Contributor

I think the answer here is no. But it could! I think that client.submit/map can handle async functions, as of recently, and it would be reasonable to want collections to also support it.

A good response to this could

  1. Answer the question
  2. Link to the PR adding async support to Client.{submit,map}, which could be interesting
  3. Encourage the user to open an issue with a feature request

@scharlottej13
Copy link
Contributor

@pavithraes code snippet we worked on:

from dask.distributed import Client
client = await Client(asynchronous=True)

def sqr(n):
    return n**2

futures = client.map(sqr, range(10))
result = await client.gather(futures)

@pavithraes
Copy link
Contributor

pavithraes commented Jan 4, 2022

Link to the PR adding async support to Client.{submit,map}, which could be interesting

@ian-r-rose Is this the PR: dask/distributed#5151?

@ian-r-rose
Copy link
Contributor

@ian-r-rose Is this the PR: dask/distributed#5151?

Yes, that's the one! It's actually a bit more general than I had remembered. Were you able to check the current state of what works with async user-submitted functions and what does not?

@pavithraes
Copy link
Contributor

Were you able to check the current state of what works with async user-submitted functions and what does not?

We did a quick search through dask/dask and the docs, and see anything outside of client submit/map :/

@ian-r-rose
Copy link
Contributor

We did a quick search through dask/dask and the docs, and see anything outside of client submit/map :/

Sounds good, I think it's worth following up with the question asker

@pavithraes
Copy link
Contributor

Thanks, Ian!

Followed up!

@pavithraes pavithraes added the answered Questions that have been satisfactorily answered label Jan 17, 2022
@pavithraes
Copy link
Contributor

They opened an issue on dask/dask, closing this as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered Questions that have been satisfactorily answered discourse Discussion topics coming from Discourse
Projects
None yet
Development

No branches or pull requests

3 participants