-
Notifications
You must be signed in to change notification settings - Fork 144
💥 Nexus support in worker tuner #1066
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
Conversation
9720da1 to
c9567a6
Compare
f9134fe to
189effe
Compare
563f093 to
c9c99ea
Compare
d551ef2 to
ed72439
Compare
fcbb9de to
cd8ad93
Compare
| return temporalio.bridge.worker.FixedSizeSlotSupplier(slot_supplier.num_slots) | ||
| elif isinstance(slot_supplier, ResourceBasedSlotSupplier): | ||
| min_slots = 5 if kind == "workflow" else 1 | ||
| max_slots = _DEFAULT_RESOURCE_ACTIVITY_MAX |
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.
Is this a bug fix?
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.
No, we're now using the constant for both activities and nexus operation so I renamed it.
cretz
left a comment
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.
LGTM, only blocking concern is one of backwards compatibility break
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.
Assuming we can't merge this until temporalio/sdk-core#994 is merged?
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.
That's right
temporalio/worker/_tuning.py
Outdated
| return ss.num_slots | ||
| elif isinstance(ss, ResourceBasedSlotSupplier): | ||
| return ss.slot_config.maximum_slots or _DEFAULT_RESOURCE_ACTIVITY_MAX | ||
| return self._get_slot_supplier_max(self._get_activity_task_slot_supplier()) |
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.
_get_slot_supplier_max is a static call, not sure if self. is the right thing
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, Python allows referencing staticmethods on self but I agree I shouldn't do it and perhaps they could be shadowed by an instance method. Changed.
temporalio/worker/_tuning.py
Outdated
| activity_slots: Optional[int], | ||
| local_activity_slots: Optional[int], | ||
| ) -> "WorkerTuner": | ||
| nexus_slots: Optional[int], |
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 additional required parameter and the additional required parameter on create_composite are technically backwards incompatible. I think tuning is still experimental, but that may only be custom slot suppliers. I think it's worth confirming whether these two static methods are considered GA and if they are, we may need to provide acceptable defaults (here is easy, it can be None, for create_composite, just a fixed size supplier is probably the default but at runtime per call, not global shared). If these are not considered GA, we can just add a 💥 note here and in release notes.
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.
Good catch. I've updated the PR to make it backwards compatible. I've made it so that nexus is consistent with the workflow/activity/LA by giving them all defaults.
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 that can make sense for create_fixed, but made a comment just now concerning create_composite
f41641b to
bad9bb8
Compare
e5958c9 to
769fd82
Compare
| ) | ||
|
|
||
| @staticmethod | ||
| def create_composite( |
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 we explicitly designed this to require people to provide at least the first 3 suppliers when creating a composite tuner and I think we've done that across every SDK consistently. I noticed that both Go and Java added the requirement for a Nexus slot supplier as a potentially breaking change, but maybe they got it in before tuning was GA? Or maybe they considered the breaking change acceptable?
I think we should try to do this part somewhat consistently across SDKs. Can you confirm 1) whether we want to require users provide explicit slot suppliers (at least for the first 3 types) when creating a composite tuner? and 2) whether we are ok with a backwards incompatible change to require Nexus slot supplier when creating a composite tuner? (note only some languages require the first 3 values for fixed, Go does not)
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.
We discussed offline and agreed to break create_composite while adding defaults to all for create_fixed. PR updated.
769fd82 to
16bf494
Compare
a694631 to
34b6326
Compare
34b6326 to
f6036bf
Compare
max_concurrent_nexus_tasksworker config option💥 This is a breaking change:
create_composite()has gained a requirednexus_supplierparameter.