Repository navigation
air: add a hidden air deploy command that registers and serves a model - #7642
Draft
erarpitagarwal wants to merge 1 commit into
Draft
erarpitagarwal wants to merge 1 commit into
erarpitagarwal wants to merge 1 commit into
Conversation
`databricks air deploy -f deploy.yaml` registers a Unity Catalog model version through the registerModelPackage API (a checkpoint in a volume, a model from code, a model directory saved by MLflow) and serves it on a Model Serving endpoint, or serves an existing version. Registration is idempotent per key; the CLI repeats the same request until the version is ready, and prints the command that continues after Ctrl-C or --timeout. The command is hidden until the API is on everywhere. The run YAML loader, --override, -h config.<field>, code_source file selection and root path resolution are shared with `air run`. Co-authored-by: Isaac <no-reply@databricks.com>
Contributor
|
Thanks for the contribution! This pull request was opened from a fork. If you're a member of the Databricks organization, please request access to the If you're an external contributor, no action is needed; a maintainer will review your pull request. |
Contributor
|
An authorized user can trigger integration tests manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
This branch has not been deployed
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.
Changes
Add a hidden
databricks air deploycommand. It registers a model in Unity Catalog and serves it on a Model Serving endpoint, from one YAML file.model.typepicks the source:checkpoint: weights in a volume, plus the command that serves them.code: a Python file, with the files it imports fromcode_source, sent with the request.saved_model_dir: a model directory saved by MLflow, in a volume.registered: an existing model version.POST /api/2.0/serving-endpoints:registerModelPackagewith an idempotency key. It repeats the same request until the version is ready, because the server finalizes a checkpoint's version once its weights are copied. On Ctrl-C or--timeout, it prints the command that continues.--retry-failed-stagingcopies the weights again after a failure.air runYAML loader (--override,-h config.<field>, rejecting unknown fields), thecode_sourcefile selection and root path resolution, and the idempotency token helper. The shared helpers now take the schema, or the token, as a parameter.air runbehaves as before, except that one error now reads "config must be a YAML mapping" instead of "run config must be a YAML mapping".Why
Serving a checkpoint or an agent today means calling
mlflow.<flavor>.log_modelfrom Python: pickling a model, copying weights into it, and packing an environment. Withair deploy, the user hands over text (YAML and.pyfiles) and the files a training job already wrote to a volume. The server writes the MLmodel and builds the environment from the declared runtime and dependencies. The YAML keeps theair runnames for the fields the two share:environment,code_source,env_variables,secretsandidempotency_token.The command is hidden, with no changelog entry, until the registration API is on in every workspace. The API is off by default while it rolls out. Some decisions:
git ls-filesorder, so a later run sends the same bytes.__pycache__; the server can't place names that start with.anyway. Outside a git repository,code_source.include_pathsis required.--dry-runlists every file it would send.codeandsaved_model_dirnow, but the server registers only checkpoints until its follow-up lands, and until then answers the other two with "isn't supported yet". The CLI's checks follow the API's documented limits: checkpoint tasks, workload types (from the SDK), and the path, command, file and size caps.Tests
Running now:
go test ./cmd/air/,./task lint, and an end-to-end run of the built binary against a staging workspace that has the registration API. Results follow here.This pull request and its description were written by Isaac.