Tracking
tracking ¶
Experiment ¶
Bases: StoredModel
id: int = field(init=False) class-attribute instance-attribute ¶
name: str instance-attribute ¶
description: Optional[str] instance-attribute ¶
artifact_uri: Optional[str] instance-attribute ¶
start_run(name: str, description: Optional[str] = None) -> Run ¶
search_runs(**kwargs) -> List[Run] ¶
delete_run(run: Union[Run, int]) -> None ¶
Run ¶
Bases: StoredModel
id: int = field(init=False) class-attribute instance-attribute ¶
experiment_id: int instance-attribute ¶
name: str instance-attribute ¶
description: Optional[str] instance-attribute ¶
created_at: Optional[dt.datetime] = None class-attribute instance-attribute ¶
tags: MutableMapping[str, JSONType] = field(init=False) class-attribute instance-attribute ¶
__post_init__() ¶
log_param(key: str, value: ValueType, *, step: Union[Value, int, None] = None) -> Value ¶
log_params(values: Mapping[str, ValueType], *, step: Optional[Value] = None, prefix: Optional[str] = None) -> List[Value] ¶
log_metric(key: str, value: ValueType, *, step: Union[Value, int, None] = None) -> Value ¶
log_metrics(values: Mapping[str, ValueType], *, step: Optional[Value] = None, prefix: Optional[str] = None) -> List[Value] ¶
get_values() -> List[Tuple[Variable, Value]] ¶
TrackingClient ¶
store: TrackingStore property ¶
__init__(store: TrackingStore) -> None ¶
create_experiment(name: str, description: Optional[str] = None, artifact_uri: Optional[str] = None) -> Experiment ¶
get_experiment_by_name(name: str) -> Optional[Experiment] ¶
get_or_create_experiment(name: str, *, description: Optional[str] = None, artifact_uri: Optional[str] = None) -> Experiment ¶
list_experiments() ¶
Value ¶
Bases: StoredModel
id: int = field(init=False) class-attribute instance-attribute ¶
run_id: int instance-attribute ¶
variable_id: int instance-attribute ¶
value: ValueType instance-attribute ¶
timestamp: Optional[dt.datetime] = None class-attribute instance-attribute ¶
step_id: Optional[int] = None class-attribute instance-attribute ¶
SQLAlchemyTrackingStore ¶
Bases: TrackingStore
SQLAlchemy tracking store.
This class is used to define the interface for tracking store.
lock: Optional[FileLock] = lockfile instance-attribute ¶
engine = create_engine(url) instance-attribute ¶
__init__(url: Union[str, URL] = 'sqlite:///:memory:') ¶
create_all(checkfirst: bool = True) ¶
session() ¶
create_experiment(name: str, description: Optional[str] = None, artifact_uri: Optional[str] = None) -> Experiment ¶
list_experiments() -> List[Experiment] ¶
get_experiment(experiment_id: int) -> Experiment ¶
get_experiment_by_name(name: str) -> Experiment ¶
create_run(experiment_id: int, name: str, description: Optional[str] = None) -> Run ¶
delete_run(experiment_id: int, run_id: int) -> None ¶
search_runs(experiment_id: int, expression: Optional[ColumnExpressionArgument[bool]] = None) -> List[Run] ¶
list_runs(experiment_id: int) -> List[Run] ¶
set_tag(run_id: int, name: str, value: JSONType = None) -> RunTags ¶
get_tag(run_id: int, name: str) -> JSONType ¶
get_tags(run_id: int) -> Dict[str, JSONType] ¶
count_tags(run_id: int) -> int ¶
delete_tag(run_id: int, name: str) -> RunTags ¶
log_value(run_id: int, key: str, value: ValueType, *, step_id: Optional[int] = None, type: Optional[VariableType] = None, value_id: Optional[int] = None, is_step: Optional[bool] = None) -> Value ¶
get_values(run_id: int) -> List[Tuple[Variable, Value]] ¶
TrackingStore ¶
Abstract class for tracking store.
This class is used to define the interface for tracking store.
__enter__() ¶
__exit__(exc_type, exc_value, traceback) ¶
create_experiment(name: str, description: Optional[str] = None, artifact_uri: Optional[str] = None) -> Experiment abstractmethod ¶
list_experiments() -> List[Experiment] abstractmethod ¶
get_experiment(experiment_id: int) -> Experiment abstractmethod ¶
get_experiment_by_name(name: str) -> Experiment abstractmethod ¶
create_run(experiment_id: int, name: str, description: Optional[str] = None) -> Run abstractmethod ¶
delete_run(experiment_id: int, run_id: int) -> None abstractmethod ¶
list_runs(experiment_id: int) -> List[Run] abstractmethod ¶
search_runs(experiment_id: int, **kwargs) -> List[Run] abstractmethod ¶
set_tag(run_id: int, name: str, value: JSONType = None) -> RunTags abstractmethod ¶
get_tag(run_id: int, name: str) -> JSONType abstractmethod ¶
get_tags(run_id: int) -> Dict[str, JSONType] abstractmethod ¶
count_tags(run_id: int) -> int abstractmethod ¶
delete_tag(run_id: int, name: str) -> RunTags abstractmethod ¶
log_value(run_id: int, key: str, value: str, *, step_id: Optional[int] = None, type: Optional[VariableType] = None, is_step: Optional[bool] = None) -> Value abstractmethod ¶
log_values(run_id: int, values: List[Union[ValueMapping, ValueTuple, Value]], *, step_id: Optional[int] = None, type: Optional[VariableType] = None) -> List[Value] ¶
get_values(run_id: int) -> List[Tuple[Variable, Value]] abstractmethod ¶
import_store(other: TrackingStore) ¶
artifact ¶
handler ¶
ArtifactMetadata ¶
Bases: MutableDict[str, Any]
ArtifactHandler ¶
path: Path = Path(path) instance-attribute ¶
metadata = ArtifactMetadata(self) instance-attribute ¶
__init__(path: Union[str, Path]) -> None ¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | The path to the artifact | required |
load() -> Any abstractmethod ¶
Load the artifact from the path.
Returns:
| Type | Description |
|---|---|
Any | The loaded artifact. |
save(obj: Any, *args, **kwargs) abstractmethod ¶
Save the given artifact to the path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj | Any | The artifact to save. | required |
args | tuple | Additional positional arguments. | () |
kwargs | dict | Additional keyword arguments. | {} |
Returns:
| Type | Description |
|---|---|
None | |
can_handle(obj: object) -> bool abstractmethod classmethod ¶
Return True if this handler can handle the given object type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj | object | The object to check. | required |
Returns:
| Type | Description |
|---|---|
bool | True if this handler can handle the given object type. |
exists() -> bool ¶
Return True if the artifact exists.
Returns:
| Type | Description |
|---|---|
bool | True if the artifact exists. |
unlink() ¶
Unlink/delete the artifact.
Returns:
| Type | Description |
|---|---|
None | None |
get_handler_type(name: str) -> Type[ArtifactHandler] ¶
get_handler_type_by_object(obj: Any) -> Type[ArtifactHandler] ¶
list_handler_types() -> List[str] ¶
models ¶
JSONType = Union[str, int, float, bool, None, Dict[str, Any], List[Any]] module-attribute ¶
TrackingStore ¶
Abstract class for tracking store.
This class is used to define the interface for tracking store.
__enter__() ¶
__exit__(exc_type, exc_value, traceback) ¶
create_experiment(name: str, description: Optional[str] = None, artifact_uri: Optional[str] = None) -> Experiment abstractmethod ¶
list_experiments() -> List[Experiment] abstractmethod ¶
get_experiment(experiment_id: int) -> Experiment abstractmethod ¶
get_experiment_by_name(name: str) -> Experiment abstractmethod ¶
create_run(experiment_id: int, name: str, description: Optional[str] = None) -> Run abstractmethod ¶
delete_run(experiment_id: int, run_id: int) -> None abstractmethod ¶
list_runs(experiment_id: int) -> List[Run] abstractmethod ¶
search_runs(experiment_id: int, **kwargs) -> List[Run] abstractmethod ¶
set_tag(run_id: int, name: str, value: JSONType = None) -> RunTags abstractmethod ¶
get_tag(run_id: int, name: str) -> JSONType abstractmethod ¶
get_tags(run_id: int) -> Dict[str, JSONType] abstractmethod ¶
count_tags(run_id: int) -> int abstractmethod ¶
delete_tag(run_id: int, name: str) -> RunTags abstractmethod ¶
log_value(run_id: int, key: str, value: str, *, step_id: Optional[int] = None, type: Optional[VariableType] = None, is_step: Optional[bool] = None) -> Value abstractmethod ¶
log_values(run_id: int, values: List[Union[ValueMapping, ValueTuple, Value]], *, step_id: Optional[int] = None, type: Optional[VariableType] = None) -> List[Value] ¶
get_values(run_id: int) -> List[Tuple[Variable, Value]] abstractmethod ¶
import_store(other: TrackingStore) ¶
TrackingClient ¶
store: TrackingStore property ¶
__init__(store: TrackingStore) -> None ¶
create_experiment(name: str, description: Optional[str] = None, artifact_uri: Optional[str] = None) -> Experiment ¶
get_experiment_by_name(name: str) -> Optional[Experiment] ¶
get_or_create_experiment(name: str, *, description: Optional[str] = None, artifact_uri: Optional[str] = None) -> Experiment ¶
list_experiments() ¶
Experiment ¶
Bases: StoredModel
id: int = field(init=False) class-attribute instance-attribute ¶
name: str instance-attribute ¶
description: Optional[str] instance-attribute ¶
artifact_uri: Optional[str] instance-attribute ¶
start_run(name: str, description: Optional[str] = None) -> Run ¶
search_runs(**kwargs) -> List[Run] ¶
delete_run(run: Union[Run, int]) -> None ¶
TagsMapping ¶
Run ¶
Bases: StoredModel
id: int = field(init=False) class-attribute instance-attribute ¶
experiment_id: int instance-attribute ¶
name: str instance-attribute ¶
description: Optional[str] instance-attribute ¶
created_at: Optional[dt.datetime] = None class-attribute instance-attribute ¶
tags: MutableMapping[str, JSONType] = field(init=False) class-attribute instance-attribute ¶
__post_init__() ¶
log_param(key: str, value: ValueType, *, step: Union[Value, int, None] = None) -> Value ¶
log_params(values: Mapping[str, ValueType], *, step: Optional[Value] = None, prefix: Optional[str] = None) -> List[Value] ¶
log_metric(key: str, value: ValueType, *, step: Union[Value, int, None] = None) -> Value ¶
log_metrics(values: Mapping[str, ValueType], *, step: Optional[Value] = None, prefix: Optional[str] = None) -> List[Value] ¶
get_values() -> List[Tuple[Variable, Value]] ¶
Variable ¶
Bases: StoredModel
id: int = field(init=False) class-attribute instance-attribute ¶
experiment_id: int instance-attribute ¶
key: str instance-attribute ¶
parent_id: Optional[int] instance-attribute ¶
type: Optional[VariableType] = None class-attribute instance-attribute ¶
is_step: Optional[bool] = None class-attribute instance-attribute ¶
Value ¶
Bases: StoredModel
id: int = field(init=False) class-attribute instance-attribute ¶
run_id: int instance-attribute ¶
variable_id: int instance-attribute ¶
value: ValueType instance-attribute ¶
timestamp: Optional[dt.datetime] = None class-attribute instance-attribute ¶
step_id: Optional[int] = None class-attribute instance-attribute ¶
RunTags ¶
Bases: StoredModel
Tag ¶
Bases: StoredModel
sqlalchemy_store ¶
mapper_registry = registry() module-attribute ¶
variable_constraints = (Index('ix_experiment_id_key', Variable.experiment_id, Variable.key, case((Variable.parent_id.is_(None), '<NULL>'), else_=Variable.parent_id), unique=True),) module-attribute ¶
SQLAlchemyTrackingStore ¶
Bases: TrackingStore
SQLAlchemy tracking store.
This class is used to define the interface for tracking store.
lock: Optional[FileLock] = lockfile instance-attribute ¶
engine = create_engine(url) instance-attribute ¶
__init__(url: Union[str, URL] = 'sqlite:///:memory:') ¶
create_all(checkfirst: bool = True) ¶
session() ¶
create_experiment(name: str, description: Optional[str] = None, artifact_uri: Optional[str] = None) -> Experiment ¶
list_experiments() -> List[Experiment] ¶
get_experiment(experiment_id: int) -> Experiment ¶
get_experiment_by_name(name: str) -> Experiment ¶
create_run(experiment_id: int, name: str, description: Optional[str] = None) -> Run ¶
delete_run(experiment_id: int, run_id: int) -> None ¶
search_runs(experiment_id: int, expression: Optional[ColumnExpressionArgument[bool]] = None) -> List[Run] ¶
list_runs(experiment_id: int) -> List[Run] ¶
set_tag(run_id: int, name: str, value: JSONType = None) -> RunTags ¶
get_tag(run_id: int, name: str) -> JSONType ¶
get_tags(run_id: int) -> Dict[str, JSONType] ¶
count_tags(run_id: int) -> int ¶
delete_tag(run_id: int, name: str) -> RunTags ¶
log_value(run_id: int, key: str, value: ValueType, *, step_id: Optional[int] = None, type: Optional[VariableType] = None, value_id: Optional[int] = None, is_step: Optional[bool] = None) -> Value ¶
get_values(run_id: int) -> List[Tuple[Variable, Value]] ¶
SQLAlchemyStore ¶
Bases: SQLAlchemyTrackingStore
store ¶
store_cv = ContextVar('store', default=None) module-attribute ¶
VariableType = Literal['param', 'metric'] module-attribute ¶
ValueType = Union[str, float, int, bool, None] module-attribute ¶
ValueMapping ¶
ValueTuple ¶
Bases: NamedTuple
key: str instance-attribute ¶
value: ValueType instance-attribute ¶
type: VariableType instance-attribute ¶
step_id: Optional[int] = None class-attribute instance-attribute ¶
timestamp: Optional[dt.datetime] = None class-attribute instance-attribute ¶
is_step: Optional[bool] = None class-attribute instance-attribute ¶
TrackingStore ¶
Abstract class for tracking store.
This class is used to define the interface for tracking store.