Skip to content

Commit 9fa42ac

Browse files
committed
Revert "Make nexus slot supplier optional for backwards compatibility"
This reverts commit aa807cd.
1 parent 16bf494 commit 9fa42ac

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

temporalio/worker/_tuning.py

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -391,15 +391,12 @@ def create_resource_based(
391391
@staticmethod
392392
def create_fixed(
393393
*,
394-
workflow_slots: Optional[int] = None,
395-
activity_slots: Optional[int] = None,
396-
local_activity_slots: Optional[int] = None,
397-
nexus_slots: Optional[int] = None,
394+
workflow_slots: Optional[int],
395+
activity_slots: Optional[int],
396+
local_activity_slots: Optional[int],
397+
nexus_slots: Optional[int],
398398
) -> WorkerTuner:
399-
"""Create a fixed-size tuner with the provided number of slots.
400-
401-
Any unspecified slot numbers will default to 100.
402-
"""
399+
"""Create a fixed-size tuner with the provided number of slots. Any unspecified slots will default to 100."""
403400
return _CompositeTuner(
404401
FixedSizeSlotSupplier(workflow_slots if workflow_slots else 100),
405402
FixedSizeSlotSupplier(activity_slots if activity_slots else 100),
@@ -412,20 +409,17 @@ def create_fixed(
412409
@staticmethod
413410
def create_composite(
414411
*,
415-
workflow_supplier: Optional[SlotSupplier] = None,
416-
activity_supplier: Optional[SlotSupplier] = None,
417-
local_activity_supplier: Optional[SlotSupplier] = None,
418-
nexus_supplier: Optional[SlotSupplier] = None,
412+
workflow_supplier: SlotSupplier,
413+
activity_supplier: SlotSupplier,
414+
local_activity_supplier: SlotSupplier,
415+
nexus_supplier: SlotSupplier,
419416
) -> WorkerTuner:
420-
"""Create a tuner composed of the provided slot suppliers.
421-
422-
Any unspecified slot suppliers will default to :py:class:`FixedSizeSlotSupplier` with a capacity of 100.
423-
"""
417+
"""Create a tuner composed of the provided slot suppliers."""
424418
return _CompositeTuner(
425-
workflow_supplier or FixedSizeSlotSupplier(100),
426-
activity_supplier or FixedSizeSlotSupplier(100),
427-
local_activity_supplier or FixedSizeSlotSupplier(100),
428-
nexus_supplier or FixedSizeSlotSupplier(100),
419+
workflow_supplier,
420+
activity_supplier,
421+
local_activity_supplier,
422+
nexus_supplier,
429423
)
430424

431425
@abstractmethod

tests/worker/test_worker.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,10 @@ def release_slot(self, ctx: SlotReleaseContext) -> None:
577577
ss = ThrowingSlotSupplier()
578578

579579
tuner = WorkerTuner.create_composite(
580-
workflow_supplier=ss, activity_supplier=ss, local_activity_supplier=ss
580+
workflow_supplier=ss,
581+
activity_supplier=ss,
582+
local_activity_supplier=ss,
583+
nexus_supplier=ss,
581584
)
582585
async with new_worker(
583586
client,
@@ -613,7 +616,10 @@ def release_slot(self, ctx: SlotReleaseContext) -> None:
613616
ss = BlockingSlotSupplier()
614617

615618
tuner = WorkerTuner.create_composite(
616-
workflow_supplier=ss, activity_supplier=ss, local_activity_supplier=ss
619+
workflow_supplier=ss,
620+
activity_supplier=ss,
621+
local_activity_supplier=ss,
622+
nexus_supplier=ss,
617623
)
618624
async with new_worker(
619625
client,

0 commit comments

Comments
 (0)