File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 11import json
2+ import os
23from collections .abc import Sequence
34from enum import Enum
45from typing import Literal , Optional
@@ -131,7 +132,9 @@ class Settings(BaseSettings):
131132
132133 # Scheduler settings
133134 max_concurrency : int = 512
134- max_worker_processes : int = 10
135+ max_worker_processes : int = Field (
136+ default_factory = lambda : max ((os .cpu_count () or 1 ) - 1 , 10 )
137+ )
135138 max_add_requests_per_loop : int = 20
136139 scheduler_start_delay : float = 5
137140
Original file line number Diff line number Diff line change 11import math
2- import os
32import random
43import time
54from collections .abc import Generator
@@ -72,9 +71,7 @@ def processes_limit(self) -> int:
7271
7372 :return: The number of processes for the scheduling strategy.
7473 """
75- cpu_cores = os .cpu_count () or 1
76-
77- return min (max (1 , cpu_cores - 1 ), settings .max_worker_processes )
74+ return settings .max_worker_processes
7875
7976 @property
8077 def queued_requests_limit (self ) -> Optional [int ]:
@@ -231,9 +228,8 @@ def processes_limit(self) -> int:
231228 :return: {self.streams} for the concurrent scheduling strategy to limit
232229 the worker processes to the number of streams.
233230 """
234- cpu_cores = os .cpu_count () or 1
235231
236- return min (max ( 1 , cpu_cores - 1 ), self .streams )
232+ return min (self .streams , settings . max_worker_processes )
237233
238234 @property
239235 def queued_requests_limit (self ) -> int :
You can’t perform that action at this time.
0 commit comments