Repository navigation
Run preload at import, start, and teardown - #3673
Conversation
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
|
Merging in 24 hours if there are no comments |
pentschev
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
Thanks @mrocklin. Left a few small comments about docstrings, otherwise the changes here LGTM
|
|
||
|
|
||
| async def on_start(names, parameter=None, file_dir=None, argv=None): | ||
| """ Imports modules, handles `dask_setup` and `dask_teardown`. |
There was a problem hiding this comment.
| """ Imports modules, handles `dask_setup` and `dask_teardown`. | |
| """ Imports modules and handles ``dask_setup``. |
|
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. |
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
atexittimecc @pentschev I think that you asked for this at one point.