Skip to content

Commit b59e010

Browse files
committed
parallel
1 parent 239def9 commit b59e010

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/xdist/workermanage.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from __future__ import annotations
2+
from concurrent.futures import ThreadPoolExecutor
23

34
from collections.abc import Sequence
5+
import time
46
import enum
57
import fnmatch
68
import os
@@ -94,7 +96,12 @@ def setup_nodes(
9496
) -> list[WorkerController]:
9597
self.config.hook.pytest_xdist_setupnodes(config=self.config, specs=self.specs)
9698
self.trace("setting up nodes")
97-
return [self.setup_node(spec, putevent) for spec in self.specs]
99+
t = time.monotonic()
100+
with ThreadPoolExecutor(max_workers=len(self.specs)) as executor:
101+
futs = [executor.submit(self.setup_node, spec, putevent) for spec in self.specs]
102+
ret = [f.result() for f in futs]
103+
print('setup_nodes took %.3f seconds' % (time.monotonic() - t))
104+
return ret
98105

99106
def setup_node(
100107
self,

0 commit comments

Comments
 (0)