Package org.mlflow.tracking
Class MlflowClient
- java.lang.Object
- 
- org.mlflow.tracking.MlflowClient
 
- 
- All Implemented Interfaces:
- java.io.Closeable,- java.io.Serializable,- java.lang.AutoCloseable
 
 public class MlflowClient extends java.lang.Object implements java.io.Serializable, java.io.CloseableClient to an MLflow Tracking Sever.- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected static java.lang.StringDEFAULT_EXPERIMENT_ID
 - 
Constructor SummaryConstructors Constructor Description MlflowClient()Return a default client based on the MLFLOW_TRACKING_URI environment variable.MlflowClient(java.lang.String trackingUri)Instantiate a new client using the provided tracking uri.MlflowClient(MlflowHostCredsProvider hostCredsProvider)Create a new MlflowClient; users should prefer constructing ApiClients viaMlflowClient()orMlflowClient(String)if possible.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Closes the MlflowClient and releases any associated resources.java.lang.StringcreateExperiment(java.lang.String experimentName)Create a new experiment using the default artifact location provided by the server.java.lang.StringcreateExperiment(Service.CreateExperiment request)Create a new experiment.Service.RunInfocreateRun()Create a new run under the default experiment with no application name.Service.RunInfocreateRun(java.lang.String experimentId)Create a new run under the given experiment.Service.RunInfocreateRun(Service.CreateRun request)Create a new run.voiddeleteExperiment(java.lang.String experimentId)Mark an experiment and associated runs, params, metrics, etc.voiddeleteRun(java.lang.String runId)Delete a run with the given ID.voiddeleteTag(java.lang.String runId, java.lang.String key)Delete a tag on the run ID with a specific key.java.io.FiledownloadArtifacts(java.lang.String runId)Return a local directory containing *all* artifacts within the run's artifact directory.java.io.FiledownloadArtifacts(java.lang.String runId, java.lang.String artifactPath)Return a local file or directory containing all artifacts within the given artifactPath within the run's root artifactDirectory.java.io.FiledownloadLatestModelVersion(java.lang.String modelName, java.lang.String stage)Returns a directory containing all artifacts within the latest registered model version in the given stage.java.io.FiledownloadModelVersion(java.lang.String modelName, java.lang.String version)Returns a directory containing all artifacts within the given registered model version.Service.ExperimentgetExperiment(java.lang.String experimentId)java.util.Optional<Service.Experiment>getExperimentByName(java.lang.String experimentName)java.util.List<ModelRegistry.ModelVersion>getLatestVersions(java.lang.String modelName)Return the latest model version for each stage.java.util.List<ModelRegistry.ModelVersion>getLatestVersions(java.lang.String modelName, java.lang.Iterable<java.lang.String> stages)Return the latest model version for each stage requested.java.util.List<Service.Metric>getMetricHistory(java.lang.String runId, java.lang.String key)ModelRegistry.ModelVersiongetModelVersion(java.lang.String modelName, java.lang.String version)import org.mlflow.api.proto.ModelRegistry.ModelVersion; ModelVersion modelVersion = getModelVersion("model", "version");java.lang.StringgetModelVersionDownloadUri(java.lang.String modelName, java.lang.String version)Return the model URI containing for the given model version.ModelRegistry.RegisteredModelgetRegisteredModel(java.lang.String modelName)Returns a RegisteredModel from the model registry for the given model name.Service.RungetRun(java.lang.String runId)Get metadata, params, tags, and metrics for a run.java.util.List<Service.FileInfo>listArtifacts(java.lang.String runId)List the artifacts immediately under the run's root artifact directory.java.util.List<Service.FileInfo>listArtifacts(java.lang.String runId, java.lang.String artifactPath)List the artifacts immediately under the given artifactPath within the run's root artifact directory.java.util.List<Service.RunInfo>listRunInfos(java.lang.String experimentId)voidlogArtifact(java.lang.String runId, java.io.File localFile)Upload the given local file or directory to the run's root artifact directory.voidlogArtifact(java.lang.String runId, java.io.File localFile, java.lang.String artifactPath)Upload the given local file or directory to an artifactPath within the run's root directory.voidlogArtifacts(java.lang.String runId, java.io.File localDir)Upload all files within the given local directory the run's root artifact directory.voidlogArtifacts(java.lang.String runId, java.io.File localDir, java.lang.String artifactPath)Upload all files within the given local director an artifactPath within the run's root artifact directory.voidlogBatch(java.lang.String runId, java.lang.Iterable<Service.Metric> metrics, java.lang.Iterable<Service.Param> params, java.lang.Iterable<Service.RunTag> tags)Log multiple metrics, params, and/or tags against a given run (argument runId).voidlogMetric(java.lang.String runId, java.lang.String key, double value)Log a new metric against the given run, as a key-value pair.voidlogMetric(java.lang.String runId, java.lang.String key, double value, long timestamp, long step)Log a new metric against the given run, as a key-value pair.voidlogParam(java.lang.String runId, java.lang.String key, java.lang.String value)Log a parameter against the given run, as a key-value pair.voidrenameExperiment(java.lang.String experimentId, java.lang.String newName)Update an experiment's name.voidrestoreExperiment(java.lang.String experimentId)Restore an experiment marked for deletion.voidrestoreRun(java.lang.String runId)Restore a deleted run with the given ID.ExperimentsPagesearchExperiments()Return up to 1000 active experiments.ExperimentsPagesearchExperiments(java.lang.String searchFilter)Return up to the first 1000 active experiments that satisfy the search query.ExperimentsPagesearchExperiments(java.lang.String searchFilter, Service.ViewType experimentViewType, int maxResults, java.util.List<java.lang.String> orderBy)Return experiments that satisfy the search query.ExperimentsPagesearchExperiments(java.lang.String searchFilter, Service.ViewType experimentViewType, int maxResults, java.util.List<java.lang.String> orderBy, java.lang.String pageToken)Return experiments that satisfy the search query.ModelVersionsPagesearchModelVersions()Return up to 1000 model versions.ModelVersionsPagesearchModelVersions(java.lang.String searchFilter)Return up to 1000 model versions that satisfy the search query.ModelVersionsPagesearchModelVersions(java.lang.String searchFilter, int maxResults, java.util.List<java.lang.String> orderBy)Return model versions that satisfy the search query.ModelVersionsPagesearchModelVersions(java.lang.String searchFilter, int maxResults, java.util.List<java.lang.String> orderBy, java.lang.String pageToken)Return model versions that satisfy the search query.java.util.List<Service.RunInfo>searchRuns(java.util.List<java.lang.String> experimentIds, java.lang.String searchFilter)Deprecated.As of 1.1.0 - please usesearchRuns(List, String, ViewType, int)or similar that returns a page of Run results.java.util.List<Service.RunInfo>searchRuns(java.util.List<java.lang.String> experimentIds, java.lang.String searchFilter, Service.ViewType runViewType)Deprecated.As of 1.1.0 - please usesearchRuns(List, String, ViewType, int)or similar that returns a page of Run results.RunsPagesearchRuns(java.util.List<java.lang.String> experimentIds, java.lang.String searchFilter, Service.ViewType runViewType, int maxResults)Return runs from provided list of experiments that satisfy the search query.RunsPagesearchRuns(java.util.List<java.lang.String> experimentIds, java.lang.String searchFilter, Service.ViewType runViewType, int maxResults, java.util.List<java.lang.String> orderBy)Return runs from provided list of experiments that satisfy the search query.RunsPagesearchRuns(java.util.List<java.lang.String> experimentIds, java.lang.String searchFilter, Service.ViewType runViewType, int maxResults, java.util.List<java.lang.String> orderBy, java.lang.String pageToken)Return runs from provided list of experiments that satisfy the search query.java.lang.StringsendGet(java.lang.String path)Send a GET to the following path, including query parameters.java.lang.StringsendPatch(java.lang.String path, java.lang.String json)java.lang.StringsendPost(java.lang.String path, java.lang.String json)Send a POST to the following path, with a String-encoded JSON body.voidsetExperimentTag(java.lang.String experimentId, java.lang.String key, java.lang.String value)Log a new tag against the given experiment as a key-value pair.voidsetTag(java.lang.String runId, java.lang.String key, java.lang.String value)Log a new tag against the given run, as a key-value pair.voidsetTerminated(java.lang.String runId)Set the status of a run to be FINISHED at the current time.voidsetTerminated(java.lang.String runId, Service.RunStatus status)Set the status of a run to be completed at the current time.voidsetTerminated(java.lang.String runId, Service.RunStatus status, long endTime)Set the status of a run to be completed at the given endTime.
 
- 
- 
- 
Field Detail- 
DEFAULT_EXPERIMENT_IDprotected static final java.lang.String DEFAULT_EXPERIMENT_ID - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
MlflowClientpublic MlflowClient() Return a default client based on the MLFLOW_TRACKING_URI environment variable.
 - 
MlflowClientpublic MlflowClient(java.lang.String trackingUri) Instantiate a new client using the provided tracking uri.
 - 
MlflowClientpublic MlflowClient(MlflowHostCredsProvider hostCredsProvider) Create a new MlflowClient; users should prefer constructing ApiClients viaMlflowClient()orMlflowClient(String)if possible.
 
- 
 - 
Method Detail- 
getRunpublic Service.Run getRun(java.lang.String runId) Get metadata, params, tags, and metrics for a run. A single value is returned for each metric key: the most recently logged metric value at the largest step.- Returns:
- Run associated with the ID.
 
 - 
getMetricHistorypublic java.util.List<Service.Metric> getMetricHistory(java.lang.String runId, java.lang.String key) 
 - 
createRunpublic Service.RunInfo createRun() Create a new run under the default experiment with no application name.- Returns:
- RunInfo created by the server.
 
 - 
createRunpublic Service.RunInfo createRun(java.lang.String experimentId) Create a new run under the given experiment.- Returns:
- RunInfo created by the server.
 
 - 
createRunpublic Service.RunInfo createRun(Service.CreateRun request) Create a new run. This method allows providing all possible fields of CreateRun, and can be invoked as follows:import org.mlflow.api.proto.Service.CreateRun; CreateRun.Builder request = CreateRun.newBuilder(); request.setExperimentId(experimentId); request.setSourceVersion("my-version"); createRun(request.build());- Returns:
- RunInfo created by the server.
 
 - 
listRunInfospublic java.util.List<Service.RunInfo> listRunInfos(java.lang.String experimentId) - Returns:
- A list of all RunInfos associated with the given experiment.
 
 - 
searchRunspublic java.util.List<Service.RunInfo> searchRuns(java.util.List<java.lang.String> experimentIds, java.lang.String searchFilter) Deprecated.As of 1.1.0 - please usesearchRuns(List, String, ViewType, int)or similar that returns a page of Run results.Return RunInfos from provided list of experiments that satisfy the search query.- Parameters:
- experimentIds- List of experiment IDs.
- searchFilter- SQL compatible search query string. Format of this query string is similar to that specified on MLflow UI. Example : "params.model = 'LogisticRegression' and metrics.acc = 0.9" If null, the result will be equivalent to having an empty search filter.
- Returns:
- A list of all RunInfos that satisfy search filter.
 
 - 
searchRunspublic java.util.List<Service.RunInfo> searchRuns(java.util.List<java.lang.String> experimentIds, java.lang.String searchFilter, Service.ViewType runViewType) Deprecated.As of 1.1.0 - please usesearchRuns(List, String, ViewType, int)or similar that returns a page of Run results.Return RunInfos from provided list of experiments that satisfy the search query.- Parameters:
- experimentIds- List of experiment IDs.
- searchFilter- SQL compatible search query string. Format of this query string is similar to that specified on MLflow UI. Example : "params.model = 'LogisticRegression' and metrics.acc != 0.9" If null, the result will be equivalent to having an empty search filter.
- runViewType- ViewType for expected runs. One of (ACTIVE_ONLY, DELETED_ONLY, ALL) If null, only runs with viewtype ACTIVE_ONLY will be searched.
- Returns:
- A list of all RunInfos that satisfy search filter.
 
 - 
searchRunspublic RunsPage searchRuns(java.util.List<java.lang.String> experimentIds, java.lang.String searchFilter, Service.ViewType runViewType, int maxResults) Return runs from provided list of experiments that satisfy the search query.- Parameters:
- experimentIds- List of experiment IDs.
- searchFilter- SQL compatible search query string. Format of this query string is similar to that specified on MLflow UI. Example : "params.model = 'LogisticRegression' and metrics.acc != 0.9" If null, the result will be equivalent to having an empty search filter.
- runViewType- ViewType for expected runs. One of (ACTIVE_ONLY, DELETED_ONLY, ALL) If null, only runs with viewtype ACTIVE_ONLY will be searched.
- maxResults- Maximum number of runs desired in one page.
- Returns:
- A list of all Runs that satisfy search filter.
 
 - 
searchRunspublic RunsPage searchRuns(java.util.List<java.lang.String> experimentIds, java.lang.String searchFilter, Service.ViewType runViewType, int maxResults, java.util.List<java.lang.String> orderBy) Return runs from provided list of experiments that satisfy the search query.- Parameters:
- experimentIds- List of experiment IDs.
- searchFilter- SQL compatible search query string. Format of this query string is similar to that specified on MLflow UI. Example : "params.model = 'LogisticRegression' and metrics.acc != 0.9" If null, the result will be equivalent to having an empty search filter.
- runViewType- ViewType for expected runs. One of (ACTIVE_ONLY, DELETED_ONLY, ALL) If null, only runs with viewtype ACTIVE_ONLY will be searched.
- maxResults- Maximum number of runs desired in one page.
- orderBy- List of properties to order by. Example: "metrics.acc DESC".
- Returns:
- A list of all Runs that satisfy search filter.
 
 - 
searchRunspublic RunsPage searchRuns(java.util.List<java.lang.String> experimentIds, java.lang.String searchFilter, Service.ViewType runViewType, int maxResults, java.util.List<java.lang.String> orderBy, java.lang.String pageToken) Return runs from provided list of experiments that satisfy the search query.- Parameters:
- experimentIds- List of experiment IDs.
- searchFilter- SQL compatible search query string. Format of this query string is similar to that specified on MLflow UI. Example : "params.model = 'LogisticRegression' and metrics.acc != 0.9" If null, the result will be equivalent to having an empty search filter.
- runViewType- ViewType for expected runs. One of (ACTIVE_ONLY, DELETED_ONLY, ALL) If null, only runs with viewtype ACTIVE_ONLY will be searched.
- maxResults- Maximum number of runs desired in one page.
- orderBy- List of properties to order by. Example: "metrics.acc DESC".
- pageToken- String token specifying the next page of results. It should be obtained from a call to- searchRuns(List, String).
- Returns:
- A page of Runs that satisfy the search filter.
 
 - 
searchExperimentspublic ExperimentsPage searchExperiments(java.lang.String searchFilter, Service.ViewType experimentViewType, int maxResults, java.util.List<java.lang.String> orderBy) Return experiments that satisfy the search query.- Parameters:
- searchFilter- SQL compatible search query string. Examples: - "attribute.name = 'MyExperiment'" - "tags.problem_type = 'iris_regression'" If null, the result will be equivalent to having an empty search filter.
- experimentViewType- ViewType for expected experiments. One of (ACTIVE_ONLY, DELETED_ONLY, ALL). If null, only experiments with viewtype ACTIVE_ONLY will be searched.
- maxResults- Maximum number of experiments desired in one page.
- orderBy- List of properties to order by. Example: "metrics.acc DESC".
- Returns:
- A page of experiments that satisfy the search filter.
 
 - 
searchExperimentspublic ExperimentsPage searchExperiments() Return up to 1000 active experiments.- Returns:
- A page of active experiments with up to 1000 items.
 
 - 
searchExperimentspublic ExperimentsPage searchExperiments(java.lang.String searchFilter) Return up to the first 1000 active experiments that satisfy the search query.- Parameters:
- searchFilter- SQL compatible search query string. Examples: - "attribute.name = 'MyExperiment'" - "tags.problem_type = 'iris_regression'" If null, the result will be equivalent to having an empty search filter.
- Returns:
- A page of up to active 1000 experiments that satisfy the search filter.
 
 - 
searchExperimentspublic ExperimentsPage searchExperiments(java.lang.String searchFilter, Service.ViewType experimentViewType, int maxResults, java.util.List<java.lang.String> orderBy, java.lang.String pageToken) Return experiments that satisfy the search query.- Parameters:
- searchFilter- SQL compatible search query string. Examples: - "attribute.name = 'MyExperiment'" - "tags.problem_type = 'iris_regression'" If null, the result will be equivalent to having an empty search filter.
- experimentViewType- ViewType for expected experiments. One of (ACTIVE_ONLY, DELETED_ONLY, ALL). If null, only experiments with viewtype ACTIVE_ONLY will be searched.
- maxResults- Maximum number of experiments desired in one page.
- orderBy- List of properties to order by. Example: "metrics.acc DESC".
- pageToken- String token specifying the next page of results. It should be obtained from a call to- searchExperiments(String).
- Returns:
- A page of experiments that satisfy the search filter.
 
 - 
getExperimentpublic Service.Experiment getExperiment(java.lang.String experimentId) - Returns:
- An experiment with the given ID.
 
 - 
getExperimentByNamepublic java.util.Optional<Service.Experiment> getExperimentByName(java.lang.String experimentName) - Returns:
- The experiment associated with the given name or Optional.empty if none exists.
 
 - 
createExperimentpublic java.lang.String createExperiment(java.lang.String experimentName) Create a new experiment using the default artifact location provided by the server.- Parameters:
- experimentName- Name of the experiment. This must be unique across all experiments.
- Returns:
- Experiment ID of the newly created experiment.
 
 - 
createExperimentpublic java.lang.String createExperiment(Service.CreateExperiment request) Create a new experiment. This method allows providing all possible fields of CreateExperiment, and can be invoked as follows:import org.mlflow.api.proto.Service.CreateExperiment; CreateExperiment.Builder request = CreateExperiment.newBuilder(); request.setName(name); request.setArtifactLocation(artifactLocation); request.addTags(experimentTag); createExperiment(request.build()); - Returns:
- ID of the experiment created by the server.
 
 - 
deleteExperimentpublic void deleteExperiment(java.lang.String experimentId) Mark an experiment and associated runs, params, metrics, etc. for deletion.
 - 
restoreExperimentpublic void restoreExperiment(java.lang.String experimentId) Restore an experiment marked for deletion.
 - 
renameExperimentpublic void renameExperiment(java.lang.String experimentId, java.lang.String newName)Update an experiment's name. The new name must be unique.
 - 
deleteRunpublic void deleteRun(java.lang.String runId) Delete a run with the given ID.
 - 
restoreRunpublic void restoreRun(java.lang.String runId) Restore a deleted run with the given ID.
 - 
logParampublic void logParam(java.lang.String runId, java.lang.String key, java.lang.String value)Log a parameter against the given run, as a key-value pair. This cannot be called against the same parameter key more than once.
 - 
logMetricpublic void logMetric(java.lang.String runId, java.lang.String key, double value)Log a new metric against the given run, as a key-value pair. Metrics are recorded against two axes: timestamp and step. This method uses the number of milliseconds since the Unix epoch for the timestamp, and it uses the default step of zero.- Parameters:
- runId- The ID of the run in which to record the metric.
- key- The key identifying the metric for which to record the specified value.
- value- The value of the metric.
 
 - 
logMetricpublic void logMetric(java.lang.String runId, java.lang.String key, double value, long timestamp, long step)Log a new metric against the given run, as a key-value pair. Metrics are recorded against two axes: timestamp and step.- Parameters:
- runId- The ID of the run in which to record the metric.
- key- The key identifying the metric for which to record the specified value.
- value- The value of the metric.
- timestamp- The timestamp at which to record the metric value.
- step- The step at which to record the metric value.
 
 - 
setExperimentTagpublic void setExperimentTag(java.lang.String experimentId, java.lang.String key, java.lang.String value)Log a new tag against the given experiment as a key-value pair.- Parameters:
- experimentId- The ID of the experiment on which to set the tag
- key- The key used to identify the tag.
- value- The value of the tag.
 
 - 
setTagpublic void setTag(java.lang.String runId, java.lang.String key, java.lang.String value)Log a new tag against the given run, as a key-value pair.- Parameters:
- runId- The ID of the run on which to set the tag
- key- The key used to identify the tag.
- value- The value of the tag.
 
 - 
deleteTagpublic void deleteTag(java.lang.String runId, java.lang.String key)Delete a tag on the run ID with a specific key. This is irreversible.- Parameters:
- runId- String ID of the run
- key- Name of the tag
 
 - 
logBatchpublic void logBatch(java.lang.String runId, java.lang.Iterable<Service.Metric> metrics, java.lang.Iterable<Service.Param> params, java.lang.Iterable<Service.RunTag> tags)Log multiple metrics, params, and/or tags against a given run (argument runId). Argument metrics, params, and tag iterables can be nulls.
 - 
setTerminatedpublic void setTerminated(java.lang.String runId) Set the status of a run to be FINISHED at the current time.
 - 
setTerminatedpublic void setTerminated(java.lang.String runId, Service.RunStatus status)Set the status of a run to be completed at the current time.
 - 
setTerminatedpublic void setTerminated(java.lang.String runId, Service.RunStatus status, long endTime)Set the status of a run to be completed at the given endTime.
 - 
sendGetpublic java.lang.String sendGet(java.lang.String path) Send a GET to the following path, including query parameters. This is mostly an internal API, but allows making lower-level or unsupported requests.- Returns:
- JSON response from the server.
 
 - 
sendPostpublic java.lang.String sendPost(java.lang.String path, java.lang.String json)Send a POST to the following path, with a String-encoded JSON body. This is mostly an internal API, but allows making lower-level or unsupported requests.- Returns:
- JSON response from the server.
 
 - 
sendPatchpublic java.lang.String sendPatch(java.lang.String path, java.lang.String json)
 - 
logArtifactpublic void logArtifact(java.lang.String runId, java.io.File localFile)Upload the given local file or directory to the run's root artifact directory. For example,logArtifact(runId, "/my/localModel") listArtifacts(runId) // returns "localModel" - Parameters:
- runId- Run ID of an existing MLflow run.
- localFile- File or directory to upload. Must exist.
 
 - 
logArtifactpublic void logArtifact(java.lang.String runId, java.io.File localFile, java.lang.String artifactPath)Upload the given local file or directory to an artifactPath within the run's root directory. For example,logArtifact(runId, "/my/localModel", "model") listArtifacts(runId, "model") // returns "model/localModel" (i.e., the localModel file is now available in model/localModel). If logging a directory, the directory is renamed to artifactPath.- Parameters:
- runId- Run ID of an existing MLflow run.
- localFile- File or directory to upload. Must exist.
- artifactPath- Artifact path relative to the run's root directory. Should NOT start with a /.
 
 - 
logArtifactspublic void logArtifacts(java.lang.String runId, java.io.File localDir)Upload all files within the given local directory the run's root artifact directory. For example, if /my/local/dir/ contains two files "file1" and "file2", thenlogArtifacts(runId, "/my/local/dir") listArtifacts(runId) // returns "file1" and "file2" - Parameters:
- runId- Run ID of an existing MLflow run.
- localDir- Directory to upload. Must exist, and must be a directory (not a simple file).
 
 - 
logArtifactspublic void logArtifacts(java.lang.String runId, java.io.File localDir, java.lang.String artifactPath)Upload all files within the given local director an artifactPath within the run's root artifact directory. For example, if /my/local/dir/ contains two files "file1" and "file2", thenlogArtifacts(runId, "/my/local/dir", "model") listArtifacts(runId, "model") // returns "model/file1" and "model/file2" (i.e., the contents of the local directory are now available in model/).- Parameters:
- runId- Run ID of an existing MLflow run.
- localDir- Directory to upload. Must exist, and must be a directory (not a simple file).
- artifactPath- Artifact path relative to the run's root directory. Should NOT start with a /.
 
 - 
listArtifactspublic java.util.List<Service.FileInfo> listArtifacts(java.lang.String runId) List the artifacts immediately under the run's root artifact directory. This does not recursively list; instead, it will return FileInfos with isDir=true where further listing may be done.- Parameters:
- runId- Run ID of an existing MLflow run.
 
 - 
listArtifactspublic java.util.List<Service.FileInfo> listArtifacts(java.lang.String runId, java.lang.String artifactPath) List the artifacts immediately under the given artifactPath within the run's root artifact directory. This does not recursively list; instead, it will return FileInfos with isDir=true where further listing may be done.- Parameters:
- runId- Run ID of an existing MLflow run.
- artifactPath- Artifact path relative to the run's root directory. Should NOT start with a /.
 
 - 
downloadArtifactspublic java.io.File downloadArtifacts(java.lang.String runId) Return a local directory containing *all* artifacts within the run's artifact directory. Note that this will download the entire directory path, and so may be expensive if the directory has a lot of data.- Parameters:
- runId- Run ID of an existing MLflow run.
 
 - 
downloadArtifactspublic java.io.File downloadArtifacts(java.lang.String runId, java.lang.String artifactPath)Return a local file or directory containing all artifacts within the given artifactPath within the run's root artifactDirectory. For example, if "model/file1" and "model/file2" exist within the artifact directory, thendownloadArtifacts(runId, "model") // returns a local directory containing "file1" and "file2" downloadArtifacts(runId, "model/file1") // returns a local *file* with the contents of file1. Note that this will download the entire subdirectory path, and so may be expensive if the subdirectory has a lot of data.- Parameters:
- runId- Run ID of an existing MLflow run.
- artifactPath- Artifact path relative to the run's root directory. Should NOT start with a /.
 
 - 
getLatestVersionspublic java.util.List<ModelRegistry.ModelVersion> getLatestVersions(java.lang.String modelName) Return the latest model version for each stage. The current available stages are: [None, Staging, Production, Archived].import org.mlflow.api.proto.ModelRegistry.ModelVersion; List<ModelVersion>detailsList = getLatestVersions("model"); for (ModelVersion details : detailsList) { System.out.println("Model Name: " + details.getModelVersion() .getRegisteredModel() .getName()); System.out.println("Model Version: " + details.getModelVersion().getVersion()); System.out.println("Current Stage: " + details.getCurrentStage()); }- Parameters:
- modelName- The name of the model
- Returns:
- A collection of ModelRegistry.ModelVersion
 
 - 
getLatestVersionspublic java.util.List<ModelRegistry.ModelVersion> getLatestVersions(java.lang.String modelName, java.lang.Iterable<java.lang.String> stages) Return the latest model version for each stage requested. The current available stages are: [None, Staging, Production, Archived].import org.mlflow.api.proto.ModelRegistry.ModelVersion; List<ModelVersion>detailsList = getLatestVersions("model", Lists.newArrayList<String>("Staging")); for (ModelVersion details : detailsList) { System.out.println("Model Name: " + details.getModelVersion() .getRegisteredModel() .getName()); System.out.println("Model Version: " + details.getModelVersion().getVersion()); System.out.println("Current Stage: " + details.getCurrentStage()); }- Parameters:
- modelName- The name of the model
- stages- A list of stages
- Returns:
- The latest model version
         ModelRegistry.ModelVersion
 
 - 
getModelVersionpublic ModelRegistry.ModelVersion getModelVersion(java.lang.String modelName, java.lang.String version) import org.mlflow.api.proto.ModelRegistry.ModelVersion; ModelVersion modelVersion = getModelVersion("model", "version");- Parameters:
- modelName- Name of the containing registered model. *
- version- Version number as a string of the model version.
- Returns:
- a single model version
        ModelRegistry.ModelVersion
 
 - 
getRegisteredModelpublic ModelRegistry.RegisteredModel getRegisteredModel(java.lang.String modelName) Returns a RegisteredModel from the model registry for the given model name.import org.mlflow.api.proto.ModelRegistry.RegisteredModel; RegisteredModel registeredModel = getRegisteredModel("model");- Parameters:
- modelName- Name of the containing registered model. *
- Returns:
- a registered model ModelRegistry.RegisteredModel
 
 - 
getModelVersionDownloadUripublic java.lang.String getModelVersionDownloadUri(java.lang.String modelName, java.lang.String version)Return the model URI containing for the given model version. The model URI can be used to download the model version artifacts.String modelUri = getModelVersionDownloadUri("model", 0);- Parameters:
- modelName- The name of the model
- version- The version number of the model
- Returns:
- The specified model version's URI.
 
 - 
downloadModelVersionpublic java.io.File downloadModelVersion(java.lang.String modelName, java.lang.String version)Returns a directory containing all artifacts within the given registered model version. The method will download the model version artifacts to the local file system. Note that this method will not work if the `download_uri` refers to a single file (and not a directory) due to the way many ArtifactRepository's `download_artifacts` handle empty subpaths.File modelVersionDir = downloadModelVersion("model", 0);- Parameters:
- modelName- The name of the model
- version- The version number of the model
- Returns:
- A directory (File) containing model artifacts
 
 - 
downloadLatestModelVersionpublic java.io.File downloadLatestModelVersion(java.lang.String modelName, java.lang.String stage)Returns a directory containing all artifacts within the latest registered model version in the given stage. The method will download the model version artifacts to the local file system.File modelVersionDir = downloadLatestModelVersion("model", "Staging");(i.e., the contents of the local directory are now available).- Parameters:
- modelName- The name of the model
- stage- The name of the stage
- Returns:
- A directory (File) containing model artifacts
 
 - 
searchModelVersionspublic ModelVersionsPage searchModelVersions(java.lang.String searchFilter, int maxResults, java.util.List<java.lang.String> orderBy) Return model versions that satisfy the search query.- Parameters:
- searchFilter- SQL compatible search query string. Examples: - "name = 'model_name'" - "run_id = '...'" If null, the result will be equivalent to having an empty search filter.
- maxResults- Maximum number of model versions desired in one page.
- orderBy- List of properties to order by. Example: "name DESC".
- Returns:
- A page of model versions that satisfy the search filter.
 
 - 
searchModelVersionspublic ModelVersionsPage searchModelVersions() Return up to 1000 model versions.- Returns:
- A page of model versions with up to 1000 items.
 
 - 
searchModelVersionspublic ModelVersionsPage searchModelVersions(java.lang.String searchFilter) Return up to 1000 model versions that satisfy the search query.- Parameters:
- searchFilter- SQL compatible search query string. Examples: - "name = 'model_name'" - "run_id = '...'" If null, the result will be equivalent to having an empty search filter.
- Returns:
- A page of model versions with up to 1000 items.
 
 - 
searchModelVersionspublic ModelVersionsPage searchModelVersions(java.lang.String searchFilter, int maxResults, java.util.List<java.lang.String> orderBy, java.lang.String pageToken) Return model versions that satisfy the search query.- Parameters:
- searchFilter- SQL compatible search query string. Examples: - "name = 'model_name'" - "run_id = '...'" If null, the result will be equivalent to having an empty search filter.
- maxResults- Maximum number of model versions desired in one page.
- orderBy- List of properties to order by. Example: "name DESC".
- pageToken- String token specifying the next page of results. It should be obtained from a call to- searchModelVersions(String).
- Returns:
- A page of model versions that satisfy the search filter.
 
 - 
closepublic void close() Closes the MlflowClient and releases any associated resources.- Specified by:
- closein interface- java.lang.AutoCloseable
- Specified by:
- closein interface- java.io.Closeable
 
 
- 
 
-