Typo execution¶
execution ¶
Execute typo-generation tasks serially or with a spawned process pool.
execute_typo_generation_tasks ¶
execute_typo_generation_tasks(
word_list: Sequence[str],
tasks: Sequence[TypoGenerationTask],
config: TypoGenerationConfig,
*,
n_workers: int | None = None,
logger: Logger | None = None,
) -> list[RawTypoSample]
Execute all typo-generation tasks and collect their raw samples.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
word_list
|
Sequence[str]
|
Shared source words considered by every task. |
required |
tasks
|
Sequence[TypoGenerationTask]
|
Ordered typo-generation tasks to execute. |
required |
config
|
TypoGenerationConfig
|
Shared generator configuration. |
required |
n_workers
|
int | None
|
Requested process-pool size, or |
None
|
logger
|
Logger | None
|
Optional orchestration logger. |
None
|
Returns:
| Type | Description |
|---|---|
list[RawTypoSample]
|
Concatenated raw samples in input task order. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
ValueError
|
If no tasks are supplied or |
RuntimeError
|
If a parallel generation task fails. |
Source code in hotstring\typo_generation\execution.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
_execute_tasks_serial ¶
_execute_tasks_serial(
word_list: list[str],
tasks: tuple[TypoGenerationTask, ...],
config: TypoGenerationConfig,
*,
logger: Logger | None,
) -> list[RawTypoSample]
Execute every task in the current process.
Source code in hotstring\typo_generation\execution.py
82 83 84 85 86 87 88 89 90 91 92 93 | |
_execute_tasks_parallel ¶
_execute_tasks_parallel(
word_list: list[str],
tasks: tuple[TypoGenerationTask, ...],
config: TypoGenerationConfig,
*,
n_workers: int | None,
logger: Logger | None,
) -> list[RawTypoSample]
Execute tasks with a spawned process pool.
Source code in hotstring\typo_generation\execution.py
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 | |
_multi_worker_typo_generation ¶
_multi_worker_typo_generation(
word_list: list[str],
tasks: tuple[TypoGenerationTask, ...],
config: TypoGenerationConfig,
*,
n_workers: int | None,
mp_context: BaseContext,
proxy_queue: Any | None,
root_level: int,
manager_logger_name: str,
) -> list[RawTypoSample]
Submit every generation task to a process pool and collect results.
Source code in hotstring\typo_generation\execution.py
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 | |
_worker_logger_initialization ¶
_worker_logger_initialization(
root_level: int,
proxy_queue: Any | None,
manager_logger_name: str | None,
) -> None
Initialize logging inside one spawned worker process.
Source code in hotstring\typo_generation\execution.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
_initialize_worker ¶
_initialize_worker(
root_level: int,
proxy_queue: Any | None = None,
manager_logger_name: str | None = None,
) -> None
Initialize process-global state inside a spawned worker process.
Source code in hotstring\typo_generation\execution.py
199 200 201 202 203 204 205 | |
_generate_task_in_worker ¶
_generate_task_in_worker(
word_list: list[str],
task: TypoGenerationTask,
config: TypoGenerationConfig,
) -> list[RawTypoSample]
Execute one task inside a process-pool worker.
Source code in hotstring\typo_generation\execution.py
208 209 210 211 212 213 214 | |
_normalize_tasks ¶
_normalize_tasks(
tasks: Sequence[TypoGenerationTask],
) -> tuple[TypoGenerationTask, ...]
Validate and freeze the task sequence for one execution run.
Source code in hotstring\typo_generation\execution.py
217 218 219 220 221 222 223 224 225 226 227 | |
_validate_worker_count ¶
_validate_worker_count(n_workers: int | None) -> None
Validate an optional process-pool worker count.
Source code in hotstring\typo_generation\execution.py
230 231 232 233 234 235 236 237 | |