Run API

pydantic model mlopus.mlflow.RunApi[source]

Bases: Run, EntityApi

Run metadata with MLflow API handle.

field end_time: datetime | None [Required]

Start time in local timezone.

field exp: ExpApi [Required]

Parent experiment.

field id: str [Required]

Run ID in the pattern [w-]+

field metrics: Dict[str, Any] [Required]

Nested metrics dict with float leaf-values.

field name: str [Required]

Run name.

field params: Dict[str, Any] [Required]

Nested params dict with JSON-serializable leaf-values.

field repo: str [Required]

Artifacts repo URL.

field start_time: datetime | None [Required]

End time in local timezone.

field status: RunStatus | None [Required]

Run status.

field tags: Dict[str, Any] [Required]

Nested tags dict with JSON-serializable leaf-values and keys in the pattern: [w-/]+

class Config

Bases: object

Pydantic class config.

cache_artifact(path_in_run='')[source]

Pull run artifact from MLflow server to local cache.

Parameters:

path_in_run (str) –

Return type:

Path

cache_meta()[source]

Fetch latest metadata of this run and save to cache.

Return type:

RunApi

clean_cached_artifact(path_in_run='')[source]

Clean cached artifact for this run.

Parameters:

path_in_run (str) –

create_child(name=None, tags=None, repo=None)[source]

Declare a new child run to be used later.

Parameters:
end_run(succeeded=True)[source]

End experiment run.

Return type:

RunApi

export_artifact(target, path_in_run='')[source]

Export run artifact cache to target.

Parameters:
Return type:

Path

export_meta(target)[source]

Export metadata cache for this run.

Parameters:

target (Path) – Cache export path..

Return type:

RunApi

find_model_versions(query=None, sorting=None)[source]

Search model versions belonging to this run with query in MongoDB query language.

Parameters:
  • query (Optional[Dict[str, Any]]) – Query in MongoDB query language.

  • sorting (Optional[List[Tuple[str, Literal[1, -1]]]]) – Sorting criteria (e.g.: [(“asc_field”, 1), (“desc_field”, -1)]).

Return type:

Iterator[ModelVersionApi]

get_artifact(path_in_run='')[source]

Get local path to run artifact.

Parameters:

path_in_run (str) –

Return type:

Path

list_artifacts(path_in_run='')[source]

List artifacts in this run’s artifact repo.

Parameters:

path_in_run (str) –

Return type:

Union[List[ObjMeta], ObjMeta]

load_artifact(loader, path_in_run='')[source]

Load run artifact.

Parameters:
Return type:

TypeVar(A)

log_artifact(source, path_in_run=None, keep_the_source=None, allow_duplication=None, use_cache=None)[source]

Publish artifact file or dir to this experiment run.

Parameters:
log_metrics(metrics)[source]

Log metrics to this experiment run.

Parameters:

metrics (Mapping) – See schema.Run.metrics.

Return type:

RunApi

log_model_version(model, source, path_in_run=None, keep_the_source=None, allow_duplication=False, use_cache=None, version=None, tags=None)[source]

Publish artifact file or dir as model version inside this experiment run.

Parameters:
Return type:

ModelVersionApi

Returns:

New model version metadata with API handle.

log_params(params)[source]

Log params to this run.

Parameters:

params (Mapping) – See schema.Run.params.

Return type:

RunApi

place_artifact(target, path_in_run='', overwrite=False, link=True)[source]

Place run artifact on target path.

Parameters:
resume()[source]

Resume this experiment run.

Return type:

RunApi

set_tags(tags)[source]

Set tags on this run.

Parameters:

tags (Mapping) – See schema.Run.tags.

Return type:

RunApi

start_child(name=None, tags=None, repo=None)[source]

Start a new child run.

Parameters:
update()

Use API to get latest data for this entity and update this entity in place.

Return type:

EntityApi

property children: Iterator[RunApi]

Child runs.

property repo_url: Url

Artifacts repo URL.

property url: str

The URL to this experiment run.