|
20 | 20 | ``import execnet, trio`` probe used to decide whether a ``python=`` |
21 | 21 | interpreter can host a worker directly. |
22 | 22 | * The protocol no longer has to be the worker's stdin/stdout. A new |
23 | | - ``transport=socket|stdio`` spec key selects; it defaults to ``socket`` on |
24 | | - POSIX and ``stdio`` on Windows, where neither ``pass_fds`` nor ``ssh -R`` |
25 | | - unix-socket forwarding is available. ``socket`` means an inherited |
26 | | - socketpair for ``popen`` and an ``ssh -R``-forwarded unix socket that the |
27 | | - worker dials back on for ``ssh=``/``vagrant_ssh=``. |
| 23 | + ``transport=socket|stdio`` spec key selects, and ``socket`` is the default |
| 24 | + for every worker execnet spawns itself: an inherited socketpair for |
| 25 | + ``popen`` on POSIX, and a socket duplicated with ``socket.share()`` on |
| 26 | + Windows. ``ssh=``/``vagrant_ssh=`` gateways use an ``ssh -R``-forwarded |
| 27 | + unix socket the worker dials back on, which needs ``AF_UNIX`` and |
| 28 | + ``StreamLocal`` forwarding, so those stay on ``stdio`` on Windows. |
28 | 29 | * **A worker's stdio now belongs to the code it runs.** It used to be |
29 | 30 | redirected to the null device so it could not corrupt the protocol, which |
30 | 31 | meant a remote ``print()`` went nowhere at all. With the socket transport |
|
51 | 52 | the two errors you got depended on whether the peer had closed yet -- |
52 | 53 | so the more useful message lost a race. |
53 | 54 | * Whether a socket can be handed to a worker is now settled by *doing* it |
54 | | - once rather than by looking for ``socket.share``. An implementation with |
55 | | - the name but not a working call -- PyPy on Windows -- otherwise passed |
56 | | - the check and failed later, at the point where the only thing left to |
57 | | - tell the coordinator was a closed socket. Such a host now refuses the |
58 | | - request up front, and ``socket=``/``installvia=`` gateways are skipped |
59 | | - there rather than failing. |
| 55 | + once -- sharing to our own pid and rebuilding the result -- rather than |
| 56 | + by looking for ``socket.share``. An implementation with the name but not |
| 57 | + a working call would otherwise pass the check and fail later, at the |
| 58 | + point where the only thing left to tell the coordinator is a closed |
| 59 | + socket. A host that genuinely cannot hand a socket over refuses the |
| 60 | + request up front instead. |
60 | 61 | * A socket gateway that fails to start no longer takes down the gateway it |
61 | 62 | was requested through. It ran as a task on that worker's host, so an |
62 | 63 | unsupported sub-gateway used to cost that coordinator as well. |
|
80 | 81 | ``socket.share()`` (``WSADuplicateSocket``); because that needs the |
81 | 82 | child's pid, the flag travels in argv and the blob follows in the config |
82 | 83 | on stdin. The blob is bound to that one pid, so it is inert to anything |
83 | | - else. This makes ``transport=socket`` work on Windows for ``popen`` and |
84 | | - fixes ``socket=``/``installvia=`` gateways served from a Windows host. |
85 | | - Windows still *defaults* to ``transport=stdio``; ask for |
86 | | - ``transport=socket`` to opt in. |
| 84 | + else. This makes ``transport=socket`` the Windows default too, and fixes |
| 85 | + ``socket=``/``installvia=`` gateways served from a Windows host. A socket |
| 86 | + is handed over *as a socket* rather than reduced to its handle: rebuilding |
| 87 | + one from a bare handle makes the constructor re-derive family/type/proto |
| 88 | + by querying it, which PyPy on Windows cannot do to a handle that came |
| 89 | + from ``WSADuplicateSocket``. |
87 | 90 | * ``transport=socket`` on a gateway that cannot provide it is now an error |
88 | 91 | at ``makegateway`` time naming the platform, instead of a gateway that |
89 | 92 | waits for a worker which was never able to reach back. ssh dial-back |
|
95 | 98 | POSIX-only. Windows has no async equivalent -- trio's Windows pipe streams |
96 | 99 | need OVERLAPPED handles registered with an IOCP, and the stdio a process |
97 | 100 | inherits is an ordinary synchronous pipe -- so those reads and writes now |
98 | | - run in the thread pool. The socket transport, where it is available, still |
99 | | - needs no threads. |
| 101 | + run in the thread pool. This only affects ``transport=stdio``; the socket |
| 102 | + transport, which is the default, needs no threads. |
100 | 103 | * New ``EXECNET_PROVISION_WHEEL`` environment variable naming a prebuilt |
101 | 104 | wheel to provision remote workers from, instead of resolving the |
102 | 105 | coordinator's version from an index or building one from its source tree. |
|
0 commit comments