This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
The following commit(s) were added to refs/heads/master by this push:
new 132a876 os.sched_getaffinity() not present on macOS
132a876 is described below
commit 132a876ddce70c5b207ab89f14b95e5240e07885
Author: Sebb <[email protected]>
AuthorDate: Thu Nov 25 00:16:35 2021 +0000
os.sched_getaffinity() not present on macOS
This relates to #158
---
tools/migrate.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/migrate.py b/tools/migrate.py
index 0c6f401..a981cc3 100644
--- a/tools/migrate.py
+++ b/tools/migrate.py
@@ -32,7 +32,6 @@ import base64
import email.utils
import hashlib
import multiprocessing
-import os
import time
import sys
import archiver
@@ -42,7 +41,7 @@ MIGRATION_MAGIC_NUMBER = "2"
# Max number of parallel conversions to perform before pushing. 75-ish percent
of max cores.
-cores = len(os.sched_getaffinity(0))
+cores = multiprocessing.cpu_count()
MAX_PARALLEL_OPS = max(min(int((cores + 1) * 0.75), cores - 1), 1)
class MultiDocProcessor: