Skip to content

Commit eb5ac8c

Browse files
committed
add proxy gateways
Proxy gateways do not run workers, and are meant to be passed with the `via` attribute to additional gateways. They are useful for running multiple workers on remote machines. Example usage: ``` pytest -sv --dist=load --tx "socket=IP:PORT//id=my_proxy//proxy" --tx "5*popen//via=my_proxy" ``` Proxy gateways do not run workers, anda re meant to be passed
1 parent a82981f commit eb5ac8c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/xdist/workermanage.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ def __init__(
6565
spec = execnet.XSpec(spec)
6666
if getattr(spec, "execmodel", None) != "main_thread_only":
6767
spec = execnet.XSpec(f"execmodel=main_thread_only//{spec}")
68+
if getattr(spec, "proxy", False):
69+
# Proxy gateways do not run workers, and are meant to be passed with the `via` attribute
70+
# to additional gateways.
71+
# They are useful for running multiple workers on remote machines.
72+
if getattr(spec, "id", None) is None:
73+
raise pytest.UsageError(f"Proxy gateway {spec} must include an id")
74+
self.group.makegateway(spec)
75+
continue
6876
if not spec.chdir and not spec.popen:
6977
spec.chdir = defaultchdir
7078
self.group.allocate_id(spec)

0 commit comments

Comments
 (0)