Skip to content

Run preload at import, start, and teardown - #3673

Merged
jrbourbeau merged 3 commits into
dask:masterfrom
mrocklin:preload-import
Apr 7, 2020
Merged

jrbourbeau merged 3 commits into
dask:masterfrom
mrocklin:preload-import

Conversation

@mrocklin

@mrocklin mrocklin commented Apr 5, 2020

Copy link
Copy Markdown
Member

Previously we only ran preload scripts after the server had started.
This made it difficult to modify the server before certain actions had
taken place. For example, a test in this PR registers a new Comm
backend for the server to use. This would not have been possible
before.

Now we run different preload functions when

  1. we first instantiate the server
  2. we first start the server
  3. we close the server (we used to run teardown at atexit time

cc @pentschev I think that you asked for this at one point.

Previously we only ran preload scripts after the server had started.
This made it difficult to modify the server before certain actions had
taken place.  For example, a test in this PR registers a new Comm
backend for the server to use.  This would not have been possible
before.

Now we run different preload functions when

1.  we first instantiate the server
2.  we first start the server
3.  we close the server (we used to run teardown at `atexit` time
@mrocklin

mrocklin commented Apr 6, 2020

Copy link
Copy Markdown
Member Author

Merging in 24 hours if there are no comments

@pentschev pentschev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for working on this @mrocklin .

As you mentioned that I once wanted something like this, we have solved that with UCX initializing itself via Dask configurations. I would have to rethink whether something is missing, but this could be useful for UCX.

@jrbourbeau jrbourbeau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mrocklin. Left a few small comments about docstrings, otherwise the changes here LGTM

Comment thread distributed/preloading.py Resolved
Comment thread distributed/preloading.py Outdated


async def on_start(names, parameter=None, file_dir=None, argv=None):
""" Imports modules, handles `dask_setup` and `dask_teardown`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
""" Imports modules, handles `dask_setup` and `dask_teardown`.
""" Imports modules and handles ``dask_setup``.

Comment thread distributed/preloading.py Resolved
Comment thread distributed/preloading.py Resolved
Comment thread distributed/preloading.py Resolved
Comment thread distributed/preloading.py Resolved
@mrocklin

mrocklin commented Apr 7, 2020

Copy link
Copy Markdown
Member Author

Thanks for the review @jrbourbeau . I believe I've handled everything. I also changed things up slightly so that we're now passing around the imported modules.

I plan to follow up on this PR with a PR that supports preloads for the Nanny.

@jrbourbeau
jrbourbeau merged commit bd84d9d into dask:master Apr 7, 2020
@mrocklin
mrocklin deleted the preload-import branch April 29, 2020 19:53
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.

3 participants