Skip to content

Commit c8531c2

Browse files
avkarenowfantix
andauthored
Use len(os.sched_getaffinity(0)) instead of os.cpu_count() (#591)
Co-authored-by: Fantix King <[email protected]>
1 parent 7777852 commit c8531c2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.github/workflows/tests.yml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
test:
1414
runs-on: ${{ matrix.os }}
1515
strategy:
16+
fail-fast: false
1617
matrix:
1718
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1819
os: [ubuntu-latest, macos-latest]

setup.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,11 @@ def build_libuv(self):
176176
cmd,
177177
cwd=LIBUV_BUILD_DIR, env=env, check=True)
178178

179-
j_flag = '-j{}'.format(os.cpu_count() or 1)
179+
try:
180+
njobs = len(os.sched_getaffinity(0))
181+
except AttributeError:
182+
njobs = os.cpu_count()
183+
j_flag = '-j{}'.format(njobs or 1)
180184
c_flag = "CFLAGS={}".format(env['CFLAGS'])
181185
subprocess.run(
182186
['make', j_flag, c_flag],

0 commit comments

Comments
 (0)