portal 3.2.1__tar.gz → 3.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {portal-3.2.1/portal.egg-info → portal-3.2.2}/PKG-INFO +1 -1
- {portal-3.2.1 → portal-3.2.2}/portal/__init__.py +1 -1
- {portal-3.2.1 → portal-3.2.2}/portal/contextlib.py +7 -1
- {portal-3.2.1 → portal-3.2.2}/portal/utils.py +8 -2
- {portal-3.2.1 → portal-3.2.2/portal.egg-info}/PKG-INFO +1 -1
- {portal-3.2.1 → portal-3.2.2}/tests/test_server.py +2 -2
- {portal-3.2.1 → portal-3.2.2}/LICENSE +0 -0
- {portal-3.2.1 → portal-3.2.2}/MANIFEST.in +0 -0
- {portal-3.2.1 → portal-3.2.2}/README.md +0 -0
- {portal-3.2.1 → portal-3.2.2}/portal/batching.py +0 -0
- {portal-3.2.1 → portal-3.2.2}/portal/buffers.py +0 -0
- {portal-3.2.1 → portal-3.2.2}/portal/client.py +0 -0
- {portal-3.2.1 → portal-3.2.2}/portal/client_socket.py +0 -0
- {portal-3.2.1 → portal-3.2.2}/portal/packlib.py +0 -0
- {portal-3.2.1 → portal-3.2.2}/portal/poollib.py +0 -0
- {portal-3.2.1 → portal-3.2.2}/portal/process.py +0 -0
- {portal-3.2.1 → portal-3.2.2}/portal/server.py +0 -0
- {portal-3.2.1 → portal-3.2.2}/portal/server_socket.py +0 -0
- {portal-3.2.1 → portal-3.2.2}/portal/sharray.py +0 -0
- {portal-3.2.1 → portal-3.2.2}/portal/thread.py +0 -0
- {portal-3.2.1 → portal-3.2.2}/portal.egg-info/SOURCES.txt +0 -0
- {portal-3.2.1 → portal-3.2.2}/portal.egg-info/dependency_links.txt +0 -0
- {portal-3.2.1 → portal-3.2.2}/portal.egg-info/requires.txt +0 -0
- {portal-3.2.1 → portal-3.2.2}/portal.egg-info/top_level.txt +0 -0
- {portal-3.2.1 → portal-3.2.2}/pyproject.toml +0 -0
- {portal-3.2.1 → portal-3.2.2}/requirements.txt +0 -0
- {portal-3.2.1 → portal-3.2.2}/setup.cfg +0 -0
- {portal-3.2.1 → portal-3.2.2}/setup.py +0 -0
- {portal-3.2.1 → portal-3.2.2}/tests/test_batching.py +0 -0
- {portal-3.2.1 → portal-3.2.2}/tests/test_client.py +0 -0
- {portal-3.2.1 → portal-3.2.2}/tests/test_errfile.py +0 -0
- {portal-3.2.1 → portal-3.2.2}/tests/test_pack.py +0 -0
- {portal-3.2.1 → portal-3.2.2}/tests/test_process.py +0 -0
- {portal-3.2.1 → portal-3.2.2}/tests/test_socket.py +0 -0
- {portal-3.2.1 → portal-3.2.2}/tests/test_thread.py +0 -0
@@ -4,6 +4,7 @@ import pathlib
|
|
4
4
|
import sys
|
5
5
|
import threading
|
6
6
|
import traceback
|
7
|
+
import warnings
|
7
8
|
|
8
9
|
import cloudpickle
|
9
10
|
import psutil
|
@@ -143,7 +144,12 @@ class Context:
|
|
143
144
|
return
|
144
145
|
if hasattr(worker, 'thread'):
|
145
146
|
assert current != worker.thread
|
146
|
-
|
147
|
+
try:
|
148
|
+
current.children.append(worker)
|
149
|
+
except AttributeError:
|
150
|
+
warnings.warn(
|
151
|
+
'Using Portal from plain Python threads is discouraged because ' +
|
152
|
+
'they can cause hangs during shutdown.')
|
147
153
|
|
148
154
|
def children(self, thread):
|
149
155
|
current = thread or threading.current_thread()
|
@@ -8,6 +8,8 @@ import time
|
|
8
8
|
|
9
9
|
import psutil
|
10
10
|
|
11
|
+
from . import contextlib
|
12
|
+
|
11
13
|
|
12
14
|
def run(workers, duration=None):
|
13
15
|
[None if x.started else x.start() for x in workers]
|
@@ -96,9 +98,13 @@ def free_port():
|
|
96
98
|
# Return a port that is currently free. This function is not thread or
|
97
99
|
# process safe, because there is no way to guarantee that the port will still
|
98
100
|
# be free at the time it will be used.
|
99
|
-
|
101
|
+
if contextlib.context.serverkw.get('ipv6', False):
|
102
|
+
family, addr = socket.AF_INET6, ('localhost', 0, 0, 0)
|
103
|
+
else:
|
104
|
+
family, addr = socket.AF_INET, ('localhost', 0)
|
105
|
+
sock = socket.socket(family, socket.SOCK_STREAM)
|
100
106
|
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
101
|
-
sock.bind(
|
107
|
+
sock.bind(addr)
|
102
108
|
port = sock.getsockname()[1]
|
103
109
|
sock.close()
|
104
110
|
return port
|
@@ -199,7 +199,7 @@ class TestServer:
|
|
199
199
|
def test_shared_pool(self, repeat, Server):
|
200
200
|
|
201
201
|
def slow(x):
|
202
|
-
time.sleep(0.
|
202
|
+
time.sleep(0.5)
|
203
203
|
return x
|
204
204
|
|
205
205
|
def fast(x):
|
@@ -226,7 +226,7 @@ class TestServer:
|
|
226
226
|
def test_separate_pools(self, repeat, Server):
|
227
227
|
|
228
228
|
def slow(x):
|
229
|
-
time.sleep(0.
|
229
|
+
time.sleep(0.5)
|
230
230
|
return x
|
231
231
|
|
232
232
|
def fast(x):
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|