pub struct Client {
pub client: Client,
pub mlflow: MlflowConfig,
pub download: DownloadConfig,
}Expand description
This is low-level client which reflects mlflow 2.0 API.
Fields§
§client: Client§mlflow: MlflowConfigMlflow related configuration.
download: DownloadConfigConfiguration which is related to artifact download.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(urlbase: impl AsRef<str>) -> Self
pub fn new(urlbase: impl AsRef<str>) -> Self
Creates a new client which uses a default reqwest::Client without
additional settings.
Sourcepub fn new_from_config(config: ClientConfig) -> Self
pub fn new_from_config(config: ClientConfig) -> Self
Creates a new client using provided configuration.
Sourcepub fn with_auth(self, auth: BasicAuth) -> Self
pub fn with_auth(self, auth: BasicAuth) -> Self
Sets basic auth which will be send to mlflow server.
Sourcepub async fn create_experiment(
&self,
name: &str,
tags: Vec<KeyValue>,
) -> Result<String>
pub async fn create_experiment( &self, name: &str, tags: Vec<KeyValue>, ) -> Result<String>
Create an experiment with a name. Returns the ID of the newly created experiment. Validates that another experiment with the same name does not already exist and fails if another experiment with the same name already exists.
Sourcepub async fn delete_experiment(&self, experiment_id: &str) -> Result<()>
pub async fn delete_experiment(&self, experiment_id: &str) -> Result<()>
Mark an experiment and associated metadata, runs, metrics, params, and tags for deletion. If the experiment uses FileStore, artifacts associated with experiment are also deleted.
Sourcepub async fn get_experiment(&self, experiment_id: &str) -> Result<Experiment>
pub async fn get_experiment(&self, experiment_id: &str) -> Result<Experiment>
Get metadata for an experiment. This method works on deleted experiments.
Sourcepub async fn get_experiment_by_name(&self, name: &str) -> Result<Experiment>
pub async fn get_experiment_by_name(&self, name: &str) -> Result<Experiment>
Get metadata for an experiment.
This endpoint will return deleted experiments, but prefers the active experiment if an active and deleted experiment share the same name. If multiple deleted experiments share the same name, the API will return one of them.
Sourcepub async fn get_or_create_experiment(
&self,
name: &str,
tags: Vec<KeyValue>,
) -> Result<Experiment>
pub async fn get_or_create_experiment( &self, name: &str, tags: Vec<KeyValue>, ) -> Result<Experiment>
Loads experiment with specified name or create one with that name and without tags.
Sourcepub async fn create_run(&self, create: CreateRun) -> Result<Run>
pub async fn create_run(&self, create: CreateRun) -> Result<Run>
Create a new run within an experiment. A run is usually a single execution of a machine learning or data ETL pipeline. MLflow uses runs to track Param, Metric, and RunTag associated with a single execution.
Sourcepub async fn get_run(&self, run_id: &str) -> Result<Run>
pub async fn get_run(&self, run_id: &str) -> Result<Run>
Get metadata, metrics, params, and tags for a run. In the case where multiple metrics with the same key are logged for a run, return only the value with the latest timestamp. If there are multiple values with the latest timestamp, return the maximum of these values.
Sourcepub async fn search_runs(&self, search: SearchRuns) -> Result<Vec<Run>>
pub async fn search_runs(&self, search: SearchRuns) -> Result<Vec<Run>>
Search for runs that satisfy expressions. Search expressions can use Metric and Param keys.
Sourcepub async fn update_run(&self, update: UpdateRun) -> Result<RunInfo>
pub async fn update_run(&self, update: UpdateRun) -> Result<RunInfo>
Update run metadata.
Sourcepub async fn add_run_meta(&self, run_id: &str, meta: RunData) -> Result<()>
pub async fn add_run_meta(&self, run_id: &str, meta: RunData) -> Result<()>
Log a batch of metrics, params, and tags for a run. If any data failed to be persisted, the server will respond with an error (non-200 status code). In case of error (due to internal server error or an invalid request), partial data may be written.
pub async fn delete_run(&self, run_id: &str) -> Result<()>
pub async fn add_run_inputs( &self, run_id: &str, inputs: Vec<DataSetInput>, ) -> Result<()>
pub async fn delete_registered_model(&self, name: &str) -> Result<()>
pub async fn register_model( &self, request: RegisterModel, ) -> Result<RegisteredModel>
pub async fn get_registered_model(&self, name: &str) -> Result<RegisteredModel>
pub async fn search_registered_models( &self, filter: &str, ) -> Result<Vec<RegisteredModel>>
pub async fn create_model_version( &self, request: CreateModelVersion, ) -> Result<ModelVersion>
pub async fn transition_model_version_stage( &self, request: TransitionModelVersionStage, ) -> Result<ModelVersion>
Sourcepub async fn list_run_artifacts(&self, run_id: &str) -> Result<ListedArtifacts>
pub async fn list_run_artifacts(&self, run_id: &str) -> Result<ListedArtifacts>
Lists all artifacts (recursively) for a run.
Sourcepub async fn download_artifacts(
&self,
downloads: Vec<DownloadRunArtifacts>,
) -> Result<Vec<RunArtifacts>>
pub async fn download_artifacts( &self, downloads: Vec<DownloadRunArtifacts>, ) -> Result<Vec<RunArtifacts>>
Downloads multiple artifacts from multiple runs.
Sourcepub async fn prepare_run_download(
&self,
run_id: &str,
directory: impl AsRef<Path>,
) -> Result<DownloadRunArtifacts>
pub async fn prepare_run_download( &self, run_id: &str, directory: impl AsRef<Path>, ) -> Result<DownloadRunArtifacts>
Prepares download of artifacts from specified run.
Sourcepub async fn download_run_artifacts(
&self,
download: DownloadRunArtifacts,
) -> Result<RunArtifacts>
pub async fn download_run_artifacts( &self, download: DownloadRunArtifacts, ) -> Result<RunArtifacts>
Downloads all artifacts for one run.
Sourcepub async fn upload_json_artifact_no_retry(
&self,
data: &impl Serialize,
artifact: &Artifact,
) -> Result<()>
pub async fn upload_json_artifact_no_retry( &self, data: &impl Serialize, artifact: &Artifact, ) -> Result<()>
Uploads json artifact using mlflow tracking server.
Sourcepub async fn upload_json_artifact(
&self,
data: &impl Serialize,
artifact: &Artifact,
) -> Result<()>
pub async fn upload_json_artifact( &self, data: &impl Serialize, artifact: &Artifact, ) -> Result<()>
Uploads json artifact using mlflow tracking server.
Sourcepub async fn download_json_artifact_no_retry<T: DeserializeOwned>(
&self,
artifact: &Artifact,
) -> Result<T>
pub async fn download_json_artifact_no_retry<T: DeserializeOwned>( &self, artifact: &Artifact, ) -> Result<T>
Downloads artifact and tries it to parse as a json.
Sourcepub async fn download_json_artifact<T: DeserializeOwned>(
&self,
artifact: &Artifact,
) -> Result<T>
pub async fn download_json_artifact<T: DeserializeOwned>( &self, artifact: &Artifact, ) -> Result<T>
Downloads artifact and tries it to parse as a json.
Sourcepub async fn upload_artifact_no_retry(
&self,
source: impl AsRef<Path>,
artifact: &Artifact,
) -> Result<()>
pub async fn upload_artifact_no_retry( &self, source: impl AsRef<Path>, artifact: &Artifact, ) -> Result<()>
Uploads artifact using mlflow tracking server.
Sourcepub async fn upload_artifacts(&self, uploads: Vec<UploadArtifact>) -> Result<()>
pub async fn upload_artifacts(&self, uploads: Vec<UploadArtifact>) -> Result<()>
Uploads multiple artifacts at once.
Sourcepub async fn upload_artifact(
&self,
source: impl AsRef<Path>,
artifact: &Artifact,
) -> Result<()>
pub async fn upload_artifact( &self, source: impl AsRef<Path>, artifact: &Artifact, ) -> Result<()>
Uploads artifact using mlflow tracking server.
Sourcepub async fn download_artifact_no_retry(
&self,
download: &DownloadRunArtifact,
) -> Result<u64>
pub async fn download_artifact_no_retry( &self, download: &DownloadRunArtifact, ) -> Result<u64>
Downloads artifact FILE from mlflow tracking server into specified path.
Returns a size of downloaded artifact in bytes.
Sourcepub async fn download_artifact(
&self,
download: &DownloadRunArtifact,
) -> Result<u64>
pub async fn download_artifact( &self, download: &DownloadRunArtifact, ) -> Result<u64>
Downloads artifact FILE from mlflow tracking server into specified path.