-
Notifications
You must be signed in to change notification settings - Fork 92
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
Add customizable worker_threads #353
Conversation
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.
nice thanks! so we can use it as an argument in gateway.new_cluster()?
Hey @jcrist Do you have any preference on how to tackle this? |
Friendly ping to @consideRatio . Maybe you can give me some feedback on this? |
Very useful initiative, relates to issue #362. |
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.
Thanks for your work @AndreaGiardini! I'm not representing this project but hopefully my review can be helpful.
First of all I think its sensible to allow worker_threads to be customizable, so the feature idea is sound.
What I would suggest iterating on is mainly the default value of worker_threads in the normal ClusterConfig and in the KubeClusterConfig.
The ClusterConfig has a default value of worker_threads to be 1, but in the past, it was matching the amount of CPU. The KubeClusterConfig deriving from ClusterConfig has a dynamic default value of worker_threads set to be worker_cores, but in the past int(worker_cores_limit) was used.
As the PR summary or title doesn't indicate an intent to change the default behavior, I think what makes sense to recommend, is to update the PRs code suggestion to implement a dynamic _default_worker_threads function with the @default
decorator in both ClusterConfig and KubeClusterConfig with the different defaults previously used.
@@ -1052,7 +1052,7 @@ def get_worker_command(self, namespace, cluster_name, config): | |||
"--name", | |||
"$(DASK_GATEWAY_WORKER_NAME)", | |||
"--nthreads", | |||
str(int(config.worker_cores_limit)), | |||
str(int(config.worker_threads)), |
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.
I think worker_threads is of an Integer
type already (traitlets), while worker_cores_limit was a Float
traitlet type and needed the cast to integer first.
str(int(config.worker_threads)), | |
str(config.worker_threads), |
@consideRatio Thank you for the valuable input I fixed the PR as you suggest, I can always squash as final step before merging if needed. |
ab92507
to
35a6e85
Compare
Hey @consideRatio and @jcrist I took some time to rebase the PR and make CI green without upgrading the distributed dep. Since there seems to be quite some interest in this feature, can you tell me if something else is needed to get this merged? Thank you |
@consideRatio , are you happy with the changes here? This all looks fair as far as I can tell. @jcrist , are you likely to have time to have a quick look? @jacobtomlinson , this is one of the few repos still on Travis, which still appears to work for now. I expect it might be more complex than most to transform. |
Apologies for letting this linger, this looks good to me. Merging. Thanks for the contribution! |
Thanks, @jcrist |
Thank you to all of you! :) Would you mind tagging a new release whenever possible? We could really benefit from this |
Wieee! 🎉 |
Hey
I added the possibility to customize the number of threads per worker.
Until now
worker_threads
=cores
but that's not always the best combination.If
worker_threads
is not set then it will fall-back to the default.Let me know if you have any feedback
Fixes #364
Fixes #362