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

Add documentation and example for using a ProcessPoolExecutor #5059

Open
mrocklin opened this issue Jul 14, 2021 · 6 comments
Open

Add documentation and example for using a ProcessPoolExecutor #5059

mrocklin opened this issue Jul 14, 2021 · 6 comments
Labels
documentation Improve or add to documentation

Comments

@mrocklin
Copy link
Member

We recently added the ability to have multiple executors and annotate tasks to use those executors. A common situation where this would be useful is in farming out tasks to separate processes. This would be a good example to build.

One motivating use case is #5051

@jrbourbeau jrbourbeau added the documentation Improve or add to documentation label Jul 14, 2021
@jrbourbeau
Copy link
Member

+1 it'd be great to see an example for this. For anyone who is interested, #4869 is where the multiple executors functionality was added. Additionally, here is a test which was added

@pytest.mark.asyncio
async def test_multiple_executors(cleanup):
def get_thread_name():
return threading.current_thread().name
async with Scheduler() as s:
async with Worker(
s.address,
nthreads=2,
executor={
"GPU": ThreadPoolExecutor(1, thread_name_prefix="Dask-GPU-Threads")
},
) as w:
async with Client(s.address, asynchronous=True) as c:
futures = []
with dask.annotate(executor="default"):
futures.append(c.submit(get_thread_name, pure=False))
with dask.annotate(executor="GPU"):
futures.append(c.submit(get_thread_name, pure=False))
default_result, gpu_result = await c.gather(futures)
assert "Dask-Default-Threads" in default_result
assert "Dask-GPU-Threads" in gpu_result

which would be a good starting point for an example in the docs

@mrocklin
Copy link
Member Author

mrocklin commented Jul 14, 2021 via email

@mrocklin
Copy link
Member Author

mrocklin commented Jul 14, 2021 via email

@mrocklin
Copy link
Member Author

I have a video for this https://www.youtube.com/watch?v=vF2VItVU5zg

This isn't yet publicized. I plan to wait until after the next release. Probably we should repurpose this into an example on examples.dask.org as well.

@mrocklin
Copy link
Member Author

@pavithraes
Copy link
Member

I'd love to work on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improve or add to documentation
Projects
None yet
Development

No branches or pull requests

3 participants