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

Log worker_client event #8819

Merged
merged 7 commits into from
Aug 8, 2024
Merged

Log worker_client event #8819

merged 7 commits into from
Aug 8, 2024

Conversation

jrbourbeau
Copy link
Member

Using worker_client is supported but using them well can require some care. This PR makes sure we log an event when creating a client via worker_client, which can be used later when debugging, etc.

@jrbourbeau jrbourbeau requested a review from fjetter as a code owner August 6, 2024 20:55
Comment on lines 60 to 61
"timeout": timeout,
"separate_thread": separate_thread,
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure how useful this extra info actually is

Copy link
Contributor

github-actions bot commented Aug 6, 2024

Unit Test Results

See test report for an extended history of previous test failures. This is useful for diagnosing flaky tests.

    25 files  ± 0      25 suites  ±0   10h 22m 24s ⏱️ + 7m 15s
 4 104 tests + 2   3 985 ✅ + 1    113 💤 ±0   6 ❌ +1 
47 426 runs  +24  45 285 ✅ +17  2 130 💤 +1  11 ❌ +6 

For more details on these failures, see this check.

Results for commit 26a8afe. ± Comparison against base commit ad5f98c.

♻️ This comment has been updated with latest results.

Copy link
Collaborator

@phofl phofl left a comment

Choose a reason for hiding this comment

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

The change itself looks good to me, but it's missing the case that is more critical to me:

@delayed
def bla(i):
    arr = da.random.random((500, 500, 100), chunks=(10, 10, 10))
    result = dask.compute(arr.sum())
    return result

if __name__ == "__main__":
    cluster = LocalCluster()
    client = cluster.get_client()
    f = bla(1)
    dask.compute(f)

the accidental worker client creation. I think this happens somewhere in _get_client on the worker

@jrbourbeau
Copy link
Member Author

but it's missing the case that is more critical to me

Ah, yeah, we definitely want to capture that case too. I've updated things to capture both the implicit client creation case via .compute() and the explicit worker_client case. It's not easy to distinguish between the two cases though, so we're logging the same event in both cases.

@phofl
Copy link
Collaborator

phofl commented Aug 8, 2024

Could we log an event where you have it now and then a different event in the worker_client context manager?

Subtracting both counters would then tell us if it's intentional or accidental?

@jrbourbeau
Copy link
Member Author

Sure, we now have a worker-get-client event which is logged in both cases and a worker-client event that's only logged in the worker_client(...) case

@phofl phofl merged commit fa00237 into dask:main Aug 8, 2024
23 of 32 checks passed
@phofl
Copy link
Collaborator

phofl commented Aug 8, 2024

thx

@jrbourbeau jrbourbeau deleted the worker-client-event branch August 8, 2024 22:16
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.

2 participants