Update to session builder API to enable context, config, or runtime sharing.#862
Open
hoytak wants to merge 1 commit into
Open
Update to session builder API to enable context, config, or runtime sharing.#862hoytak wants to merge 1 commit into
hoytak wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The XetContext object is designed partly to enable control over shared runtime, config, and common resources between sessions, but this isn't fully reflected in the XetSessionBuilder API. This PR simply adds this API polish to enable this.
Note
Medium Risk
Breaking API removal (new_with_config, with_tokio_handle) and changed config() return type affect integrators; context/config precedence and shared common state can surprise callers tuning concurrency via config overrides.
Overview
XetSessionBuilderis refactored to a consistentwith_*API:new_with_configis removed (usenew().with_config(...)),with_tokio_handleis replaced bywith_runtime(Arc<XetRuntime>), andwith_contextlets new sessions reuse an existingXetContextso runtime, config, andcommon(including shard-file manager caches) are shared instead of re-scanning the shard cache on every session.XetSessiongainscontext(),runtime(), andconfig()now returnsArc<XetConfig>. Build order: explicit context wins (with_runtimeignored );with_configoverrides the context’s config viaXetContext::with_new_configwhile keeping sharedcommon(construction-time limits incommonare not rebuilt).XetContextconstructors takeimpl Into<Arc<XetConfig>>;with_new_configis added.XetContext/XetRuntimeare re-exported fromxet::xet_session. Pythonhf_xetand docs/tests are updated accordingly; anapi_changesnote documents the migration.Reviewed by Cursor Bugbot for commit ec2cc73. Bugbot is set up for automated code reviews on this repo. Configure here.