/ mlflow / protos / mlflow_artifacts.proto
mlflow_artifacts.proto
  1  // This proto file defines the MLflow Artifacts Service that provides the following REST APIs
  2  // for proxied artifact operations:
  3  // - /mlflow-artifacts/artifacts/<artifact_path> GET: Download an artifact
  4  // - /mlflow-artifacts/artifacts/<artifact_path> PUT: Upload an artifact
  5  // - /mlflow-artifacts/artifact?path=<value> GET: List artifacts
  6  
  7  syntax = "proto2";
  8  
  9  package mlflow.artifacts;
 10  
 11  import "databricks.proto";
 12  import "scalapb/scalapb.proto";
 13  
 14  option java_package = "org.mlflow.api.proto";
 15  option py_generic_services = true;
 16  option (scalapb.options) = {flat_package: true};
 17  
 18  service MlflowArtifactsService {
 19    rpc downloadArtifact(DownloadArtifact) returns (DownloadArtifact.Response) {
 20      option (rpc) = {
 21        endpoints: [
 22          {
 23            method: "GET"
 24            path: "/mlflow-artifacts/artifacts/<path:artifact_path>"
 25            since: {
 26              major: 2
 27              minor: 0
 28            }
 29          }
 30        ]
 31        visibility: PUBLIC
 32        rpc_doc_title: "Download Artifact"
 33      };
 34    }
 35  
 36    rpc uploadArtifact(UploadArtifact) returns (UploadArtifact.Response) {
 37      option (rpc) = {
 38        endpoints: [
 39          {
 40            method: "PUT"
 41            path: "/mlflow-artifacts/artifacts/<path:artifact_path>"
 42            since: {
 43              major: 2
 44              minor: 0
 45            }
 46          }
 47        ]
 48        visibility: PUBLIC
 49        rpc_doc_title: "Upload Artifact"
 50      };
 51    }
 52  
 53    rpc listArtifacts(ListArtifacts) returns (ListArtifacts.Response) {
 54      option (rpc) = {
 55        endpoints: [
 56          {
 57            method: "GET"
 58            path: "/mlflow-artifacts/artifacts"
 59            since: {
 60              major: 2
 61              minor: 0
 62            }
 63          }
 64        ]
 65        visibility: PUBLIC
 66        rpc_doc_title: "List Artifacts"
 67      };
 68    }
 69  
 70    rpc deleteArtifact(DeleteArtifact) returns (DeleteArtifact.Response) {
 71      option (rpc) = {
 72        endpoints: [
 73          {
 74            method: "DELETE"
 75            path: "/mlflow-artifacts/artifacts/<path:artifact_path>"
 76            since: {
 77              major: 2
 78              minor: 0
 79            }
 80          }
 81        ]
 82        visibility: PUBLIC
 83        rpc_doc_title: "Delete Artifacts"
 84      };
 85    }
 86  
 87    rpc createMultipartUpload(CreateMultipartUpload) returns (CreateMultipartUpload.Response) {
 88      option (rpc) = {
 89        endpoints: [
 90          {
 91            method: "POST"
 92            path: "/mlflow-artifacts/mpu/create/<path:artifact_path>"
 93            since: {
 94              major: 2
 95              minor: 0
 96            }
 97          }
 98        ]
 99        visibility: PUBLIC
100        rpc_doc_title: "Create an Artifact Multipart Upload"
101      };
102    }
103  
104    rpc completeMultipartUpload(CompleteMultipartUpload) returns (CompleteMultipartUpload.Response) {
105      option (rpc) = {
106        endpoints: [
107          {
108            method: "POST"
109            path: "/mlflow-artifacts/mpu/complete/<path:artifact_path>"
110            since: {
111              major: 2
112              minor: 0
113            }
114          }
115        ]
116        visibility: PUBLIC
117        rpc_doc_title: "Complete an Artifact Multipart Upload"
118      };
119    }
120  
121    rpc abortMultipartUpload(AbortMultipartUpload) returns (AbortMultipartUpload.Response) {
122      option (rpc) = {
123        endpoints: [
124          {
125            method: "POST"
126            path: "/mlflow-artifacts/mpu/abort/<path:artifact_path>"
127            since: {
128              major: 2
129              minor: 0
130            }
131          }
132        ]
133        visibility: PUBLIC
134        rpc_doc_title: "Abort an Artifact Multipart Upload"
135      };
136    }
137  
138    rpc getPresignedDownloadUrl(GetPresignedDownloadUrl) returns (GetPresignedDownloadUrl.Response) {
139      option (rpc) = {
140        endpoints: [
141          {
142            method: "GET"
143            path: "/mlflow-artifacts/presigned/<path:artifact_path>"
144            since: {
145              major: 2
146              minor: 0
147            }
148          }
149        ]
150        visibility: PUBLIC
151        rpc_doc_title: "Get Presigned URL for Multipart Download"
152      };
153    }
154  }
155  
156  message DownloadArtifact {
157    message Response {}
158  }
159  
160  message UploadArtifact {
161    message Response {}
162  }
163  
164  message ListArtifacts {
165    // Filter artifacts matching this path (a relative path from the root artifact directory).
166    optional string path = 1;
167  
168    message Response {
169      // File location and metadata for artifacts.
170      repeated FileInfo files = 1;
171    }
172  }
173  
174  message DeleteArtifact {
175    message Response {}
176  }
177  
178  message FileInfo {
179    // Path relative to the root artifact directory run.
180    optional string path = 1;
181  
182    // Whether the path is a directory.
183    optional bool is_dir = 2;
184  
185    // Size in bytes. Unset for directories.
186    optional int64 file_size = 3;
187  }
188  
189  message CreateMultipartUpload {
190    optional string path = 1;
191  
192    optional int64 num_parts = 2;
193  
194    message Response {
195      optional string upload_id = 1;
196  
197      repeated MultipartUploadCredential credentials = 2;
198    }
199  }
200  
201  message CompleteMultipartUpload {
202    optional string path = 1;
203  
204    optional string upload_id = 2;
205  
206    repeated MultipartUploadPart parts = 3;
207  
208    message Response {}
209  }
210  
211  message AbortMultipartUpload {
212    optional string path = 1;
213  
214    optional string upload_id = 2;
215  
216    message Response {}
217  }
218  
219  message MultipartUploadCredential {
220    optional string url = 1;
221  
222    optional int64 part_number = 2;
223  
224    map<string, string> headers = 3;
225  }
226  
227  message MultipartUploadPart {
228    optional int64 part_number = 1;
229  
230    optional string etag = 2;
231  
232    optional string url = 3;
233  }
234  
235  message GetPresignedDownloadUrl {
236    message Response {
237      // The presigned URL for downloading the artifact directly from cloud storage.
238      optional string url = 1;
239  
240      // Optional headers that must be included in the download request.
241      map<string, string> headers = 2;
242  
243      // Optional size of the file in bytes.
244      optional int64 file_size = 3;
245    }
246  }