@@ -58,11 +58,13 @@ def f(x): |
|
|
58 |
58 |
p = Pool(5) |
59 |
59 |
results = [] |
60 |
60 |
p.map_async(f, [1, 2, 3], callback=results.extend) |
61 |
|
- deadline = time.time() + 10 # up to 10 s to report the results |
|
61 |
+ start_time = time.monotonic() |
62 |
62 |
while not results: |
63 |
63 |
time.sleep(0.05) |
64 |
|
- if time.time() > deadline: |
65 |
|
- raise RuntimeError("Timed out waiting for results") |
|
64 |
+ # up to 1 min to report the results |
|
65 |
+ dt = time.monotonic() - start_time |
|
66 |
+ if dt > 60.0: |
|
67 |
+ raise RuntimeError("Timed out waiting for results (%.1f sec)" % dt) |
66 |
68 |
results.sort() |
67 |
69 |
print(start_method, "->", results) |
68 |
70 |
""" |
@@ -86,11 +88,13 @@ def f(x): |
|
|
86 |
88 |
p = Pool(5) |
87 |
89 |
results = [] |
88 |
90 |
p.map_async(int, [1, 4, 9], callback=results.extend) |
89 |
|
-deadline = time.time() + 10 # up to 10 s to report the results |
|
91 |
+start_time = time.monotonic() |
90 |
92 |
while not results: |
91 |
93 |
time.sleep(0.05) |
92 |
|
- if time.time() > deadline: |
93 |
|
- raise RuntimeError("Timed out waiting for results") |
|
94 |
+ # up to 1 min to report the results |
|
95 |
+ dt = time.monotonic() - start_time |
|
96 |
+ if dt > 60.0: |
|
97 |
+ raise RuntimeError("Timed out waiting for results (%.1f sec)" % dt) |
94 |
98 |
results.sort() |
95 |
99 |
print(start_method, "->", results) |
96 |
100 |
""" |