MCPcopy Index your code
hub / github.com/apache/tvm / test_popen_pool_executor

Function test_popen_pool_executor

tests/python/support/test_popen_pool.py:88–113  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86
87
88def test_popen_pool_executor():
89 import tvm_ffi
90
91 import tvm
92
93 pool = PopenPoolExecutor(max_workers=2, timeout=0.015)
94 value1 = pool.submit(identity_after, 1, 100)
95 value2 = pool.submit(terminate_self)
96 value3 = pool.submit(identity_after, 3, 0)
97 value4 = pool.submit(tvm_ffi.core.String, "xyz")
98
99 with pytest.raises(TimeoutError):
100 value1.result()
101
102 with pytest.raises(ChildProcessError):
103 value2.result()
104
105 assert value3.result() == 3
106 value = value4.result()
107 assert value == "xyz"
108
109 pool = PopenPoolExecutor(max_workers=4, timeout=None)
110 values = pool.map_with_error_catching(lambda x: x, range(100))
111
112 for idx, val in enumerate(values):
113 assert val.value == idx
114
115
116def test_popen_initializer():

Callers 1

test_popen_pool.pyFile · 0.85

Calls 4

submitMethod · 0.95
PopenPoolExecutorClass · 0.90
resultMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…