Batch¶
A batch is the work done inside one framework: which genes are surveyed on which charts, with which run parameters. The framework decides where the charts are, and the batch decides what is looked for and how hard. A batch and its framework are two files, or one file with the framework written inline, and one parser reads both. A batch that names its framework by path can run beside other batches on the same coordinates.
Batch holds the work. Batch.resolve_framework reads the framework the
batch names, Batch.validate checks that every unit of work names a chart and
genes that exist, and Batch.tasks gives one SurveyTask per gene per chart.
A WorkSpec names the genes to survey on one chart. A gene need not be an
anchor of the chart it is surveyed on.
A SurveyTask is the unit of work: one gene on one chart. SurveyTask.key
is the content digest of the unit, and SurveyTask.continues is true when the
task continues an illumination that a survey file already records.
SurveyRun runs the tasks of a batch.
Batch
dataclass
¶
Work to do inside one framework.
Attributes:
| Name | Type | Description |
|---|---|---|
framework |
FrameworkSpec or str
|
The coordinate system, written inline or named by path. A path is resolved relative to the batch file it was read from. |
label |
str
|
A name for the run this batch produces, which the survey file uses to make its group readable. |
work |
list of WorkSpec
|
Which genes go on which chart. |
params |
dict
|
Overrides for :class: |
gpu_params |
dict
|
Overrides for :class: |
Source code in src/hifuku/batch.py
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 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | |
resolve_framework
¶
The framework this batch runs in, read from its file if named.
Source code in src/hifuku/batch.py
validate
¶
Check that every work unit names a chart and genes that exist.
framework is a :class:~hifuku.framework.FrameworkSpec or a built
:class:~hifuku.framework.Framework, and defaults to the spec this
batch names. Reading the spec is cheap and building it is not, so a
caller that has already built one passes it rather than paying twice.
Source code in src/hifuku/batch.py
tasks
¶
One work unit per gene per chart, each keyed to this framework.
The parameters are resolved without any backend's capability defaults, so a task digest records the question and not the machine. The backend still resolves the parameters the survey executes with, and that resolution does not reach this key.
survey is the project file a work unit's resume is looked up in.
A unit that names a run to continue needs it; a batch that continues
nothing does not, which is why it is optional.
Source code in src/hifuku/batch.py
from_toml
classmethod
¶
Read a batch file.
The file holds label, either a framework path or an inline
framework, one [[work]] table per chart, and optional [params]
and [gpu] tables.
Source code in src/hifuku/batch.py
to_toml
¶
Write the batch file that :meth:from_toml reads.
Source code in src/hifuku/batch.py
WorkSpec
dataclass
¶
The genes to survey on one chart of the framework.
resume names a run already in the project file, and every gene of this
unit then continues that run's illumination of it rather than starting from
nothing. A gene the named run does not hold is an error rather than a
silent fresh start, because a batch that meant to continue and quietly did
not would be indistinguishable from one that meant to start.
The parent is part of what a task asks for, so it enters the task digest. Resuming therefore has to be written in the batch, where the question is posed, rather than passed at execution: by the time a run executes, what it asked has already been hashed.
Source code in src/hifuku/batch.py
SurveyTask
dataclass
¶
One gene surveyed on one chart: the unit of work.
The task holds a chart index, a gene label and a digest. Every field is a string or an integer, so the task round-trips through JSON and travels to another host as data.
digest covers the framework, the chart's anchors and their alignment
digests, the gene and its digest, the model, the metric weight, and the run
parameters that decide what the survey is looking for. It leaves out the
parameters each backend sets for itself, so one batch keeps one identity
wherever it runs. A caller resumes with
if task.key() in done: continue.