-
-
Notifications
You must be signed in to change notification settings - Fork 719
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
use async with Client:
in tests
#6921
Conversation
|
||
try: | ||
c = await default_client() | ||
c = default_client() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you pretty much never need to await the default client, because it's already started
with dask.config.set({"distributed.comm.timeouts.connect": "10s"}): | ||
assert await asyncio.gather( | ||
run_client(), | ||
run_scheduler_after_2_seconds(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quite a big refactor of this test case because of the client_start_fut = asyncio.ensure_future(c)
watch out for https://github.com/dask/distributed/pull/6921/files#diff-ac7114557c3edd1c8da09cede9fe1b66ce38d324dd72258525b743030a2a411d github folds it because there's too many changes |
async def async_fn(): | ||
result = None | ||
with dask.config.set(config): | ||
async with _cluster_factory() as (s, workers), _client_factory( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also sorry about adding more difficult to review indentation changes to gen_cluster, but hopefully this is the last one as we can add more stuff to the async with _cluster_factory() as (s, workers), _client_factory(
expression
distributed/tests/test_utils_test.py
Outdated
@@ -282,6 +284,7 @@ async def f(s, a, b): | |||
|
|||
|
|||
def test_lingering_client_2(loop): | |||
# assert where the client went |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# assert where the client went | |
# TODO: assert where the client went |
distributed/tests/test_worker.py
Outdated
# TODO: `await get_client()` raises a deprecation warning to use | ||
# `async with get_client()` and that will kill the workers' client | ||
# if you do that. We really don't want users to do that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't true anymore - but we still don't want to await get_client()
# TODO: `await get_client()` raises a deprecation warning to use | |
# `async with get_client()` and that will kill the workers' client | |
# if you do that. We really don't want users to do that. | |
# TODO: the existence of `await get_client()` implies the possibility | |
# of `async with get_client()` and that will kill the workers' client | |
# if you do that. We really don't want users to do that. | |
# https://github.com/dask/distributed/pull/6921/ |
Unit Test ResultsSee test report for an extended history of previous test failures. This is useful for diagnosing flaky tests. 15 files ± 0 15 suites ±0 6h 29m 42s ⏱️ + 6m 50s For more details on these failures, see this check. Results for commit a10d2b7. ± Comparison against base commit a1d2011. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just the refactors extracted from #6836
This should make it easier to do optimizations like #6920 so when a failure happens we can propagate it quickly and close the Client
pre-commit run --all-files