Skip to content

Commit 2eb4fe5

Browse files
committed
chore: add FUTURE_TIMEOUT to allow adjusting timeout
1 parent 1fbacd5 commit 2eb4fe5

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

numba_cuda/numba/cuda/tests/cudapy/test_ipc.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
import unittest
2424

2525

26+
FUTURE_TIMEOUT = 4
27+
28+
2629
def base_ipc_handle_test(handle, size, parent_pid):
2730
pid = os.getpid()
2831
assert pid != parent_pid
@@ -97,7 +100,7 @@ def test_ipc_handle(self):
97100
fut = self.exe.submit(
98101
base_ipc_handle_test, handle_bytes, size, parent_pid=os.getpid()
99102
)
100-
out = fut.result(timeout=3)
103+
out = fut.result(timeout=FUTURE_TIMEOUT)
101104
np.testing.assert_equal(arr, out)
102105

103106
def variants(self):
@@ -134,7 +137,7 @@ def check_ipc_handle_serialization(self, index_arg=None, foreign=False):
134137
fut = self.exe.submit(
135138
serialize_ipc_handle_test, ipch, parent_pid=os.getpid()
136139
)
137-
out = fut.result(timeout=3)
140+
out = fut.result(timeout=FUTURE_TIMEOUT)
138141
np.testing.assert_equal(expect, out)
139142

140143
def test_ipc_handle_serialization(self):
@@ -159,7 +162,7 @@ def check_ipc_array(self, index_arg=None, foreign=False):
159162

160163
# spawn new process for testing
161164
fut = self.exe.submit(ipc_array_test, ipch, parent_pid=os.getpid())
162-
out = fut.result(timeout=3)
165+
out = fut.result(timeout=FUTURE_TIMEOUT)
163166
np.testing.assert_equal(expect, out)
164167

165168
def test_ipc_array(self):
@@ -229,7 +232,9 @@ def test_staged(self):
229232
for device_num in range(ngpus)
230233
]
231234

232-
for fut in concurrent.futures.as_completed(futures, timeout=3 * ngpus):
235+
for fut in concurrent.futures.as_completed(
236+
futures, timeout=FUTURE_TIMEOUT * ngpus
237+
):
233238
np.testing.assert_equal(arr, fut.result())
234239

235240
def test_ipc_array(self):
@@ -243,7 +248,7 @@ def test_ipc_array(self):
243248
fut = self.exe.submit(
244249
staged_ipc_array_test, ipch, device_num, parent_pid=os.getpid()
245250
)
246-
out = fut.result(timeout=3)
251+
out = fut.result(timeout=FUTURE_TIMEOUT)
247252
np.testing.assert_equal(arr, out)
248253

249254

0 commit comments

Comments
 (0)