Repository navigation
feat(python): provision the engine binary on demand - #3645
Merged
inureyes merged 3 commits intoDec 1, 2026
Merged
Conversation
Managed mode required an mlxcel binary on PATH, MLXCEL_BIN, or binary=, so
`pip install mlxcel` could not run a server without a separate engine install.
Resolve the binary in a documented order — binary=, MLXCEL_BIN, PATH, the
version-keyed cache, then a download — and refuse with a named reason when
none is available, so the failure explains which route to take. The release
archive is checksum-verified before anything is extracted, staged in a
temporary tree, and published with os.replace so a failed or losing download
never leaves a half-installed version behind. The version directory, not the
executable, is the install unit: bin/ and include/ must land together or the
JIT cannot find its headers.
- `python -m mlxcel install` provisions without starting a server and rejects
path-like versions, which it uses as a cache directory name.
- `find_cached_binary` converts OSError from an unreadable cache into
MlxcelServerError, so every public entry point reports a provisioning
failure as an Mlxcel* type instead of leaking a bare PermissionError.
- docs/python-client.{md,ko.md} document the resolution order, the cache
layout, the managed and connect modes, and the failure messages.
Verified: 220 passed / 2 skipped, ruff check and format clean, mypy clean,
8/8 header-layout probes, and a real install reporting `mlxcel 0.8.1`.
Refs lablup#416
Use stat to distinguish an absent executable from an inaccessible cache. Python 3.14 path predicates suppress filesystem errors. The provisioning regression exercises all three entry points. Refs lablup#416.
Member
|
Reviewed #416 and fixed cache permission handling on Python 3.14. The cache lookup now calls stat directly so permission errors reach the existing provisioning error handler. Missing entries still allow provisioning. Ruff passed and the Python 3.14 suite passed all 220 offline tests with two end-to-end cases deselected. |
Keep the async model_id override and provisioning paths together. Validate the combined sync and async clients with the Python offline suite.
Member
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.
Problem
Managed mode needs an
mlxcelbinary frombinary=,MLXCEL_BIN, orPATH. Without one,pip install mlxcelcannot start a server, and the error a user sees does not say which of those routes to take. Nothing downloads the engine, so a Python-only install is a dead end unless the user already built the project.Change
Resolve the engine binary in a documented order and provision it when no installed copy exists.
Resolution order —
binary=,MLXCEL_BIN,PATH, the version-keyed cache, then a download. Each refusal names the route that would have worked, so the failure is actionable rather than a bare "not found".Download and install — the release archive's
.sha256sibling is fetched and compared before anything is extracted. Extraction goes into a temporary staging tree and is published withos.replace, so a failed download, a losing race with another process, or a bad checksum never leaves a half-installed version behind.The version directory is the install unit, not the executable.
bin/andinclude/land together; a tree with a binary but no headers would let the JIT fail later instead of failing at install time. A header-layout guard refuses a strayinclude/in either packaging shape (flat orbin/-nested) while accepting a legitimate runtimeinclude/that belongs to the engine.Mlxcel*errors cover provisioning.find_cached_binaryconvertsOSErrorfrom an unreadable cache (for example a mode-000 cache root) intoMlxcelServerError. That is the one choke point all three public entry points go through —find_cached_binary,resolve_for_managed_mode,download_binary— so none of them can leak a barePermissionErrorto a caller checkingisinstance(exc, MlxcelError).python -m mlxcel installprovisions without starting a server. It rejects path-like versions (../../etc,/abs,1.0/../evil,a b) because the version is used as a cache directory name, and it honours--forceand-v.Docs —
docs/python-client.mdand a newdocs/python-client.ko.mddocument the resolution order, the cache layout (<cache>/bin/<version>/bin/mlxcel), managed versus connect mode, the socket path'ssun_pathlimit, and what each failure message means. The two language versions are kept clause-for-clause identical.Validation
python/tests: 220 passed, 2 skipped. The suite is offline: provisioning tests drive a mocked transport, and a test asserts zero HTTP requests are issued on the refusal paths.try/except OSErrorremoved, it fails with a barePermissionErroratpathlib/_local.py; restored, it passes.ruff check,ruff format --check, andmypy srcclean.include/.install -vfinishes with 0 bytes on stderr, and the installed engine reportsmlxcel 0.8.1.Notes
_provision.py, andMLXCEL_NO_DOWNLOAD=1plusauto_download=Falsealready disable downloading entirely.docs/python-client.ko.mdis a full translation of the English page, added because the repository already ships Korean technical reports. It is excluded from the build (documentation only).Refs #416