Repository navigation
[Core] Add worker fork server daemon and post-fork child setup - #67514
Conversation
193da02 to
8954e1a
Compare
ea48bf7 to
e27f857
Compare
9abefde to
63e423f
Compare
fa12b0b to
944c2ab
Compare
|
@ryanaoleary Thanks for reviewing the PR and just to summarize the comments that were addressed. These are the 2 PRs that are in mentioned as followups:
Let me know if this sounds good! Thank you! |
4593cc7 to
5728468
Compare
Signed-off-by: Aaron Liang <[email protected]>
5728468 to
ab75c06
Compare
Sounds good, that split works for me, including keeping the log and stdio fd args in the runtime env agent PR. Left two follow-ups inline. |
Kunchd
left a comment
There was a problem hiding this comment.
Thanks for the changes! Mainly left some comments regarding making the suppressed failures more visible.
| time.sleep(0.01) | ||
| st = os.lstat(self.socket_path) | ||
| self._socket_id = (st.st_dev, st.st_ino) | ||
| except BaseException: |
There was a problem hiding this comment.
If something were to prevent the fork server from being brought up, maybe we should surface the error up as well.
There was a problem hiding this comment.
Ah good call, added a warning log with details before stopping.
| with suppress(OSError): | ||
| self.process.stdin.close() | ||
| if self._socket_id is not None: | ||
| with suppress(OSError): |
There was a problem hiding this comment.
Instead of suppressing errors silently here, should we be logging anything?
There was a problem hiding this comment.
Updated to log unexpected cleanup errors as warnings and, will still ignore alreadygone processes.
| import ray._common.usage.usage_lib as _usage_lib # noqa: F401 | ||
| import ray._private.workers.default_worker as default_worker | ||
|
|
||
| with suppress(Exception): |
There was a problem hiding this comment.
nit: Should we be logging something here?
There was a problem hiding this comment.
Updated to log a warning with traceback here
|
|
||
| assert server.process.poll() is not None | ||
| assert not os.path.exists(sock_path) | ||
|
|
There was a problem hiding this comment.
Could we add a case to make sure forked children are reaped?
There was a problem hiding this comment.
Added in e2e test. PTAL!
…ol caching, and logging Signed-off-by: Aaron Liang <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 58fe4d2. Configure here.
Signed-off-by: Aaron Liang <[email protected]>
78e65b0 to
43dab9d
Compare
Signed-off-by: Aaron Liang <[email protected]>
…up guards, and env resets Signed-off-by: Aaron Liang <[email protected]>
Kunchd
left a comment
There was a problem hiding this comment.
Thanks for the PR! And the reviews from @ryanaoleary! Changes looks good on my end. One quick thing, could we make sure we run the whole windows and mac test suite in premerge just as a sanity check?
|
cc: @Kunchd to merge, I added the go label but I'm not sure if the full mac/windows tests ran |

Description
Adds the standalone Python worker fork server process and unit tests to support forking workers from a warm fork server process instead of starting a new Python interpreter from scratch.
Key Changes
preload_modulesin a single-threaded process, freeze the GC heap for copy-on-write sharing, and fork workers on demand over a Unix socketRelated issues
#67446 - Python worker fork server
Additional information
Wait for #67356