项目文件夹

文件
2026-07-13 13:22:34 +08:00

950 行
27 KiB
Protocol Buffer

syntax = "proto2";
package mlflow;
import "databricks.proto";
import "scalapb/scalapb.proto";
option java_generate_equals_and_hash = true;
option java_package = "org.mlflow.api.proto";
option py_generic_services = true;
option (scalapb.options) = {flat_package: true};
service ModelRegistryService {
// Throws ``RESOURCE_ALREADY_EXISTS`` if a registered model with the given name exists.
rpc createRegisteredModel(CreateRegisteredModel) returns (CreateRegisteredModel.Response) {
option (rpc) = {
endpoints: [
{
method: "POST"
path: "/mlflow/registered-models/create"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Create RegisteredModel"
};
}
rpc renameRegisteredModel(RenameRegisteredModel) returns (RenameRegisteredModel.Response) {
option (rpc) = {
endpoints: [
{
method: "POST"
path: "/mlflow/registered-models/rename"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Rename RegisteredModel"
};
}
rpc updateRegisteredModel(UpdateRegisteredModel) returns (UpdateRegisteredModel.Response) {
option (rpc) = {
endpoints: [
{
method: "PATCH"
path: "/mlflow/registered-models/update"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Update RegisteredModel"
};
}
rpc deleteRegisteredModel(DeleteRegisteredModel) returns (DeleteRegisteredModel.Response) {
option (rpc) = {
endpoints: [
{
method: "DELETE"
path: "/mlflow/registered-models/delete"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Delete RegisteredModel"
};
}
rpc getRegisteredModel(GetRegisteredModel) returns (GetRegisteredModel.Response) {
option (rpc) = {
endpoints: [
{
method: "GET"
path: "/mlflow/registered-models/get"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Get RegisteredModel"
};
}
rpc searchRegisteredModels(SearchRegisteredModels) returns (SearchRegisteredModels.Response) {
option (rpc) = {
endpoints: [
{
method: "GET"
path: "/mlflow/registered-models/search"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Search RegisteredModels"
};
}
rpc getLatestVersions(GetLatestVersions) returns (GetLatestVersions.Response) {
option (rpc) = {
endpoints: [
{
method: "POST"
path: "/mlflow/registered-models/get-latest-versions"
since: {
major: 2
minor: 0
}
},
{
method: "GET"
path: "/mlflow/registered-models/get-latest-versions"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Get Latest ModelVersions"
};
}
rpc createModelVersion(CreateModelVersion) returns (CreateModelVersion.Response) {
option (rpc) = {
endpoints: [
{
method: "POST"
path: "/mlflow/model-versions/create"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Create ModelVersion"
};
}
rpc updateModelVersion(UpdateModelVersion) returns (UpdateModelVersion.Response) {
option (rpc) = {
endpoints: [
{
method: "PATCH"
path: "/mlflow/model-versions/update"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Update ModelVersion"
};
}
rpc transitionModelVersionStage(TransitionModelVersionStage) returns (TransitionModelVersionStage.Response) {
option (rpc) = {
endpoints: [
{
method: "POST"
path: "/mlflow/model-versions/transition-stage"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Transition ModelVersion Stage"
};
}
rpc deleteModelVersion(DeleteModelVersion) returns (DeleteModelVersion.Response) {
option (rpc) = {
endpoints: [
{
method: "DELETE"
path: "/mlflow/model-versions/delete"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Delete ModelVersion"
};
}
rpc getModelVersion(GetModelVersion) returns (GetModelVersion.Response) {
option (rpc) = {
endpoints: [
{
method: "GET"
path: "/mlflow/model-versions/get"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Get ModelVersion"
};
}
rpc searchModelVersions(SearchModelVersions) returns (SearchModelVersions.Response) {
option (rpc) = {
endpoints: [
{
method: "GET"
path: "/mlflow/model-versions/search"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Search ModelVersions"
};
option (graphql) = {};
}
rpc getModelVersionDownloadUri(GetModelVersionDownloadUri) returns (GetModelVersionDownloadUri.Response) {
option (rpc) = {
endpoints: [
{
method: "GET"
path: "/mlflow/model-versions/get-download-uri"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Get Download URI For ModelVersion Artifacts"
};
}
rpc setRegisteredModelTag(SetRegisteredModelTag) returns (SetRegisteredModelTag.Response) {
option (rpc) = {
endpoints: [
{
method: "POST"
path: "/mlflow/registered-models/set-tag"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Set Registered Model Tag"
};
}
rpc setModelVersionTag(SetModelVersionTag) returns (SetModelVersionTag.Response) {
option (rpc) = {
endpoints: [
{
method: "POST"
path: "/mlflow/model-versions/set-tag"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Set Model Version Tag"
};
}
rpc deleteRegisteredModelTag(DeleteRegisteredModelTag) returns (DeleteRegisteredModelTag.Response) {
option (rpc) = {
endpoints: [
{
method: "DELETE"
path: "/mlflow/registered-models/delete-tag"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Delete Registered Model Tag"
};
}
rpc deleteModelVersionTag(DeleteModelVersionTag) returns (DeleteModelVersionTag.Response) {
option (rpc) = {
endpoints: [
{
method: "DELETE"
path: "/mlflow/model-versions/delete-tag"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Delete Model Version Tag"
};
}
rpc setRegisteredModelAlias(SetRegisteredModelAlias) returns (SetRegisteredModelAlias.Response) {
option (rpc) = {
endpoints: [
{
method: "POST"
path: "/mlflow/registered-models/alias"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Set Registered Model Alias"
};
}
rpc deleteRegisteredModelAlias(DeleteRegisteredModelAlias) returns (DeleteRegisteredModelAlias.Response) {
option (rpc) = {
endpoints: [
{
method: "DELETE"
path: "/mlflow/registered-models/alias"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Delete Registered Model Alias"
};
}
rpc getModelVersionByAlias(GetModelVersionByAlias) returns (GetModelVersionByAlias.Response) {
option (rpc) = {
endpoints: [
{
method: "GET"
path: "/mlflow/registered-models/alias"
since: {
major: 2
minor: 0
}
}
]
visibility: PUBLIC
rpc_doc_title: "Get Model Version by Alias"
};
}
}
message RegisteredModel {
// Unique name for the model.
optional string name = 1;
// Timestamp recorded when this ``registered_model`` was created.
optional int64 creation_timestamp = 2;
// Timestamp recorded when metadata for this ``registered_model`` was last updated.
optional int64 last_updated_timestamp = 3;
// User that created this ``registered_model``
// NOTE: this field is not currently returned.
optional string user_id = 4;
// Description of this ``registered_model``.
optional string description = 5;
// Collection of latest model versions for each stage.
// Only contains models with current ``READY`` status.
repeated ModelVersion latest_versions = 6;
// Tags: Additional metadata key-value pairs for this ``registered_model``.
repeated RegisteredModelTag tags = 7;
// Aliases pointing to model versions associated with this ``registered_model``.
repeated RegisteredModelAlias aliases = 8;
// Deployment job id for this model.
optional string deployment_job_id = 9;
// Deployment job state for this model.
optional DeploymentJobConnection.State deployment_job_state = 10;
}
enum ModelVersionStatus {
// Request to register a new model version is pending as server performs background tasks.
PENDING_REGISTRATION = 1;
// Request to register a new model version has failed.
FAILED_REGISTRATION = 2;
// Model version is ready for use.
READY = 3;
}
message ModelVersion {
// Unique name of the model
optional string name = 1;
// Model's version number.
optional string version = 2;
// Timestamp recorded when this ``model_version`` was created.
optional int64 creation_timestamp = 3;
// Timestamp recorded when metadata for this ``model_version`` was last updated.
optional int64 last_updated_timestamp = 4;
// User that created this ``model_version``.
optional string user_id = 5;
// Current stage for this ``model_version``.
optional string current_stage = 6;
// Description of this ``model_version``.
optional string description = 7;
// URI indicating the location of the source model artifacts, used when creating ``model_version``
optional string source = 8;
// MLflow run ID used when creating ``model_version``, if ``source`` was generated by an
// experiment run stored in MLflow tracking server.
optional string run_id = 9;
// Current status of ``model_version``
optional ModelVersionStatus status = 10;
// Details on current ``status``, if it is pending or failed.
optional string status_message = 11;
// Tags: Additional metadata key-value pairs for this ``model_version``.
repeated ModelVersionTag tags = 12;
// Run Link: Direct link to the run that generated this version. This field is set at model version creation time
// only for model versions whose source run is from a tracking server that is different from the registry server.
optional string run_link = 13;
// Aliases pointing to this ``model_version``.
repeated string aliases = 14;
// Optional `model_id` for model version that is used to link the registered model to the source logged model
optional string model_id = 15;
// Optional parameters for the model.
repeated ModelParam model_params = 16;
// Optional metrics for the model.
repeated ModelMetric model_metrics = 17;
// Deployment job state for this model version.
optional ModelVersionDeploymentJobState deployment_job_state = 19;
}
message DeploymentJobConnection {
enum State {
DEPLOYMENT_JOB_CONNECTION_STATE_UNSPECIFIED = 0;
// default state
NOT_SET_UP = 1;
// connected job: job exists, owner has ACLs, and required job parameters are present
CONNECTED = 2;
// job was deleted OR owner had job ACLs removed
NOT_FOUND = 3;
// required job parameters were changed
REQUIRED_PARAMETERS_CHANGED = 4;
}
}
message ModelVersionDeploymentJobState {
enum DeploymentJobRunState {
DEPLOYMENT_JOB_RUN_STATE_UNSPECIFIED = 0;
NO_VALID_DEPLOYMENT_JOB_FOUND = 1;
RUNNING = 2;
SUCCEEDED = 3;
FAILED = 4;
PENDING = 5;
APPROVAL = 6;
}
optional string job_id = 1;
optional string run_id = 2;
optional DeploymentJobConnection.State job_state = 3;
optional DeploymentJobRunState run_state = 4;
optional string current_task_name = 5;
}
message CreateRegisteredModel {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Register models under this name
optional string name = 1 [(validate_required) = true];
// Additional metadata for registered model.
repeated RegisteredModelTag tags = 2;
// Optional description for registered model.
optional string description = 3;
// Deployment job id for this model.
optional string deployment_job_id = 4;
message Response {
optional RegisteredModel registered_model = 1;
}
}
message RenameRegisteredModel {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Registered model unique name identifier.
optional string name = 1 [(validate_required) = true];
// If provided, updates the name for this ``registered_model``.
optional string new_name = 2;
message Response {
optional RegisteredModel registered_model = 1;
}
}
message UpdateRegisteredModel {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Registered model unique name identifier.
optional string name = 1 [(validate_required) = true];
// If provided, updates the description for this ``registered_model``.
optional string description = 2;
// Deployment job id for this model.
optional string deployment_job_id = 3;
message Response {
optional RegisteredModel registered_model = 1;
}
}
message DeleteRegisteredModel {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Registered model unique name identifier.
optional string name = 1 [(validate_required) = true];
message Response {}
}
message GetRegisteredModel {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Registered model unique name identifier.
optional string name = 1 [(validate_required) = true];
message Response {
optional RegisteredModel registered_model = 1;
}
}
message SearchRegisteredModels {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// String filter condition, like "name LIKE 'my-model-name'".
// Interpreted in the backend automatically as "name LIKE '%my-model-name%'".
// Single boolean condition, with string values wrapped in single quotes.
optional string filter = 1;
// Maximum number of models desired. Default is 100. Max threshold is 1000.
optional int64 max_results = 2 [default = 100];
// List of columns for ordering search results, which can include model name and last updated
// timestamp with an optional "DESC" or "ASC" annotation, where "ASC" is the default.
// Tiebreaks are done by model name ASC.
repeated string order_by = 3;
// Pagination token to go to the next page based on a previous search query.
optional string page_token = 4;
message Response {
// Registered Models that match the search criteria.
repeated RegisteredModel registered_models = 1;
// Pagination token to request the next page of models.
optional string next_page_token = 2;
}
}
message GetLatestVersions {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Registered model unique name identifier.
optional string name = 1 [(validate_required) = true];
// List of stages.
repeated string stages = 2;
message Response {
// Latest version models for each requests stage. Only return models with current ``READY`` status.
// If no ``stages`` provided, returns the latest version for each stage, including ``"None"``.
repeated ModelVersion model_versions = 1;
}
}
message CreateModelVersion {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Register model under this name
optional string name = 1 [(validate_required) = true];
// URI indicating the location of the model artifacts.
optional string source = 2 [(validate_required) = true];
// MLflow run ID for correlation, if ``source`` was generated by an experiment run in
// MLflow tracking server
optional string run_id = 3;
// Additional metadata for model version.
repeated ModelVersionTag tags = 4;
// MLflow run link - this is the exact link of the run that generated this model version,
// potentially hosted at another instance of MLflow.
optional string run_link = 5;
// Optional description for model version.
optional string description = 6;
// Optional `model_id` for model version that is used to link the registered model to the source logged model
optional string model_id = 7;
message Response {
// Return new version number generated for this model in registry.
optional ModelVersion model_version = 1;
}
}
message UpdateModelVersion {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Name of the registered model
optional string name = 1 [(validate_required) = true];
// Model version number
optional string version = 2 [(validate_required) = true];
// If provided, updates the description for this ``registered_model``.
optional string description = 3;
message Response {
// Return new version number generated for this model in registry.
optional ModelVersion model_version = 1;
}
}
message TransitionModelVersionStage {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Name of the registered model
optional string name = 1 [(validate_required) = true];
// Model version number
optional string version = 2 [(validate_required) = true];
// Transition `model_version` to new stage.
optional string stage = 3 [(validate_required) = true];
// When transitioning a model version to a particular stage, this flag dictates whether all
// existing model versions in that stage should be atomically moved to the "archived" stage.
// This ensures that at-most-one model version exists in the target stage.
// This field is *required* when transitioning a model versions's stage
optional bool archive_existing_versions = 4 [(validate_required) = true];
message Response {
// Updated model version
optional ModelVersion model_version = 1;
}
}
message DeleteModelVersion {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Name of the registered model
optional string name = 1 [(validate_required) = true];
// Model version number
optional string version = 2 [(validate_required) = true];
message Response {}
}
message GetModelVersion {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Name of the registered model
optional string name = 1 [(validate_required) = true];
// Model version number
optional string version = 2 [(validate_required) = true];
message Response {
optional ModelVersion model_version = 1;
}
}
message SearchModelVersions {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// String filter condition, like "name='my-model-name'". Must be a single boolean condition,
// with string values wrapped in single quotes.
optional string filter = 1;
// Maximum number of models desired. Max threshold is 200K. Backends may choose a lower default
// value and maximum threshold.
optional int64 max_results = 2 [default = 200000];
// List of columns to be ordered by including model name, version, stage with an
// optional "DESC" or "ASC" annotation, where "ASC" is the default.
// Tiebreaks are done by latest stage transition timestamp, followed by name ASC, followed by
// version DESC.
repeated string order_by = 3;
// Pagination token to go to next page based on previous search query.
optional string page_token = 4;
message Response {
// Models that match the search criteria
repeated ModelVersion model_versions = 1;
// Pagination token to request next page of models for the same search query.
optional string next_page_token = 2;
}
}
message GetModelVersionDownloadUri {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Name of the registered model
optional string name = 1 [(validate_required) = true];
// Model version number
optional string version = 2 [(validate_required) = true];
message Response {
// URI corresponding to where artifacts for this model version are stored.
optional string artifact_uri = 1;
}
}
// Tag for a model version.
message ModelVersionTag {
// The tag key.
optional string key = 1;
// The tag value.
optional string value = 2;
}
// Param for a model version.
message ModelParam {
// Name of the param.
optional string name = 1;
// Value of the param associated with the name, could be empty
optional string value = 2;
}
// Metric associated with a model, represented as a key-value pair.
// Copied from MLflow metric
message ModelMetric {
// Key identifying this metric.
optional string key = 1;
// Value associated with this metric.
optional double value = 2;
// The timestamp at which this metric was recorded.
optional int64 timestamp = 3;
// Step at which to log the metric.
optional int64 step = 4 [default = 0];
// The name of the dataset associated with the metric.
// E.g. "my.uc.table@2" "nyc-taxi-dataset", "fantastic-elk-3"
optional string dataset_name = 5 [(visibility) = PUBLIC_UNDOCUMENTED];
// Dataset digest of the dataset associated with the metric,
// e.g. an md5 hash of the dataset that uniquely identifies it
// within datasets of the same name.
optional string dataset_digest = 6 [(visibility) = PUBLIC_UNDOCUMENTED];
// The ID of the LoggedModel or Registered Model Version associated with
// the metric
optional string model_id = 7 [(visibility) = PUBLIC_UNDOCUMENTED];
// The ID of the run containing the metric.
optional string run_id = 8 [(visibility) = PUBLIC_UNDOCUMENTED];
}
// Tag for a registered model
message RegisteredModelTag {
// The tag key.
optional string key = 1;
// The tag value.
optional string value = 2;
}
message SetRegisteredModelTag {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Unique name of the model.
optional string name = 1 [(validate_required) = true];
// Name of the tag. Maximum size depends on storage backend.
// If a tag with this name already exists, its preexisting value will be replaced by the specified `value`.
// All storage backends are guaranteed to support key values up to 250 bytes in size.
optional string key = 2 [(validate_required) = true];
// String value of the tag being logged. Maximum size depends on storage backend.
optional string value = 3 [(validate_required) = true];
message Response {}
}
message SetModelVersionTag {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Unique name of the model.
optional string name = 1 [(validate_required) = true];
// Model version number.
optional string version = 2 [(validate_required) = true];
// Name of the tag. Maximum size depends on storage backend.
// If a tag with this name already exists, its preexisting value will be replaced by the specified `value`.
// All storage backends are guaranteed to support key values up to 250 bytes in size.
optional string key = 3 [(validate_required) = true];
// String value of the tag being logged. Maximum size depends on storage backend.
optional string value = 4 [(validate_required) = true];
message Response {}
}
message DeleteRegisteredModelTag {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Name of the registered model that the tag was logged under.
optional string name = 1 [(validate_required) = true];
// Name of the tag. The name must be an exact match; wild-card deletion is not supported. Maximum size is 250 bytes.
optional string key = 2 [(validate_required) = true];
message Response {}
}
message DeleteModelVersionTag {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Name of the registered model that the tag was logged under.
optional string name = 1 [(validate_required) = true];
// Model version number that the tag was logged under.
optional string version = 2 [(validate_required) = true];
// Name of the tag. The name must be an exact match; wild-card deletion is not supported. Maximum size is 250 bytes.
optional string key = 3 [(validate_required) = true];
message Response {}
}
// Alias for a registered model
message RegisteredModelAlias {
// The name of the alias.
optional string alias = 1;
// The model version number that the alias points to.
optional string version = 2;
}
message SetRegisteredModelAlias {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Name of the registered model.
optional string name = 1 [(validate_required) = true];
// Name of the alias. Maximum size depends on storage backend.
// If an alias with this name already exists, its preexisting value will be replaced by the specified `version`.
// All storage backends are guaranteed to support alias name values up to 256 bytes in size.
optional string alias = 2 [(validate_required) = true];
// Model version number.
optional string version = 3 [(validate_required) = true];
message Response {}
}
message DeleteRegisteredModelAlias {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Name of the registered model.
optional string name = 1 [(validate_required) = true];
// Name of the alias. The name must be an exact match; wild-card deletion is not supported. Maximum size is 256 bytes.
optional string alias = 2 [(validate_required) = true];
message Response {}
}
message GetModelVersionByAlias {
option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
// Name of the registered model.
optional string name = 1 [(validate_required) = true];
// Name of the alias. Maximum size is 256 bytes.
optional string alias = 2 [(validate_required) = true];
message Response {
optional ModelVersion model_version = 1;
}
}