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

Experimenting with Dask integration #208

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

abkfenris
Copy link
Member

After the Dask discussion two weeks ago (see https://github.com/orgs/xpublish-community/discussions/4) I sat down and sketched out what an implementation could look like in Xpublish. It's really rough, and throughly un-tested.

This adds two local plugins and associated infrastructure for most hooks to be able to use Dask.

In most cases for different types of Dask infrastruture, a plugin that provides a get_dask_cluster() method should do the trick. The hook is set up to only return one result, and the built in plugin will be the last.

The Dask client plugin in theory should work with different types of clusters, but is similarly set up to be able to be overridden (dask-on-ray?). The client can be both sync and async, and once it gets accessed, it's cached on xpublish.Rest.

For hooks that have access to deps (which now includes dataset providers), deps.dask_sync_client and deps.dask_async_client now should give you the client.

The async client may need to be passed the current event loop. It appears the way to access the event loop varies by server, so that will probably take some research.

Adds two local plugins and associated infrastructure for most hooks to be able to use Dask.

In most cases for different types of Dask infrastruture, a plugin that provides a `get_dask_cluster()` method should do the trick. The hook is set up to only return one result, and the built in plugin will be the last.

The Dask client plugin in theory should work with different types of clusters, but is similarly set up to be able to be overridden (dask-on-ray?). The client can be both sync and async, and once it gets accessed, it's cached on `xpublish.Rest`.

For hooks that have access to `deps` (which now includes dataset providers), `deps.dask_sync_client` and `deps.dask_async_client` now should give you the client.

The async client may need to be passed the current event loop. It appears the way to access the event loop varies by server, so that will probably take some research.
- fastapi/fastapi#7876
- encode/uvicorn#706
- https://stackoverflow.com/questions/66275747/how-to-use-event-loop-created-by-uvicorn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant