Skip to content

Commit cc615bf

Browse files
Address review feedback
1 parent 1ce1294 commit cc615bf

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

custom_worker_tuner/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@ A `CustomSlotSupplier` is a sample that lets you gate slot grants on whatever yo
44
This sample gates on a fake DB pool: the worker only polls for a new
55
activity when the pool has a free connection.
66

7+
**Note:** This sample is illustrative only. It shouldn't be used for production grade use-cases.
8+
79
## What this sample is
8-
db_pool.py - A static-capacity counter. Pretends to be a DB pool. Two methods: increment() (claim a slot, returns False if full), decrement() (release)
9-
supplier.py - The custom slot supplier. On reserve_slot it polls downstream.increment() until it succeeds. On release_slot it calls downstream.decrement()
10+
db_pool.py - A fixed-capacity fake pool backed by a `BoundedSemaphore`. Two methods: `acquire(blocking=True)` (claim a slot, returns False if full when non-blocking), `release()` (return a slot)
11+
supplier.py - The custom slot supplier. `reserve_slot` blocks on `connection_pool.acquire()` until a slot is free; `try_reserve_slot` does the same non-blocking. `release_slot` calls `connection_pool.release()`
1012
shared.py - A RunBatch workflow that runs N do_work activities in parallel. The activity just sleeps
11-
worker.py - Wires Downstream + DownstreamAwareSupplier into a WorkerTuner
13+
worker.py - Wires `FakeDatabaseConnectionPool` + `PoolSlotSupplier` into a WorkerTuner
1214
starter.py - Drives load
1315

1416
The flow:
1517

16-
When the downstream is at capacity, `reserve_slot` blocks until a
17-
slot frees up. The excess work piles up on the Temporal server, not
18+
When the pool is at capacity, `reserve_slot` blocks until a
19+
connection frees up. The excess work piles up on the Temporal server, not
1820
inside the worker.
1921

2022
## Run
@@ -63,8 +65,7 @@ we chose 10 because default there are 5 pollers for python sdk
6365

6466
worker.py:
6567

66-
CAPACITY — downstream capacity (the gate)
67-
POLL_INTERVAL_MS — how often the supplier rechecks when full
68+
CAPACITY — pool capacity (the gate)
6869

6970
starter.py:
7071

0 commit comments

Comments
 (0)