Skip to content

Commit

Permalink
Use len(os.sched_getaffinity(0)) instead of os.cpu_count() (MagicStac…
Browse files Browse the repository at this point in the history
…k#591)

Co-authored-by: Fantix King <fantix.king@gmail.com>
  • Loading branch information
2 people authored and edgarrmondragon committed Aug 19, 2024
1 parent 1fa0240 commit a073237
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- "3.8"
Expand Down
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,11 @@ def build_libuv(self):
cmd,
cwd=LIBUV_BUILD_DIR, env=env, check=True)

j_flag = '-j{}'.format(os.cpu_count() or 1)
try:
njobs = len(os.sched_getaffinity(0))
except AttributeError:
njobs = os.cpu_count()
j_flag = '-j{}'.format(njobs or 1)
c_flag = "CFLAGS={}".format(env['CFLAGS'])
subprocess.run(
['make', j_flag, c_flag],
Expand Down

0 comments on commit a073237

Please sign in to comment.