We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent de85e5d commit 711d5bbCopy full SHA for 711d5bb
src/dataclay/event_loop.py
@@ -15,8 +15,13 @@
15
# and we need to access the single event loop from the main thread.
16
dc_event_loop: AbstractEventLoop = None
17
18
-# Get available CPUs after numactl restriction
19
-cpu_count = len(psutil.Process().cpu_affinity())
+try:
+ # Get available CPUs after numactl restriction
20
+ cpu_count = len(psutil.Process().cpu_affinity())
21
+except AttributeError:
22
+ # Fallback to the default CPU count if cpu_affinity is not available
23
+ # (this happens, at least, on MacOS)
24
+ cpu_count = psutil.cpu_count()
25
# For CPU-bound tasks, use the number of CPUs available
26
cpu_bound_executor = concurrent.futures.ThreadPoolExecutor(max_workers=cpu_count)
27
# For I/O-bound tasks, use a higher multiplier
0 commit comments