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
) –Seepath_in_run
- Return type:
Path
- clean_cached_artifact(path_in_run='')[source]
Clean cached artifact for this run.
- Parameters:
path_in_run¶ (
str
) –Seepath_in_run
- create_child(name=None, tags=None, repo=None)[source]
Declare a new child run to be used later.
- Parameters:
name¶ (
Optional
[str
]) – Seeschema.Run.name
.tags¶ (
Optional
[Mapping
]) – Seeschema.Run.tags
.
- export_artifact(target, path_in_run='')[source]
Export run artifact cache to target.
- Parameters:
path_in_run¶ (
str
) –Seepath_in_run
- Return type:
Path
- find_model_versions(query=None, sorting=None)[source]
Search model versions belonging to this run with query in MongoDB query language.
- Parameters:
- Return type:
Iterator
[ModelVersionApi
]
- get_artifact(path_in_run='')[source]
Get local path to run artifact.
- Parameters:
path_in_run¶ (
str
) –Seepath_in_run
- Return type:
Path
- list_artifacts(path_in_run='')[source]
List artifacts in this run’s artifact repo.
- Parameters:
path_in_run¶ (
str
) –Seepath_in_run
- Return type:
Union
[List
[ObjMeta
],ObjMeta
]
- load_artifact(loader, path_in_run='')[source]
Load run artifact.
- Parameters:
path_in_run¶ (
str
) –Seepath_in_run
- 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:
source¶ (
Union
[Path
,Callable
[[Path
],None
]]) –Seesource
path_in_run¶ (
Optional
[str
]) –Seepath_in_run
keep_the_source¶ (
Optional
[bool
]) –Seekeep_the_source
allow_duplication¶ (
Optional
[bool
]) –- See
use_cache
- log_metrics(metrics)[source]
Log metrics to this experiment run.
- Parameters:
metrics¶ (
Mapping
) – Seeschema.Run.metrics
.- Return type:
- 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:
- Model name or object.
source¶ (
Union
[Path
,Callable
[[Path
],None
]]) –Seesource
path_in_run¶ (
Optional
[str
]) –Seepath_in_run
keep_the_source¶ (
Optional
[bool
]) –Seekeep_the_source
allow_duplication¶ (
bool
) –- See
use_cache
- See
version
- Model version tags.
- Return type:
- Returns:
New model version metadata with API handle.
- log_params(params)[source]
Log params to this run.
- Parameters:
params¶ (
Mapping
) – Seeschema.Run.params
.- Return type:
- place_artifact(target, path_in_run='', overwrite=False, link=True)[source]
Place run artifact on target path.
- set_tags(tags)[source]
Set tags on this run.
- Parameters:
tags¶ (
Mapping
) – Seeschema.Run.tags
.- Return type:
- start_child(name=None, tags=None, repo=None)[source]
Start a new child run.
- Parameters:
name¶ (
Optional
[str
]) – Seeschema.Run.name
.tags¶ (
Optional
[Mapping
]) – Seeschema.Run.tags
.
- update()
Use API to get latest data for this entity and update this entity in place.
- Return type:
EntityApi
- property repo_url: Url
Artifacts repo URL.
- property url: str
The URL to this experiment run.