From 0bfc0ef0244674dd393258b5649eae8a9039ca1c Mon Sep 17 00:00:00 2001 From: avkarenow Date: Thu, 18 Jan 2024 19:24:09 +0100 Subject: [PATCH 1/3] Use len(os.sched_getaffinity(0)) instead of os.cpu_count() --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ba15af50..3d88f515 100644 --- a/setup.py +++ b/setup.py @@ -176,7 +176,7 @@ def build_libuv(self): cmd, cwd=LIBUV_BUILD_DIR, env=env, check=True) - j_flag = '-j{}'.format(os.cpu_count() or 1) + j_flag = '-j{}'.format(len(os.sched_getaffinity(0)) or 1) c_flag = "CFLAGS={}".format(env['CFLAGS']) subprocess.run( ['make', j_flag, c_flag], From d68b083432f1543666823f956b80011b58147db8 Mon Sep 17 00:00:00 2001 From: Fantix King Date: Thu, 15 Aug 2024 12:19:28 -0400 Subject: [PATCH 2/3] Turn off CI fail-fast --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 61cf881f..345362fd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,6 +13,7 @@ jobs: test: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] os: [ubuntu-latest, macos-latest] From a1c909a4d47e330a81a9f2d21c4e4a0bf15f42ff Mon Sep 17 00:00:00 2001 From: Fantix King Date: Thu, 15 Aug 2024 12:21:30 -0400 Subject: [PATCH 3/3] Falls back to cpu_count() if no sched_getaffinity() --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3d88f515..c369ac80 100644 --- a/setup.py +++ b/setup.py @@ -176,7 +176,11 @@ def build_libuv(self): cmd, cwd=LIBUV_BUILD_DIR, env=env, check=True) - j_flag = '-j{}'.format(len(os.sched_getaffinity(0)) 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],