Changeset: 825b5c167a80 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/825b5c167a80
Added Files:
sql/test/concurrent/Tests/many-concurrent-client-connections.SQL.py
Removed Files:
sql/test/concurrent/Tests/many-concurrent-client-connections.py
Modified Files:
sql/test/concurrent/Tests/read-segment-after-free.SQL.py
Branch: Jan2022
Log Message:
Use ThreadPoolExecutor instead of ProcessPoolExecutor on non-Linux.
On Darwin and Windows, the tests fail when using the process version
with the error:
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
diffs (49 lines):
diff --git a/sql/test/concurrent/Tests/many-concurrent-client-connections.py
b/sql/test/concurrent/Tests/many-concurrent-client-connections.SQL.py
rename from sql/test/concurrent/Tests/many-concurrent-client-connections.py
rename to sql/test/concurrent/Tests/many-concurrent-client-connections.SQL.py
--- a/sql/test/concurrent/Tests/many-concurrent-client-connections.py
+++ b/sql/test/concurrent/Tests/many-concurrent-client-connections.SQL.py
@@ -1,5 +1,10 @@
import os, pymonetdb
-from concurrent.futures import ProcessPoolExecutor
+from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
+
+if os.uname().sysname == 'Linux':
+ executor = ProcessPoolExecutor
+else:
+ executor = ThreadPoolExecutor
h = os.getenv('MAPIHOST')
p = int(os.getenv('MAPIPORT'))
@@ -16,5 +21,5 @@ def client(_):
conn.close()
-with ProcessPoolExecutor(nr_clients) as pool:
+with executor(nr_clients) as pool:
pool.map(client, range(nr_clients))
diff --git a/sql/test/concurrent/Tests/read-segment-after-free.SQL.py
b/sql/test/concurrent/Tests/read-segment-after-free.SQL.py
--- a/sql/test/concurrent/Tests/read-segment-after-free.SQL.py
+++ b/sql/test/concurrent/Tests/read-segment-after-free.SQL.py
@@ -1,8 +1,13 @@
import os, random, pymonetdb
-from concurrent.futures import ProcessPoolExecutor
+from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
import time
from pymonetdb.exceptions import OperationalError
+if os.uname().sysname == 'Linux':
+ executor = ProcessPoolExecutor
+else:
+ executor = ThreadPoolExecutor
+
init = '''
drop table if exists foo;
create table foo (c1, c2, c3, c4, c5) AS VALUES
@@ -47,5 +52,5 @@ def client(_):
# concurrency conflicts are allowed
pass
-with ProcessPoolExecutor(nr_clients) as pool:
+with executor(nr_clients) as pool:
pool.map(client, range(nr_clients))
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]