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_interval: float = float("inf"),
max_keep_states: int = -1,
state_name_pattern: str = "*.state",
states_cleanup_interval: float = 60.0,
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] = ("localhost", 8319),
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_interval |
Interval in seconds between automatic state saves. Use infinity for no automatic saves.
TYPE:
|
max_keep_states |
Maximum number of state directories to keep in the states directory. Older state directories beyond this number will be automatically removed. Use -1 to disable this feature (no automatic removal).
TYPE:
|
state_name_pattern |
Glob pattern to identify state directories for management.
TYPE:
|
states_cleanup_interval |
Interval in seconds between automatic state cleanup.
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.
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]],
data: Mapping[str, DataBuffer[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:
|
data
|
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
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 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|