Launch
pamiq_core.launcher.LaunchConfig
dataclass
¶
LaunchConfig(
states_dir: str | Path = Path("./states"),
state_name_format: str = "%Y-%m-%d_%H-%M-%S,%f.state",
saved_state_path: str | Path | None = None,
save_state_condition: Callable[[], bool] | None = None,
states_keeper: StatesKeeper | None = None,
timeout_for_all_threads_pause: float = 60.0,
max_attempts_to_pause_all_threads: int = 3,
max_uptime: float = float("inf"),
web_api_address: tuple[str, int] | None = ("localhost", 8391),
web_api_command_queue_size: int = 1,
log_tick_time_statistics_interval: float = 60.0,
time_scale: float = 1.0,
)
Configuration parameters for system launch.
This class encapsulates all configuration parameters needed to launch the AMI system. It controls thread behavior, state persistence, API settings, timing, and other critical system parameters.
ATTRIBUTE | DESCRIPTION |
---|---|
states_dir |
Directory path where states will be saved.
TYPE:
|
state_name_format |
Format string for state directory names.
TYPE:
|
saved_state_path |
Optional path to a previously saved state to load at startup.
TYPE:
|
save_state_condition |
Optional callable that returns True when state should be saved. If None, state will never be saved automatically.
TYPE:
|
states_keeper |
Optional StatesKeeper instance for managing saved state retention. If None, no automatic state cleanup will be performed.
TYPE:
|
timeout_for_all_threads_pause |
Maximum time in seconds to wait for all threads to pause before timing out.
TYPE:
|
max_attempts_to_pause_all_threads |
Maximum number of retry attempts when pausing threads fails.
TYPE:
|
max_uptime |
Maximum time in seconds the system is allowed to run. Use infinity for no time limit.
TYPE:
|
web_api_address |
Tuple of (host, port) for the web API server. If None, the web API server will be disabled.
TYPE:
|
web_api_command_queue_size |
Maximum size of the command queue for the web API.
TYPE:
|
log_tick_time_statistics_interval |
Interval in seconds for logging step time statistics in inference thread.
TYPE:
|
time_scale |
Scale factor for system time, affecting the speed of time passage.
TYPE:
|
pamiq_core.launcher.launch ¶
launch(
interaction: Interaction[Any, Any],
models: Mapping[str, TrainingModel[Any]],
buffers: Mapping[str, DataBuffer[Any, Any]],
trainers: Mapping[str, Trainer],
config: Mapping[str, Any] | LaunchConfig | None = None,
) -> None
Launch the AMI system with specified components and configuration.
This function is the main entry point for starting the AMI system. It initializes and connects all system components, sets up the multi-threading architecture, and starts the control, inference, and training threads.
The function will run until the system is shut down or interrupted. Once complete, it will save the final system state before exiting.
PARAMETER | DESCRIPTION |
---|---|
interaction
|
Agent-environment interaction procedure.
TYPE:
|
models
|
Dictionary mapping names to training models.
TYPE:
|
buffers
|
Dictionary mapping names to data buffers.
TYPE:
|
trainers
|
Dictionary mapping names to trainers.
TYPE:
|
config
|
Configuration parameters, either as a LaunchConfig instance or a dictionary of parameter values. If None, default configuration is used.
TYPE:
|
Source code in src/pamiq_core/launcher.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
|