code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def _download_file(self, remote_file_path, local_path): """ Download the file at the specified relative remote path and saves it at the specified local path. Args: remote_file_path: Source path to the remote file, relative to the root directory of the artifac...
Download the file at the specified relative remote path and saves it at the specified local path. Args: remote_file_path: Source path to the remote file, relative to the root directory of the artifact repository. local_path: The path to which to save the...
_download_file
python
mlflow/mlflow
mlflow/store/artifact/artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/artifact_repo.py
Apache-2.0
def delete_artifacts(self, artifact_path=None): """ Delete the artifacts at the specified location. Supports the deletion of a single file or of a directory. Deletion of a directory is recursive. Args: artifact_path: Path of the artifact to delete. """
Delete the artifacts at the specified location. Supports the deletion of a single file or of a directory. Deletion of a directory is recursive. Args: artifact_path: Path of the artifact to delete.
delete_artifacts
python
mlflow/mlflow
mlflow/store/artifact/artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/artifact_repo.py
Apache-2.0
def max_workers(self) -> int: """Compute the number of workers to use for multi-threading.""" num_cpus = os.cpu_count() or _NUM_DEFAULT_CPUS return min(num_cpus * _NUM_MAX_THREADS_PER_CPU, _NUM_MAX_THREADS)
Compute the number of workers to use for multi-threading.
max_workers
python
mlflow/mlflow
mlflow/store/artifact/artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/artifact_repo.py
Apache-2.0
def download_trace_data(self) -> dict[str, Any]: """ Download the trace data. Returns: The trace data as a dictionary. Raises: - `MlflowTraceDataNotFound`: The trace data is not found. - `MlflowTraceDataCorrupted`: The trace data is corrupted. ...
Download the trace data. Returns: The trace data as a dictionary. Raises: - `MlflowTraceDataNotFound`: The trace data is not found. - `MlflowTraceDataCorrupted`: The trace data is corrupted.
download_trace_data
python
mlflow/mlflow
mlflow/store/artifact/artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/artifact_repo.py
Apache-2.0
def create_multipart_upload( self, local_file: str, num_parts: int, artifact_path: Optional[str] = None ) -> CreateMultipartUploadResponse: """ Initiate a multipart upload and retrieve the pre-signed upload URLS and upload id. Args: local_file: Path of artifact to upload...
Initiate a multipart upload and retrieve the pre-signed upload URLS and upload id. Args: local_file: Path of artifact to upload. num_parts: Number of parts to upload. Only required by S3 and GCS. artifact_path: Directory within the run's artifact directory in which ...
create_multipart_upload
python
mlflow/mlflow
mlflow/store/artifact/artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/artifact_repo.py
Apache-2.0
def complete_multipart_upload( self, local_file: str, upload_id: str, parts: list[MultipartUploadPart], artifact_path: Optional[str] = None, ) -> None: """ Complete a multipart upload. Args: local_file: Path of artifact to upload. ...
Complete a multipart upload. Args: local_file: Path of artifact to upload. upload_id: The upload ID. Only required by S3 and GCS. parts: A list containing the metadata of each part that has been uploaded. artifact_path: Directory within the run's artifac...
complete_multipart_upload
python
mlflow/mlflow
mlflow/store/artifact/artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/artifact_repo.py
Apache-2.0
def abort_multipart_upload( self, local_file: str, upload_id: str, artifact_path: Optional[str] = None, ) -> None: """ Abort a multipart upload. Args: local_file: Path of artifact to upload. upload_id: The upload ID. Only required by S...
Abort a multipart upload. Args: local_file: Path of artifact to upload. upload_id: The upload ID. Only required by S3 and GCS. artifact_path: Directory within the run's artifact directory in which to upload the artifact.
abort_multipart_upload
python
mlflow/mlflow
mlflow/store/artifact/artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/artifact_repo.py
Apache-2.0
def get_artifact_repository(self, artifact_uri): """ Get an artifact repository from the registry based on the scheme of artifact_uri Args: artifact_uri: The artifact store URI. This URI is used to select which artifact repository implementation to instantiate and is...
Get an artifact repository from the registry based on the scheme of artifact_uri Args: artifact_uri: The artifact store URI. This URI is used to select which artifact repository implementation to instantiate and is passed to the constructor of the implementa...
get_artifact_repository
python
mlflow/mlflow
mlflow/store/artifact/artifact_repository_registry.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/artifact_repository_registry.py
Apache-2.0
def parse_wasbs_uri(uri): """Parse a wasbs:// URI, returning (container, storage_account, path, api_uri_suffix).""" parsed = urllib.parse.urlparse(uri) if parsed.scheme != "wasbs": raise Exception(f"Not a WASBS URI: {uri}") match = re.match( r"([^@]+)@([^.]+)\.(b...
Parse a wasbs:// URI, returning (container, storage_account, path, api_uri_suffix).
parse_wasbs_uri
python
mlflow/mlflow
mlflow/store/artifact/azure_blob_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/azure_blob_artifact_repo.py
Apache-2.0
def _parse_abfss_uri(uri): """ Parse an ABFSS URI in the format "abfss://<file_system>@<account_name>.<domain_suffix>/<path>", returning a tuple consisting of the filesystem, account name, domain suffix, and path See more details about ABFSS URIs at https://learn.microsoft.com/en-us/azure/stora...
Parse an ABFSS URI in the format "abfss://<file_system>@<account_name>.<domain_suffix>/<path>", returning a tuple consisting of the filesystem, account name, domain suffix, and path See more details about ABFSS URIs at https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-abfs-dr...
_parse_abfss_uri
python
mlflow/mlflow
mlflow/store/artifact/azure_data_lake_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/azure_data_lake_artifact_repo.py
Apache-2.0
def _multipart_upload(self, credentials, src_file_path, artifact_file_path): """ Uploads a file to a given Azure storage location using the ADLS gen2 API. """ try: headers = self._extract_headers_from_credentials(credentials.headers) # try to create the file ...
Uploads a file to a given Azure storage location using the ADLS gen2 API.
_multipart_upload
python
mlflow/mlflow
mlflow/store/artifact/azure_data_lake_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/azure_data_lake_artifact_repo.py
Apache-2.0
def _get_presigned_uri(self, artifact_file_path): """ Gets the presigned URL required to upload a file to or download a file from a given Azure storage location. Args: artifact_file_path: Path of the file relative to the artifact repository root. Returns: ...
Gets the presigned URL required to upload a file to or download a file from a given Azure storage location. Args: artifact_file_path: Path of the file relative to the artifact repository root. Returns: a string presigned URL.
_get_presigned_uri
python
mlflow/mlflow
mlflow/store/artifact/azure_data_lake_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/azure_data_lake_artifact_repo.py
Apache-2.0
def commands(): """ Upload, list, and download artifacts from an MLflow artifact repository. To manage artifacts for a run associated with a tracking server, set the MLFLOW_TRACKING_URI environment variable to the URL of the desired server. """
Upload, list, and download artifacts from an MLflow artifact repository. To manage artifacts for a run associated with a tracking server, set the MLFLOW_TRACKING_URI environment variable to the URL of the desired server.
commands
python
mlflow/mlflow
mlflow/store/artifact/cli.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/cli.py
Apache-2.0
def log_artifact(local_file, run_id, artifact_path): """ Log a local file as an artifact of a run, optionally within a run-specific artifact path. Run artifacts can be organized into directories, so you can place the artifact in a directory this way. """ store = _get_store() artifact_uri = s...
Log a local file as an artifact of a run, optionally within a run-specific artifact path. Run artifacts can be organized into directories, so you can place the artifact in a directory this way.
log_artifact
python
mlflow/mlflow
mlflow/store/artifact/cli.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/cli.py
Apache-2.0
def log_artifacts(local_dir, run_id, artifact_path): """ Log the files within a local directory as an artifact of a run, optionally within a run-specific artifact path. Run artifacts can be organized into directories, so you can place the artifact in a directory this way. """ store = _get_store(...
Log the files within a local directory as an artifact of a run, optionally within a run-specific artifact path. Run artifacts can be organized into directories, so you can place the artifact in a directory this way.
log_artifacts
python
mlflow/mlflow
mlflow/store/artifact/cli.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/cli.py
Apache-2.0
def list_artifacts(run_id, artifact_path): """ Return all the artifacts directly under run's root artifact directory, or a sub-directory. The output is a JSON-formatted list. """ artifact_path = artifact_path if artifact_path is not None else "" store = _get_store() artifact_uri = store.get_...
Return all the artifacts directly under run's root artifact directory, or a sub-directory. The output is a JSON-formatted list.
list_artifacts
python
mlflow/mlflow
mlflow/store/artifact/cli.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/cli.py
Apache-2.0
def download_artifacts(run_id, artifact_path, artifact_uri, dst_path): """ Download an artifact file or directory to a local directory. The output is the name of the file or directory on the local filesystem. Either ``--artifact-uri`` or ``--run-id`` must be provided. """ # Preserve preexisting...
Download an artifact file or directory to a local directory. The output is the name of the file or directory on the local filesystem. Either ``--artifact-uri`` or ``--run-id`` must be provided.
download_artifacts
python
mlflow/mlflow
mlflow/store/artifact/cli.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/cli.py
Apache-2.0
def _validate_chunk_size_aws(chunk_size: int) -> None: """ Validates the specified chunk size in bytes is in valid range for AWS multipart uploads. """ if chunk_size < _AWS_MIN_CHUNK_SIZE or chunk_size > _AWS_MAX_CHUNK_SIZE: raise MlflowException( message=( f"Multipar...
Validates the specified chunk size in bytes is in valid range for AWS multipart uploads.
_validate_chunk_size_aws
python
mlflow/mlflow
mlflow/store/artifact/cloud_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/cloud_artifact_repo.py
Apache-2.0
def _complete_futures(futures_dict, file): """ Waits for the completion of all the futures in the given dictionary and returns a tuple of two dictionaries. The first dictionary contains the results of the futures (unordered) and the second contains the errors (unordered) that occurred during the exe...
Waits for the completion of all the futures in the given dictionary and returns a tuple of two dictionaries. The first dictionary contains the results of the futures (unordered) and the second contains the errors (unordered) that occurred during the execution of the futures.
_complete_futures
python
mlflow/mlflow
mlflow/store/artifact/cloud_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/cloud_artifact_repo.py
Apache-2.0
def _get_write_credential_infos(self, remote_file_paths): """ Retrieve write credentials for a batch of remote file paths, including presigned URLs. Args: remote_file_paths: List of file paths in the remote artifact repository. Returns: List of ArtifactCredentia...
Retrieve write credentials for a batch of remote file paths, including presigned URLs. Args: remote_file_paths: List of file paths in the remote artifact repository. Returns: List of ArtifactCredentialInfo objects corresponding to each file path.
_get_write_credential_infos
python
mlflow/mlflow
mlflow/store/artifact/cloud_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/cloud_artifact_repo.py
Apache-2.0
def _upload_to_cloud(self, cloud_credential_info, src_file_path, artifact_file_path): """ Upload a single file to the cloud. Args: cloud_credential_info: ArtifactCredentialInfo object with presigned URL for the file. src_file_path: Local source file path for the upload. ...
Upload a single file to the cloud. Args: cloud_credential_info: ArtifactCredentialInfo object with presigned URL for the file. src_file_path: Local source file path for the upload. artifact_file_path: Path in the artifact repository where the artifact will be logged...
_upload_to_cloud
python
mlflow/mlflow
mlflow/store/artifact/cloud_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/cloud_artifact_repo.py
Apache-2.0
def _get_read_credential_infos(self, remote_file_paths): """ Retrieve read credentials for a batch of remote file paths, including presigned URLs. Args: remote_file_paths: List of file paths in the remote artifact repository. Returns: List of ArtifactCredentialI...
Retrieve read credentials for a batch of remote file paths, including presigned URLs. Args: remote_file_paths: List of file paths in the remote artifact repository. Returns: List of ArtifactCredentialInfo objects corresponding to each file path.
_get_read_credential_infos
python
mlflow/mlflow
mlflow/store/artifact/cloud_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/cloud_artifact_repo.py
Apache-2.0
def _download_from_cloud(self, remote_file_path, local_path): """ Download a file from the input `remote_file_path` and save it to `local_path`. Args: remote_file_path: Path to file in the remote artifact repository. local_path: Local path to download file to. "...
Download a file from the input `remote_file_path` and save it to `local_path`. Args: remote_file_path: Path to file in the remote artifact repository. local_path: Local path to download file to.
_download_from_cloud
python
mlflow/mlflow
mlflow/store/artifact/cloud_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/cloud_artifact_repo.py
Apache-2.0
def _refresh_credentials(self): """ Refresh credentials for user in the case of credential expiration Args: None """
Refresh credentials for user in the case of credential expiration Args: None
_refresh_credentials
python
mlflow/mlflow
mlflow/store/artifact/cloud_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/cloud_artifact_repo.py
Apache-2.0
def _extract_resource(self, artifact_uri) -> _Resource: """ The artifact_uri is expected to be in one of the following formats: - dbfs:/databricks/mlflow-tracking/<EXP_ID>/<RUN_ID>/artifacts/<path> - dbfs:/databricks/mlflow-tracking/<EXP_ID>/logged_models/<MODEL_ID>/artifacts/<path> ...
The artifact_uri is expected to be in one of the following formats: - dbfs:/databricks/mlflow-tracking/<EXP_ID>/<RUN_ID>/artifacts/<path> - dbfs:/databricks/mlflow-tracking/<EXP_ID>/logged_models/<MODEL_ID>/artifacts/<path> - databricks/mlflow-tracking/<EXP_ID>/<RUN_ID>/artifacts/<path>...
_extract_resource
python
mlflow/mlflow
mlflow/store/artifact/databricks_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/databricks_artifact_repo.py
Apache-2.0
def _call_endpoint( self, service, api, json_body=None, path_params=None, retry_timeout_seconds=None ): """ Calls the specified REST endpoint with the specified JSON body and path parameters. Args: service: The service to call. api: The API to call. ...
Calls the specified REST endpoint with the specified JSON body and path parameters. Args: service: The service to call. api: The API to call. json_body: The JSON body of the request. path_params: The path parameters to substitute into the endpoint URI. ...
_call_endpoint
python
mlflow/mlflow
mlflow/store/artifact/databricks_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/databricks_artifact_repo.py
Apache-2.0
def _get_credential_infos(self, cred_type: _CredentialType, paths: list[str]): """ Issue one or more requests for artifact credentials, providing read or write access to the specified resource relative artifact `paths` within the MLflow resource specified by `self.resource.id`. The type ...
Issue one or more requests for artifact credentials, providing read or write access to the specified resource relative artifact `paths` within the MLflow resource specified by `self.resource.id`. The type of access credentials, read or write, is specified by `request_message_class`. ...
_get_credential_infos
python
mlflow/mlflow
mlflow/store/artifact/databricks_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/databricks_artifact_repo.py
Apache-2.0
def _get_write_credential_infos(self, remote_file_paths): """ A list of `ArtifactCredentialInfo` objects providing write access to the specified relative artifact `paths` within the MLflow resource specified by `self.resource.id`. """ relative_remote_paths = [ posixpa...
A list of `ArtifactCredentialInfo` objects providing write access to the specified relative artifact `paths` within the MLflow resource specified by `self.resource.id`.
_get_write_credential_infos
python
mlflow/mlflow
mlflow/store/artifact/databricks_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/databricks_artifact_repo.py
Apache-2.0
def _get_read_credential_infos(self, remote_file_paths): """ Returns: A list of `ArtifactCredentialInfo` objects providing read access to the specified relative artifact `paths` within the MLflow resource specified. """ if type(remote_file_paths) == str: ...
Returns: A list of `ArtifactCredentialInfo` objects providing read access to the specified relative artifact `paths` within the MLflow resource specified.
_get_read_credential_infos
python
mlflow/mlflow
mlflow/store/artifact/databricks_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/databricks_artifact_repo.py
Apache-2.0
def _azure_upload_chunk( self, credentials, headers, local_file, artifact_file_path, start_byte, size, get_credentials, ): """ Uploads a chunk of a file to a given Azure storage location. Args: credentials: The cred...
Uploads a chunk of a file to a given Azure storage location. Args: credentials: The credentials for the upload. headers: The headers for the upload. local_file: The local file to upload. artifact_file_path: The path to the artifact file. star...
_azure_upload_chunk
python
mlflow/mlflow
mlflow/store/artifact/databricks_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/databricks_artifact_repo.py
Apache-2.0
def _retryable_adls_function(self, func, artifact_file_path, get_credentials, **kwargs): """ Calls the passed function, retrying if the credentials have expired. Args: func: The function to call. artifact_file_path: The artifact file path. get_credentials: Th...
Calls the passed function, retrying if the credentials have expired. Args: func: The function to call. artifact_file_path: The artifact file path. get_credentials: The function to call to get new credentials. **kwargs: The keyword arguments to pass to th...
_retryable_adls_function
python
mlflow/mlflow
mlflow/store/artifact/databricks_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/databricks_artifact_repo.py
Apache-2.0
def _azure_adls_gen2_upload_file( self, credentials, local_file, artifact_file_path, get_credentials ): """ Uploads a file to a given Azure storage location using the ADLS gen2 API. Args: credentials: The credentials for the upload. local_file: The local file...
Uploads a file to a given Azure storage location using the ADLS gen2 API. Args: credentials: The credentials for the upload. local_file: The local file to upload. artifact_file_path: The path to the artifact file. get_credentials: The function to call to...
_azure_adls_gen2_upload_file
python
mlflow/mlflow
mlflow/store/artifact/databricks_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/databricks_artifact_repo.py
Apache-2.0
def _upload_to_cloud(self, cloud_credential_info, src_file_path, artifact_file_path): """ Upload a local file to the cloud. Note that in this artifact repository, files are uploaded to resource relative artifact file paths in the artifact repository. Args: cloud_credential_i...
Upload a local file to the cloud. Note that in this artifact repository, files are uploaded to resource relative artifact file paths in the artifact repository. Args: cloud_credential_info: ArtifactCredentialInfo object with presigned URL for the file. src_file_path: Lo...
_upload_to_cloud
python
mlflow/mlflow
mlflow/store/artifact/databricks_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/databricks_artifact_repo.py
Apache-2.0
def _download_from_cloud(self, remote_file_path, local_path): """ Download a file from the input `remote_file_path` and save it to `local_path`. Args: remote_file_path: Path relative to the resource root path to file in remote artifact repository. local_p...
Download a file from the input `remote_file_path` and save it to `local_path`. Args: remote_file_path: Path relative to the resource root path to file in remote artifact repository. local_path: Local path to download file to.
_download_from_cloud
python
mlflow/mlflow
mlflow/store/artifact/databricks_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/databricks_artifact_repo.py
Apache-2.0
def get_credentials( self, cred_type: _CredentialType, paths: Optional[list[str]] = None, page_token: Optional[str] = None, ) -> tuple[list[ArtifactCredentialInfo], Optional[str]]: """ Fetches read/write credentials for the specified paths. """
Fetches read/write credentials for the specified paths.
get_credentials
python
mlflow/mlflow
mlflow/store/artifact/databricks_artifact_repo_resources.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/databricks_artifact_repo_resources.py
Apache-2.0
def get_artifact_root(self) -> str: """ Get the artifact root URI of this resource. """
Get the artifact root URI of this resource.
get_artifact_root
python
mlflow/mlflow
mlflow/store/artifact/databricks_artifact_repo_resources.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/databricks_artifact_repo_resources.py
Apache-2.0
def _list_artifacts( self, path: Optional[str] = None, page_token: Optional[str] = None, ) -> ListArtifactsPage: """ List artifacts under the specified path. """
List artifacts under the specified path.
_list_artifacts
python
mlflow/mlflow
mlflow/store/artifact/databricks_artifact_repo_resources.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/databricks_artifact_repo_resources.py
Apache-2.0
def list_artifacts(self, path: Optional[str] = None) -> list[FileInfo]: """ Handle pagination and return all artifacts under the specified path. """ files: list[FileInfo] = [] page_token: Optional[str] = None while True: page = self._list_artifacts(path, page_...
Handle pagination and return all artifacts under the specified path.
list_artifacts
python
mlflow/mlflow
mlflow/store/artifact/databricks_artifact_repo_resources.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/databricks_artifact_repo_resources.py
Apache-2.0
def dbfs_artifact_repo_factory(artifact_uri): """ Returns an ArtifactRepository subclass for storing artifacts on DBFS. This factory method is used with URIs of the form ``dbfs:/<path>``. DBFS-backed artifact storage can only be used together with the RestStore. In the special case where the URI i...
Returns an ArtifactRepository subclass for storing artifacts on DBFS. This factory method is used with URIs of the form ``dbfs:/<path>``. DBFS-backed artifact storage can only be used together with the RestStore. In the special case where the URI is of the form `dbfs:/databricks/mlflow-tracking/<...
dbfs_artifact_repo_factory
python
mlflow/mlflow
mlflow/store/artifact/dbfs_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/dbfs_artifact_repo.py
Apache-2.0
def parse_gcs_uri(uri): """Parse an GCS URI, returning (bucket, path)""" parsed = urllib.parse.urlparse(uri) if parsed.scheme != "gs": raise Exception(f"Not a GCS URI: {uri}") path = parsed.path if path.startswith("/"): path = path[1:] return parse...
Parse an GCS URI, returning (bucket, path)
parse_gcs_uri
python
mlflow/mlflow
mlflow/store/artifact/gcs_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/gcs_artifact_repo.py
Apache-2.0
def _gcs_mpu_arguments(filename: str, blob) -> GCSMPUArguments: """See :py:func:`google.cloud.storage.transfer_manager.upload_chunks_concurrently`""" from google.cloud.storage.transfer_manager import _headers_from_metadata bucket = blob.bucket client = blob.client transport = bl...
See :py:func:`google.cloud.storage.transfer_manager.upload_chunks_concurrently`
_gcs_mpu_arguments
python
mlflow/mlflow
mlflow/store/artifact/gcs_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/gcs_artifact_repo.py
Apache-2.0
def log_artifact(self, local_file, artifact_path=None): """ Log artifact in hdfs. Args: local_file: Source file path. artifact_path: When specified will attempt to write under artifact_uri/artifact_path. """ hdfs_base_path = _resolve_base_path(self.path, ...
Log artifact in hdfs. Args: local_file: Source file path. artifact_path: When specified will attempt to write under artifact_uri/artifact_path.
log_artifact
python
mlflow/mlflow
mlflow/store/artifact/hdfs_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/hdfs_artifact_repo.py
Apache-2.0
def log_artifacts(self, local_dir, artifact_path=None): """ Log artifacts in hdfs. Missing remote sub-directories will be created if needed. Args: local_dir: Source dir path. artifact_path: When specified will attempt to write under artifact_uri/artifact_path. ...
Log artifacts in hdfs. Missing remote sub-directories will be created if needed. Args: local_dir: Source dir path. artifact_path: When specified will attempt to write under artifact_uri/artifact_path.
log_artifacts
python
mlflow/mlflow
mlflow/store/artifact/hdfs_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/hdfs_artifact_repo.py
Apache-2.0
def list_artifacts(self, path=None): """ Lists files and directories under artifacts directory for the current run_id. (self.path contains the base path - hdfs:/some/path/run_id/artifacts) Args: path: Relative source path. Possible subdirectory existing under ...
Lists files and directories under artifacts directory for the current run_id. (self.path contains the base path - hdfs:/some/path/run_id/artifacts) Args: path: Relative source path. Possible subdirectory existing under hdfs:/some/path/run_id/artifacts Retur...
list_artifacts
python
mlflow/mlflow
mlflow/store/artifact/hdfs_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/hdfs_artifact_repo.py
Apache-2.0
def hdfs_system(scheme, host, port): """ hdfs system context - Attempt to establish the connection to hdfs and yields HadoopFileSystem Args: scheme: scheme or use hdfs:// as default host: hostname or when relaying on the core-site.xml config use 'default' port: port or when rela...
hdfs system context - Attempt to establish the connection to hdfs and yields HadoopFileSystem Args: scheme: scheme or use hdfs:// as default host: hostname or when relaying on the core-site.xml config use 'default' port: port or when relaying on the core-site.xml config use 0
hdfs_system
python
mlflow/mlflow
mlflow/store/artifact/hdfs_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/hdfs_artifact_repo.py
Apache-2.0
def _try_multipart_upload(self, local_file, artifact_path=None): """ Attempts to perform multipart upload to log an artifact. Returns if the multipart upload is successful. Raises UnsupportedMultipartUploadException if multipart upload is unsupported. """ chunk_size = MLF...
Attempts to perform multipart upload to log an artifact. Returns if the multipart upload is successful. Raises UnsupportedMultipartUploadException if multipart upload is unsupported.
_try_multipart_upload
python
mlflow/mlflow
mlflow/store/artifact/http_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/http_artifact_repo.py
Apache-2.0
def download_artifacts(self, artifact_path, dst_path=None): """ Artifacts tracked by ``LocalArtifactRepository`` already exist on the local filesystem. If ``dst_path`` is ``None``, the absolute filesystem path of the specified artifact is returned. If ``dst_path`` is not ``None``, the lo...
Artifacts tracked by ``LocalArtifactRepository`` already exist on the local filesystem. If ``dst_path`` is ``None``, the absolute filesystem path of the specified artifact is returned. If ``dst_path`` is not ``None``, the local artifact is copied to ``dst_path``. Args: arti...
download_artifacts
python
mlflow/mlflow
mlflow/store/artifact/local_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/local_artifact_repo.py
Apache-2.0
def split_models_uri(uri): """ Split 'models:/<name>/<version>/path/to/model' into ('models:/<name>/<version>', 'path/to/model'). Split 'models://<scope>:<prefix>@databricks/<name>/<version>/path/to/model' into ('models://<scope>:<prefix>@databricks/<name>/<version>', 'path/to/mo...
Split 'models:/<name>/<version>/path/to/model' into ('models:/<name>/<version>', 'path/to/model'). Split 'models://<scope>:<prefix>@databricks/<name>/<version>/path/to/model' into ('models://<scope>:<prefix>@databricks/<name>/<version>', 'path/to/model'). Split 'models:/<name>@a...
split_models_uri
python
mlflow/mlflow
mlflow/store/artifact/models_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/models_artifact_repo.py
Apache-2.0
def _is_logged_model_uri(uri: Union[str, Path]) -> bool: """ Returns True if the URI is a logged model URI (e.g. 'models:/<model_id>'), False otherwise. """ uri = str(uri) return is_models_uri(uri) and _parse_model_uri(uri).model_id is not None
Returns True if the URI is a logged model URI (e.g. 'models:/<model_id>'), False otherwise.
_is_logged_model_uri
python
mlflow/mlflow
mlflow/store/artifact/models_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/models_artifact_repo.py
Apache-2.0
def download_artifacts(self, artifact_path, dst_path=None, lineage_header_info=None): """ Download an artifact file or directory to a local directory if applicable, and return a local path for it. For registered models, when the artifact is downloaded, the model name and version ...
Download an artifact file or directory to a local directory if applicable, and return a local path for it. For registered models, when the artifact is downloaded, the model name and version are saved in the "registered_model_meta" file on the caller's side. The caller is respons...
download_artifacts
python
mlflow/mlflow
mlflow/store/artifact/models_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/models_artifact_repo.py
Apache-2.0
def parse_s3_compliant_uri(self, uri): """Parse an S3 URI, returning (bucket, path)""" parsed = urllib.parse.urlparse(uri) if parsed.scheme != "s3": raise Exception(f"Not an S3 URI: {uri}") path = parsed.path if path.startswith("/"): path = path[1:] ...
Parse an S3 URI, returning (bucket, path)
parse_s3_compliant_uri
python
mlflow/mlflow
mlflow/store/artifact/optimized_s3_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/optimized_s3_artifact_repo.py
Apache-2.0
def _get_logged_model_artifact_repo( self, run_id: str, name: str ) -> Optional[ArtifactRepository]: """ Get the artifact repository for a logged model with the given name and run ID. Returns None if no such model exists. """ from mlflow.store.artifact.artifact_reposi...
Get the artifact repository for a logged model with the given name and run ID. Returns None if no such model exists.
_get_logged_model_artifact_repo
python
mlflow/mlflow
mlflow/store/artifact/runs_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/runs_artifact_repo.py
Apache-2.0
def _list_model_artifacts(self, path: Optional[str] = None) -> list[FileInfo]: """ A run can have an associated model. If so, this method lists the artifacts of the model. """ full_path = f"{self.artifact_uri}/{path}" if path else self.artifact_uri run_id, rel_path = RunsArtifact...
A run can have an associated model. If so, this method lists the artifacts of the model.
_list_model_artifacts
python
mlflow/mlflow
mlflow/store/artifact/runs_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/runs_artifact_repo.py
Apache-2.0
def download_artifacts(self, artifact_path: str, dst_path: Optional[str] = None) -> str: """ Download an artifact file or directory to a local directory if applicable, and return a local path for it. When the run has an associated model, the artifacts of the model are also downloaded to ...
Download an artifact file or directory to a local directory if applicable, and return a local path for it. When the run has an associated model, the artifacts of the model are also downloaded to the specified destination directory. The caller is responsible for managing the lifecycle of...
download_artifacts
python
mlflow/mlflow
mlflow/store/artifact/runs_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/runs_artifact_repo.py
Apache-2.0
def _download_model_artifacts(self, artifact_path: str, dst_path: str) -> Optional[str]: """ A run can have an associated model. If so, this method downloads the artifacts of the model. """ full_path = f"{self.artifact_uri}/{artifact_path}" if artifact_path else self.artifact_uri ...
A run can have an associated model. If so, this method downloads the artifacts of the model.
_download_model_artifacts
python
mlflow/mlflow
mlflow/store/artifact/runs_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/runs_artifact_repo.py
Apache-2.0
def _cached_get_s3_client( signature_version, addressing_style, s3_endpoint_url, verify, timestamp, access_key_id=None, secret_access_key=None, session_token=None, region_name=None, ): """Returns a boto3 client, caching to avoid extra boto3 verify calls. This method is outsi...
Returns a boto3 client, caching to avoid extra boto3 verify calls. This method is outside of the S3ArtifactRepository as it is agnostic and could be used by other instances. `maxsize` set to avoid excessive memory consumption in the case a user has dynamic endpoints (intentionally or as a bug). S...
_cached_get_s3_client
python
mlflow/mlflow
mlflow/store/artifact/s3_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/s3_artifact_repo.py
Apache-2.0
def uc_volume_artifact_repo_factory(artifact_uri): """ Returns an ArtifactRepository subclass for storing artifacts on Volumes. This factory method is used with URIs of the form ``dbfs:/Volumes/<path>``. Volume-backed artifact storage can only be used together with the RestStore. Args: art...
Returns an ArtifactRepository subclass for storing artifacts on Volumes. This factory method is used with URIs of the form ``dbfs:/Volumes/<path>``. Volume-backed artifact storage can only be used together with the RestStore. Args: artifact_uri: Volume root artifact URI. Returns: ...
uc_volume_artifact_repo_factory
python
mlflow/mlflow
mlflow/store/artifact/uc_volume_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/uc_volume_artifact_repo.py
Apache-2.0
def _get_artifact_repo(self, lineage_header_info=None): """ Get underlying ArtifactRepository instance for model version blob storage """ host_creds = get_databricks_host_creds(self.registry_uri) if is_databricks_sdk_models_artifact_repository_enabled(host_creds): ...
Get underlying ArtifactRepository instance for model version blob storage
_get_artifact_repo
python
mlflow/mlflow
mlflow/store/artifact/unity_catalog_models_artifact_repo.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/unity_catalog_models_artifact_repo.py
Apache-2.0
def _get_latest_model_version(client, name, stage): """ Returns the latest version of the stage if stage is not None. Otherwise return the latest of all versions. """ latest = client.get_latest_versions(name, None if stage is None else [stage]) if len(latest) == 0: stage_str = "" if stag...
Returns the latest version of the stage if stage is not None. Otherwise return the latest of all versions.
_get_latest_model_version
python
mlflow/mlflow
mlflow/store/artifact/utils/models.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/utils/models.py
Apache-2.0
def _parse_model_uri(uri) -> ParsedModelUri: """ Returns a ParsedModelUri tuple. Since a models:/ URI can only have one of {version, stage, 'latest', alias}, it will return - (id, None, None, None) to look for a specific model by ID, - (name, version, None, None) to look for a specific versi...
Returns a ParsedModelUri tuple. Since a models:/ URI can only have one of {version, stage, 'latest', alias}, it will return - (id, None, None, None) to look for a specific model by ID, - (name, version, None, None) to look for a specific version, - (name, None, stage, None) to look for ...
_parse_model_uri
python
mlflow/mlflow
mlflow/store/artifact/utils/models.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/utils/models.py
Apache-2.0
def _parse_model_id_if_present(possible_model_uri: Union[str, Path]) -> Optional[str]: """ Parses the model ID from the given string. If the string represents a UC model URI, we get the model version to extract the model ID. If the string is not a models:/ URI, returns None. Args: possible_mode...
Parses the model ID from the given string. If the string represents a UC model URI, we get the model version to extract the model ID. If the string is not a models:/ URI, returns None. Args: possible_model_uri: The string that may be a models:/ URI. Returns: The model ID if the string...
_parse_model_id_if_present
python
mlflow/mlflow
mlflow/store/artifact/utils/models.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/artifact/utils/models.py
Apache-2.0
def _get_package_dir(): """Returns directory containing MLflow python package.""" current_dir = os.path.dirname(os.path.abspath(__file__)) return os.path.normpath(os.path.join(current_dir, os.pardir, os.pardir))
Returns directory containing MLflow python package.
_get_package_dir
python
mlflow/mlflow
mlflow/store/db/utils.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/db/utils.py
Apache-2.0
def _get_latest_schema_revision(): """Get latest schema revision as a string.""" # We aren't executing any commands against a DB, so we leave the DB URL unspecified config = _get_alembic_config(db_url="") script = ScriptDirectory.from_config(config) heads = script.get_heads() if len(heads) != 1:...
Get latest schema revision as a string.
_get_latest_schema_revision
python
mlflow/mlflow
mlflow/store/db/utils.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/db/utils.py
Apache-2.0
def _get_alembic_config(db_url, alembic_dir=None): """ Constructs an alembic Config object referencing the specified database and migration script directory. Args: db_url: Database URL, like sqlite:///<absolute-path-to-local-db-file>. See https://docs.sqlalchemy.org/en/13/core/engin...
Constructs an alembic Config object referencing the specified database and migration script directory. Args: db_url: Database URL, like sqlite:///<absolute-path-to-local-db-file>. See https://docs.sqlalchemy.org/en/13/core/engines.html#database-urls for a full list of valid...
_get_alembic_config
python
mlflow/mlflow
mlflow/store/db/utils.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/db/utils.py
Apache-2.0
def _upgrade_db(engine): # noqa: D417 """ Upgrade the schema of an MLflow tracking database to the latest supported version. Note that schema migrations can be slow and are not guaranteed to be transactional - we recommend taking a backup of your database before running migrations. Args: u...
Upgrade the schema of an MLflow tracking database to the latest supported version. Note that schema migrations can be slow and are not guaranteed to be transactional - we recommend taking a backup of your database before running migrations. Args: url: Database URL, like sqlite:///<absolute-pat...
_upgrade_db
python
mlflow/mlflow
mlflow/store/db/utils.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/db/utils.py
Apache-2.0
def upgrade(): """ Enlarge the maximum param value length to 500. """ with op.batch_alter_table("params") as batch_op: batch_op.alter_column( "value", existing_type=sa.String(250), type_=sa.String(500), existing_nullable=False, nullable...
Enlarge the maximum param value length to 500.
upgrade
python
mlflow/mlflow
mlflow/store/db_migrations/versions/cc1f77228345_change_param_value_length_to_500.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/db_migrations/versions/cc1f77228345_change_param_value_length_to_500.py
Apache-2.0
def __init__(self, store_uri=None, tracking_uri=None): """ Empty constructor. This is deliberately not marked as abstract, else every derived class would be forced to create one. Args: store_uri: The model registry store URI. tracking_uri: URI of the current MLfl...
Empty constructor. This is deliberately not marked as abstract, else every derived class would be forced to create one. Args: store_uri: The model registry store URI. tracking_uri: URI of the current MLflow tracking server, used to perform operations lik...
__init__
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def __getstate__(self): """Support for pickle serialization by excluding the non-picklable RLock.""" state = self.__dict__.copy() # Remove the RLock as it cannot be pickled del state["_prompt_link_lock"] return state
Support for pickle serialization by excluding the non-picklable RLock.
__getstate__
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def __setstate__(self, state): """Support for pickle deserialization by recreating the RLock.""" self.__dict__.update(state) # Recreate the RLock self._prompt_link_lock = threading.RLock()
Support for pickle deserialization by recreating the RLock.
__setstate__
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def create_registered_model(self, name, tags=None, description=None, deployment_job_id=None): """ Create a new registered model in backend store. Args: name: Name of the new model. This is expected to be unique in the backend store. tags: A list of :py:class:`mlflow.enti...
Create a new registered model in backend store. Args: name: Name of the new model. This is expected to be unique in the backend store. tags: A list of :py:class:`mlflow.entities.model_registry.RegisteredModelTag` instances associated with this registered model. ...
create_registered_model
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def update_registered_model(self, name, description, deployment_job_id=None): """ Update description of the registered model. Args: name: Registered model name. description: New description. deployment_job_id: Optional deployment job ID. Returns: ...
Update description of the registered model. Args: name: Registered model name. description: New description. deployment_job_id: Optional deployment job ID. Returns: A single updated :py:class:`mlflow.entities.model_registry.RegisteredModel` obje...
update_registered_model
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def rename_registered_model(self, name, new_name): """ Rename the registered model. Args: name: Registered model name. new_name: New proposed name. Returns: A single updated :py:class:`mlflow.entities.model_registry.RegisteredModel` object. "...
Rename the registered model. Args: name: Registered model name. new_name: New proposed name. Returns: A single updated :py:class:`mlflow.entities.model_registry.RegisteredModel` object.
rename_registered_model
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def delete_registered_model(self, name): """ Delete the registered model. Backend raises exception if a registered model with given name does not exist. Args: name: Registered model name. Returns: None """
Delete the registered model. Backend raises exception if a registered model with given name does not exist. Args: name: Registered model name. Returns: None
delete_registered_model
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def search_registered_models( self, filter_string=None, max_results=None, order_by=None, page_token=None ): """ Search for registered models in backend that satisfy the filter criteria. Args: filter_string: Filter query string, defaults to searching all registered models...
Search for registered models in backend that satisfy the filter criteria. Args: filter_string: Filter query string, defaults to searching all registered models. max_results: Maximum number of registered models desired. order_by: List of column names with ASC|DESC an...
search_registered_models
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def get_registered_model(self, name): """ Get registered model instance by name. Args: name: Registered model name. Returns: A single :py:class:`mlflow.entities.model_registry.RegisteredModel` object. """
Get registered model instance by name. Args: name: Registered model name. Returns: A single :py:class:`mlflow.entities.model_registry.RegisteredModel` object.
get_registered_model
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def get_latest_versions(self, name, stages=None): """ Latest version models for each requested stage. If no ``stages`` argument is provided, returns the latest version for each stage. Args: name: Registered model name. stages: List of desired stages. If input lis...
Latest version models for each requested stage. If no ``stages`` argument is provided, returns the latest version for each stage. Args: name: Registered model name. stages: List of desired stages. If input list is None, return latest versions for each st...
get_latest_versions
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def set_registered_model_tag(self, name, tag): """ Set a tag for the registered model. Args: name: Registered model name. tag: :py:class:`mlflow.entities.model_registry.RegisteredModelTag` instance to log. Returns: None """
Set a tag for the registered model. Args: name: Registered model name. tag: :py:class:`mlflow.entities.model_registry.RegisteredModelTag` instance to log. Returns: None
set_registered_model_tag
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def delete_registered_model_tag(self, name, key): """ Delete a tag associated with the registered model. Args: name: Registered model name. key: Registered model tag key. Returns: None """
Delete a tag associated with the registered model. Args: name: Registered model name. key: Registered model tag key. Returns: None
delete_registered_model_tag
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def create_model_version( self, name, source, run_id=None, tags=None, run_link=None, description=None, local_model_path=None, model_id: Optional[str] = None, ): """ Create a new model version from given source and run ID. ...
Create a new model version from given source and run ID. Args: name: Registered model name. source: URI indicating the location of the model artifacts. run_id: Run ID from MLflow tracking server that generated the model. tags: A list of :py:class:`mlflow...
create_model_version
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def update_model_version(self, name, version, description): """ Update metadata associated with a model version in backend. Args: name: Registered model name. version: Registered model version. description: New model description. Returns: ...
Update metadata associated with a model version in backend. Args: name: Registered model name. version: Registered model version. description: New model description. Returns: A single :py:class:`mlflow.entities.model_registry.ModelVersion` objec...
update_model_version
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def transition_model_version_stage(self, name, version, stage, archive_existing_versions): """ Update model version stage. Args: name: Registered model name. version: Registered model version. stage: New desired stage for this model version. archi...
Update model version stage. Args: name: Registered model name. version: Registered model version. stage: New desired stage for this model version. archive_existing_versions: If this flag is set to ``True``, all existing model versions in ...
transition_model_version_stage
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def delete_model_version(self, name, version): """ Delete model model version in backend. Args: name: Registered model name. version: Registered model version. Returns: None """
Delete model model version in backend. Args: name: Registered model name. version: Registered model version. Returns: None
delete_model_version
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def get_model_version(self, name, version): """ Get the model version instance by name and version. Args: name: Registered model name. version: Registered model version. Returns: A single :py:class:`mlflow.entities.model_registry.ModelVersion` object...
Get the model version instance by name and version. Args: name: Registered model name. version: Registered model version. Returns: A single :py:class:`mlflow.entities.model_registry.ModelVersion` object.
get_model_version
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def get_model_version_download_uri(self, name, version): """ Get the download location in Model Registry for this model version. NOTE: For first version of Model Registry, since the models are not copied over to another location, download URI points to input source path. A...
Get the download location in Model Registry for this model version. NOTE: For first version of Model Registry, since the models are not copied over to another location, download URI points to input source path. Args: name: Registered model name. version: R...
get_model_version_download_uri
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def search_model_versions( self, filter_string=None, max_results=None, order_by=None, page_token=None ): """ Search for model versions in backend that satisfy the filter criteria. Args: filter_string: A filter string expression. Currently supports a single filter ...
Search for model versions in backend that satisfy the filter criteria. Args: filter_string: A filter string expression. Currently supports a single filter condition either name of model like ``name = 'model_name'`` or ``run_id = '...'``. max_resu...
search_model_versions
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def set_model_version_tag(self, name, version, tag): """ Set a tag for the model version. Args: name: Registered model name. version: Registered model version. tag: :py:class:`mlflow.entities.model_registry.ModelVersionTag` instance to log. Returns: ...
Set a tag for the model version. Args: name: Registered model name. version: Registered model version. tag: :py:class:`mlflow.entities.model_registry.ModelVersionTag` instance to log. Returns: None
set_model_version_tag
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def delete_model_version_tag(self, name, version, key): """ Delete a tag associated with the model version. Args: name: Registered model name. version: Registered model version. key: Tag key. Returns: None """
Delete a tag associated with the model version. Args: name: Registered model name. version: Registered model version. key: Tag key. Returns: None
delete_model_version_tag
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def set_registered_model_alias(self, name, alias, version): """ Set a registered model alias pointing to a model version. Args: name: Registered model name. alias: Name of the alias. version: Registered model version number. Returns: None...
Set a registered model alias pointing to a model version. Args: name: Registered model name. alias: Name of the alias. version: Registered model version number. Returns: None
set_registered_model_alias
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def delete_registered_model_alias(self, name, alias): """ Delete an alias associated with a registered model. Args: name: Registered model name. alias: Name of the alias. Returns: None """
Delete an alias associated with a registered model. Args: name: Registered model name. alias: Name of the alias. Returns: None
delete_registered_model_alias
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def get_model_version_by_alias(self, name, alias): """ Get the model version instance by name and alias. Args: name: Registered model name. alias: Name of the alias. Returns: A single :py:class:`mlflow.entities.model_registry.ModelVersion` object. ...
Get the model version instance by name and alias. Args: name: Registered model name. alias: Name of the alias. Returns: A single :py:class:`mlflow.entities.model_registry.ModelVersion` object.
get_model_version_by_alias
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def copy_model_version(self, src_mv, dst_name): """ Copy a model version from one registered model to another as a new model version. Args: src_mv: A :py:class:`mlflow.entities.model_registry.ModelVersion` object representing the source model version. dst...
Copy a model version from one registered model to another as a new model version. Args: src_mv: A :py:class:`mlflow.entities.model_registry.ModelVersion` object representing the source model version. dst_name: The name of the registered model to copy the model v...
copy_model_version
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def create_prompt( self, name: str, description: Optional[str] = None, tags: Optional[dict[str, str]] = None, ) -> Prompt: """ Create a new prompt in the registry. Default implementation: creates a RegisteredModel with special prompt tags. Other store...
Create a new prompt in the registry. Default implementation: creates a RegisteredModel with special prompt tags. Other store implementations may override this method. Args: name: Name of the prompt. description: Optional description of the prompt. t...
create_prompt
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def search_prompts( self, filter_string: Optional[str] = None, max_results: Optional[int] = None, order_by: Optional[list[str]] = None, page_token: Optional[str] = None, ) -> PagedList[Prompt]: """ Search for prompts in the registry. Default implement...
Search for prompts in the registry. Default implementation: searches RegisteredModels with prompt tags. Other store implementations may override this method. Args: filter_string: Filter query string, defaults to searching for all prompts. max_results: Maximum n...
search_prompts
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def set_prompt_tag(self, name: str, key: str, value: str) -> None: """ Set a tag on a prompt. Default implementation: sets a tag on the underlying RegisteredModel. Other store implementations may override this method. Args: name: Name of the prompt. key:...
Set a tag on a prompt. Default implementation: sets a tag on the underlying RegisteredModel. Other store implementations may override this method. Args: name: Name of the prompt. key: Tag key. value: Tag value.
set_prompt_tag
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def delete_prompt_tag(self, name: str, key: str) -> None: """ Delete a tag from a prompt. Default implementation: deletes a tag from the underlying RegisteredModel. Other store implementations may override this method. Args: name: Name of the prompt. key...
Delete a tag from a prompt. Default implementation: deletes a tag from the underlying RegisteredModel. Other store implementations may override this method. Args: name: Name of the prompt. key: Tag key to delete.
delete_prompt_tag
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def get_prompt(self, name: str) -> Optional[Prompt]: """ Get prompt metadata by name. Default implementation: gets RegisteredModel with prompt tags and converts to Prompt. Other store implementations may override this method. Args: name: Registered prompt name. ...
Get prompt metadata by name. Default implementation: gets RegisteredModel with prompt tags and converts to Prompt. Other store implementations may override this method. Args: name: Registered prompt name. Returns: A single Prompt object with prompt met...
get_prompt
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def create_prompt_version( self, name: str, template: str, description: Optional[str] = None, tags: Optional[dict[str, str]] = None, ) -> PromptVersion: """ Create a new version of an existing prompt. Default implementation: creates a ModelVersion wit...
Create a new version of an existing prompt. Default implementation: creates a ModelVersion with prompt tags. Other store implementations may override this method. Args: name: Name of the prompt. template: The prompt template text. description: Optio...
create_prompt_version
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def get_prompt_version(self, name: str, version: Union[str, int]) -> Optional[PromptVersion]: """ Get a specific prompt version. Default implementation: gets ModelVersion and converts to PromptVersion. Other store implementations may override this method. Args: name...
Get a specific prompt version. Default implementation: gets ModelVersion and converts to PromptVersion. Other store implementations may override this method. Args: name: Name of the prompt. version: Version number or alias. Returns: A Promp...
get_prompt_version
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def delete_prompt_version(self, name: str, version: Union[str, int]) -> None: """ Delete a specific prompt version. Default implementation: deletes the underlying ModelVersion. Other store implementations may override this method. Args: name: Name of the prompt. ...
Delete a specific prompt version. Default implementation: deletes the underlying ModelVersion. Other store implementations may override this method. Args: name: Name of the prompt. version: Version number to delete.
delete_prompt_version
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def search_prompt_versions( self, name: str, max_results: Optional[int] = None, page_token: Optional[str] = None ): """ Search prompt versions for a given prompt name. This method is only supported in Unity Catalog registries. For OSS registries, this functionality is not av...
Search prompt versions for a given prompt name. This method is only supported in Unity Catalog registries. For OSS registries, this functionality is not available. Args: name: Name of the prompt to search versions for max_results: Maximum number of versions to ...
search_prompt_versions
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0