Repository navigation
feat: depend on mlflow-skinny with optional full extra (#6152) - #6350
mohamedzeidan2021 wants to merge 2 commits into
Conversation
|
Claude finished @mohamedzeidan2021's task in 2m 13s —— View job PR Review: depend on mlflow-skinny with optional full extra
The core change is sound. I traced every client-side Client-side usage is skinny-compatible (verified):
All of these are tracking/registry APIs present in
Points worth considering (non-blocking)
VerdictCorrect and well-scoped. The banned-v2/v3 conventions in (Note: the inline-comment tool wasn't available in this run, so findings are consolidated here.) |
Switching sagemaker-serve from `mlflow` to `mlflow-skinny` silently dropped
`docker`. Full mlflow declares `docker>=4.0.0,<8`; mlflow-skinny declares no
such requirement, and `docker` was never declared by sagemaker-serve itself.
`docker` is imported at module scope and sits on the eager import path out of
the package `__init__`:
sagemaker/serve/__init__.py:29 -> sagemaker.serve.model_builder
sagemaker/serve/model_builder.py:81 -> sagemaker.serve.mode.local_container_mode
sagemaker/serve/mode/local_container_mode.py:12 -> import docker
so losing it breaks `import sagemaker.serve` outright rather than degrading a
niche local-container path. It also affects
model_server/{triton,tgi,djl_serving,tei}/server.py.
This surfaced as 18 collection errors in integ-tests-us-east-1 with
`ModuleNotFoundError: No module named 'docker'`; other jobs stayed green only
because their runners happened to have docker installed already, which is what
made the wrong dependency set easy to miss.
The bound matches the v2 precedent in
requirements/extras/local_requirements.txt (`docker>=5.0.2,<8.0.0`) and is
compatible with mlflow's own `>=4.0.0,<8`.
Audited the rest of the full-mlflow -> mlflow-skinny delta (aiohttp, alembic,
cryptography, flask, flask-cors, graphene, gunicorn, huey, matplotlib, numpy,
pandas, pyarrow, scikit-learn, scipy, skops, sqlalchemy, waitress): docker is
the only one that was both dropped and imported at module scope. numpy, pandas,
scipy and cryptography remain satisfied via sagemaker-core, graphene via
sagemaker-train's own declaration, and matplotlib/sklearn are imported lazily
inside functions on opt-in paths.
Adds tests/unit/test_declared_dependencies.py, which fails when any
module-level third-party import in sagemaker-serve has no declared
distribution across sagemaker-{serve,core,train}. Verified it catches this
exact regression: removing the new line makes it fail and name all six
importing files.
|
Claude finished @mohamedzeidan2021's task in 3m 41s —— View job PR Review:
|
lucasjia-aws
left a comment
There was a problem hiding this comment.
Automated review: 1 non-blocking suggestion. See inline comment.
| # the full MLflow model-flavor loaders (mlflow.pyfunc/sklearn/pytorch/...) are used | ||
| # only by the container-side inference handlers that run inside the DLC. Install this | ||
| # extra to pull in the full MLflow package locally. | ||
| full = ["mlflow"] |
There was a problem hiding this comment.
[suggestion] dependencies
The full extra declares mlflow with no version bound, while the sibling sagemaker-train change in this same PR pins full = ["mlflow>=3.0.0,<4.0.0"]. Leaving it unbounded lets the extra resolve to a future major (mlflow 4.x+) whose transitive requirements may diverge from what serve expects (e.g. its docker bound vs. serve's docker>=5.0.2,<8.0.0). Pin an upper bound for consistency with train:
full = ["mlflow>=3.0.0,<4.0.0"]
Problem
sagemaker-trainandsagemaker-servepull in the fullmlflowpackage, which drags in heavy, unused transitive dependencies (model-flavor loaders, tracking server, scipy/scikit-learn, etc.). All client-side mlflow usage in these packages is tracking/registry only — the same footprintsagemaker-mlflow0.5.0 already trimmed tomlflow-skinny.Fix
sagemaker-train: depend onmlflow-skinny>=3.0.0,<4.0.0; expose full MLflow behind a newfull = ["mlflow>=3.0.0,<4.0.0"]optional extra.sagemaker-serve: depend onmlflow-skinny; add matchingfull = ["mlflow"]extra.Full MLflow (flavor loaders
mlflow.pyfunc/sklearn/pytorch/...) is only needed by the container-side inference handlers (model_server/torchserve/inference.py,xgboost_inference.py) that run inside the DLC, where full MLflow is present — never in the client env.mlflow.search_runs()still works because pandas is a hard dependency ofsagemaker-core, which both packages require.Testing
import mlflow/from mlflowuses only skinny-provided tracking/registry APIs; flavor loaders exist solely in the tarball-packaged container handlers (deferredimportlib.import_module, no module-level import).tomllibvalidation: both files parse,mlflow-skinnyis the runtime dep,fullextra present, no fullmlflowindependencies.importlib.import_module), so CI stays green without full MLflow.Fixes #6152