minto.environment
Environment information collection module for MINTO experiments.
This module provides functionality to automatically collect and record environment metadata for optimization experiments, including OS information, hardware specifications, Python environment details, and package versions.
Classes¶
EnvironmentInfo¶
EnvironmentInfo(os_name: str, os_version: str, platform_info: str, cpu_info: str, cpu_count: int, memory_total: int, architecture: str, python_version: str, python_executable: str, virtual_env: typing.Optional, package_versions: dict, timestamp: str)Container for environment information collected during experiment execution.
Methods¶
to_dict¶
to_dict() -> dictConvert EnvironmentInfo to dictionary for serialization.
Functions¶
get_os_info¶
get_os_info() -> tupleGet operating system information.
Returns:
| Type | Description |
|---|---|
tuple | Tuple of (os_name, os_version, platform_info) |
get_cpu_info¶
get_cpu_info() -> tupleGet CPU information.
Returns:
| Type | Description |
|---|---|
tuple | Tuple of (cpu_info, cpu_count, architecture) |
get_memory_info¶
get_memory_info() -> intGet total system memory in bytes.
Returns:
| Type | Description |
|---|---|
int | Total memory in bytes |
get_python_env_info¶
get_python_env_info() -> tupleGet Python environment information.
Returns:
| Type | Description |
|---|---|
tuple | Tuple of (python_version, python_executable, virtual_env) |
get_package_versions¶
get_package_versions(key_packages: typing.Optional = None) -> dictGet versions of key packages used in the experiment.
Args: key_packages: Iterable of package names to check. If None, uses default list.
Returns:
| Type | Description |
|---|---|
dict | Dictionary mapping package names to their versions |
collect_environment_info¶
collect_environment_info(include_packages: bool = True, additional_packages: typing.Optional = None) -> minto.environment.EnvironmentInfoCollect comprehensive environment information.
Parameters:
| Name | Type | Description |
|---|---|---|
include_packages | bool | Whether to include package version information |
additional_packages | typing.Optional | Additional packages to check versions for |
Returns:
| Type | Description |
|---|---|
minto.environment.EnvironmentInfo | EnvironmentInfo object containing all collected information |
format_memory_size¶
format_memory_size(bytes_size: int) -> strFormat memory size in human-readable format.
Parameters:
| Name | Type | Description |
|---|---|---|
bytes_size | int | Size in bytes |
Returns:
| Type | Description |
|---|---|
str | Formatted string (e.g., “8.0 GB”) |
get_environment_summary¶
get_environment_summary(env_info: minto.environment.EnvironmentInfo) -> strGet a human-readable summary of environment information.
Parameters:
| Name | Type | Description |
|---|---|---|
env_info | minto.environment.EnvironmentInfo | EnvironmentInfo object |
Returns:
| Type | Description |
|---|---|
str | Formatted summary string |