|
4 | 4 | import time |
5 | 5 | from typing import ( |
6 | 6 | Generator, |
| 7 | + List, |
7 | 8 | Literal, |
8 | 9 | Optional, |
9 | 10 | Union, |
@@ -94,6 +95,23 @@ def processing_requests_limit(self) -> int: |
94 | 95 | """ |
95 | 96 | return settings.max_concurrency |
96 | 97 |
|
| 98 | + @property |
| 99 | + def process_requests_limits(self) -> List[int]: |
| 100 | + """ |
| 101 | + The maximum number of requests per process for the scheduling strategy. |
| 102 | + It determines how many requests can be processed by each worker process |
| 103 | + for the scheduling strategy. |
| 104 | +
|
| 105 | + :return: A per-process list of the maximum number of requests per process. |
| 106 | + """ |
| 107 | + split = self.processing_requests_limit // self.processes_limit |
| 108 | + remain = self.processing_requests_limit % self.processes_limit |
| 109 | + |
| 110 | + return [ |
| 111 | + split + 1 if i < remain else split |
| 112 | + for i in range(self.processes_limit) |
| 113 | + ] |
| 114 | + |
97 | 115 | def request_times(self) -> Generator[float, None, None]: |
98 | 116 | """ |
99 | 117 | A generator that yields timestamps for when requests should be sent. |
@@ -168,6 +186,18 @@ def processing_requests_limit(self) -> int: |
168 | 186 | """ |
169 | 187 | return 1 |
170 | 188 |
|
| 189 | + @property |
| 190 | + def process_requests_limits(self) -> List[int]: |
| 191 | + """ |
| 192 | + The maximum number of requests per process for the scheduling strategy. |
| 193 | + It determines how many requests can be processed by each worker process |
| 194 | + for the scheduling strategy. |
| 195 | +
|
| 196 | + :return: A per-process list of the maximum number of requests per process. |
| 197 | + """ |
| 198 | + |
| 199 | + return [1] |
| 200 | + |
171 | 201 | def request_times(self) -> Generator[float, None, None]: |
172 | 202 | """ |
173 | 203 | A generator that yields time.time() so requests are sent immediately, |
|
0 commit comments