new_installer: Windows IPC support#52483
Conversation
864719f to
0c77060
Compare
5a9e6e8 to
ed58f0b
Compare
ae1c104 to
6860526
Compare
| """Abstract base classes for new_installer: TUI terminal state, IPC channels, and job scheduling. | ||
|
|
||
| Kept as a leaf module (no imports from new_installer.py or the platform modules) to avoid circular | ||
| dependencies — new_installer_posix and new_installer_windows both import from here.""" |
There was a problem hiding this comment.
Can you do a scan over this yourself and remove Claudisms? We use ascii practically everywhere.
There was a problem hiding this comment.
Ah I absolutely forgot to check the module level docstrings, thanks.
Will also of course go over the rest of the changes as well.
| # group conditions for readability | ||
| wake_on_jobserver = ( | ||
| self.pending_builds | ||
| and self.capacity | ||
| and not blocked | ||
| or not jobserver.has_target_parallelism() | ||
| ) | ||
| if wake_on_jobserver and jobserver.r not in selector.get_map(): | ||
| selector.register(jobserver.r, selectors.EVENT_READ, "jobserver") | ||
| elif not wake_on_jobserver and jobserver.r in selector.get_map(): | ||
| selector.unregister(jobserver.r) | ||
| self.pending_builds and self.capacity and not blocked | ||
| ) or not jobserver.has_target_parallelism() |
There was a problem hiding this comment.
Can you please leave out every unnecessary change in a 1000 line diff? This is not relevant to your changes, so leave it like it was. It's doesn't improve readability to me, and just takes more time in review.
There was a problem hiding this comment.
Ok, I did make this change deliberately because I thought it made it more readable but I'll revert since you're generally more right about these things
There was a problem hiding this comment.
Well, it's personal taste and it could've been either, for this PR it's just additional things to double-check.
6860526 to
e9a55d0
Compare
Facillitates IPC on Windows with the new installer via sockets Breaks ChildInfo down into subclasses, with the posix side untouched and the windows side output/state use socket.socketpair(). Registers socket objects and a WindowsSentinelBridge. WindowsSentinelBridge wraps a thread that calls proc.join() and writes a byte to a socket to wake the selector when the process exits (Windows cannot register process sentinels with a selector directly). read_from_key() abstracts reads across fds and sockets: uses recv() when the selector key's fileobj has it, os.read() otherwise. This lets _handle_child_logs/state use one invocation for both platforms. tee() is split into _tee_posix() (same as before) and _tee_windows() (thread-based control reader using sockets). State buffer and decoder refactored to be keyed by pid rather than fd, and _handle_child_state extracts _process_state_string() for clarity. Output is processed to support multibyte chars JobServer is essentially disabled on Windows Signed-off-by: John Parent <john.parent@kitware.com>
Move base classes to leaf module for per platform deriviation Signed-off-by: John Parent <john.parent@kitware.com>
No functional changes, just code reoganization Signed-off-by: John Parent <john.parent@kitware.com>
…dule Subclasses shared IPC logic with windows specific implementations Signed-off-by: John Parent <john.parent@kitware.com>
Alias classes to avoid dispatch methods remove IS_WINDOWs usages Signed-off-by: John Parent <john.parent@kitware.com>
Signed-off-by: John Parent <john.parent@kitware.com>
e9a55d0 to
427f44b
Compare
Signed-off-by: John Parent <john.parent@kitware.com>
Based on #52482
Facillitates IPC on Windows with the new installer via sockets
Breaks ChildInfo down into subclasses, with the posix side untouched and the windows side output/state use socket.socketpair().
Registers socket objects and a WindowsSentinelBridge.
WindowsSentinelBridge wraps a thread that calls proc.join() and writes a byte to a socket to wake the selector when the process exits (Windows cannot register process sentinels with a selector directly).
read_from_key() abstracts reads across fds and sockets: uses recv() when the selector key's fileobj has it, os.read() otherwise. This lets _handle_child_logs/state use one invocation for both platforms.
tee() is split into _tee_posix() (same as before) and _tee_windows() (thread-based control reader using sockets).
State buffer and decoder refactored to be keyed by pid rather than fd, and _handle_child_state extracts _process_state_string() for clarity.
Output is processed to support multibyte chars
JobServer is essentially disabled on Windows (to be done in later work, likely post release unless we get this in quickly somehow)