Client

Struct Client 

Source
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: MlflowConfig

Mlflow related configuration.

§download: DownloadConfig

Configuration which is related to artifact download.

Implementations§

Source§

impl Client

Source

pub fn new(urlbase: impl AsRef<str>) -> Self

Creates a new client which uses a default reqwest::Client without additional settings.

Source

pub fn new_from_config(config: ClientConfig) -> Self

Creates a new client using provided configuration.

Source

pub fn with_auth(self, auth: BasicAuth) -> Self

Sets basic auth which will be send to mlflow server.

Source

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.

Source

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.

Source

pub async fn get_experiment(&self, experiment_id: &str) -> Result<Experiment>

Get metadata for an experiment. This method works on deleted experiments.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub async fn update_run(&self, update: UpdateRun) -> Result<RunInfo>

Update run metadata.

Source

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.

Source

pub async fn delete_run(&self, run_id: &str) -> Result<()>

Source

pub async fn add_run_inputs( &self, run_id: &str, inputs: Vec<DataSetInput>, ) -> Result<()>

Source

pub async fn delete_registered_model(&self, name: &str) -> Result<()>

Source

pub async fn register_model( &self, request: RegisterModel, ) -> Result<RegisteredModel>

Source

pub async fn get_registered_model(&self, name: &str) -> Result<RegisteredModel>

Source

pub async fn search_registered_models( &self, filter: &str, ) -> Result<Vec<RegisteredModel>>

Source

pub async fn create_model_version( &self, request: CreateModelVersion, ) -> Result<ModelVersion>

Source

pub async fn transition_model_version_stage( &self, request: TransitionModelVersionStage, ) -> Result<ModelVersion>

Source

pub async fn list_run_artifacts(&self, run_id: &str) -> Result<ListedArtifacts>

Lists all artifacts (recursively) for a run.

Source

pub async fn download_artifacts( &self, downloads: Vec<DownloadRunArtifacts>, ) -> Result<Vec<RunArtifacts>>

Downloads multiple artifacts from multiple runs.

Source

pub async fn prepare_run_download( &self, run_id: &str, directory: impl AsRef<Path>, ) -> Result<DownloadRunArtifacts>

Prepares download of artifacts from specified run.

Source

pub async fn download_run_artifacts( &self, download: DownloadRunArtifacts, ) -> Result<RunArtifacts>

Downloads all artifacts for one run.

Source

pub async fn upload_json_artifact_no_retry( &self, data: &impl Serialize, artifact: &Artifact, ) -> Result<()>

Uploads json artifact using mlflow tracking server.

Source

pub async fn upload_json_artifact( &self, data: &impl Serialize, artifact: &Artifact, ) -> Result<()>

Uploads json artifact using mlflow tracking server.

Source

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.

Source

pub async fn download_json_artifact<T: DeserializeOwned>( &self, artifact: &Artifact, ) -> Result<T>

Downloads artifact and tries it to parse as a json.

Source

pub async fn upload_artifact_no_retry( &self, source: impl AsRef<Path>, artifact: &Artifact, ) -> Result<()>

Uploads artifact using mlflow tracking server.

Source

pub async fn upload_artifacts(&self, uploads: Vec<UploadArtifact>) -> Result<()>

Uploads multiple artifacts at once.

Source

pub async fn upload_artifact( &self, source: impl AsRef<Path>, artifact: &Artifact, ) -> Result<()>

Uploads artifact using mlflow tracking server.

Source

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.

Source

pub async fn download_artifact( &self, download: &DownloadRunArtifact, ) -> Result<u64>

Downloads artifact FILE from mlflow tracking server into specified path.

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more