pipeline Module
The definition of an analysis Pipeline in Spyral
Pipeline
A representation of an analysis pipeline in Spyral
The Pipeline controls the analysis workflow. It is given a list of PhaseLike objects and paths to workspace and trace data and runs the data through the pipeline. It also requires a list of booleans of the same length as the list of PhaseLikes. Each bool in the list is a switch which turns on/off that Phase. If the Phase is off (False), it is assumed that any artifacts expected to be produced by that Phase have been made if requested.
The first Phase in the Pipeline should always expect to recieve AT-TPC trace data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
phases |
list[PhaseLike]
|
The Phases of the analysis pipeline |
required |
active |
list[bool]
|
A list of boolean switches of the same length as phases. Each switch controls the corresponding phase in the pipeline. |
required |
workspace_path |
Path
|
The path to the workspace (the place where Spyral will write data) |
required |
trace_path |
Path
|
The path to the AT-TPC trace data |
required |
Attributes:
Name | Type | Description |
---|---|---|
phases |
list[PhaseLike]
|
The Phases of the analysis pipeline |
active |
list[bool]
|
A list of boolean switches of the same length as phases. Each switch controls the corresponding phase in the pipeline. |
workspace |
Path
|
The path to the workspace (the place where Spyral will write data) |
traces |
Path
|
The path to the AT-TPC trace data |
Methods:
Name | Description |
---|---|
create_workspace |
Create the workspace and subdirectories |
create_assets |
Have each phase create any necessary assets. |
validate |
Validate the pipeline by comparing the schema of the phases. |
run |
Run the pipeline for a set of runs |
Source code in src/spyral/core/pipeline.py
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 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 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 |
|
create_assets()
Have each phase create any necessary assets.
Call each PhaseLike's create_assets function. This should be called before running the pipeline.
Returns:
Type | Description |
---|---|
bool
|
True if all phases were successful, False otherwise |
Source code in src/spyral/core/pipeline.py
create_shared_data(handles)
Have each phase create any shared memory
Call each PhaseLike's create_shared_data function. This should be called before running the pipeline.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
handles |
dict[str, SharedMemory]
|
An empty dictionary to be filled with handles of all created shared memory. The parent process will use these handles to do cleanup later. |
required |
Source code in src/spyral/core/pipeline.py
create_workspace()
Create the workspace and all child directories.
This should be called before running the pipeline.
Source code in src/spyral/core/pipeline.py
run(run_list, msg_queue, seed)
Run the pipeline for a set of runs
Each Phase is only run if it is active. Any artifact requested from an inactive Phase is expected to have already been created.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
run_list |
list[int]
|
List of run numbers to be processed |
required |
msg_queue |
SimpleQueue
|
A queue to transmit progress messages through |
required |
seed |
SeedSequence
|
A seed to initialize the pipeline random number generator |
required |
Source code in src/spyral/core/pipeline.py
validate()
Validate the pipeline by comparing the schema of the phases.
Compare the expected incoming schema of a phase to the expected outgoing schema of the previous phase. The only excption is the first phase, which should only ever expect to recieve AT-TPC trace data.
Any Phase which has it's schema set to None automatically passes validation.
Returns:
Type | Description |
---|---|
dict[str, bool]
|
A dictionary mapping phase name to validation success. |
Source code in src/spyral/core/pipeline.py
generate_assets(pipeline)
Function which will generate a Pipeline's assets
This can be used in lieu of the start_pipeline function if all you want to do is generate the required assets to run a pipeline. This is useful for cases where Spyral is run with a limited walltime to avoid the overhead of generating the assets within a job context.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pipeline |
Pipeline
|
The pipeline whose assets should be generated |
required |
Source code in src/spyral/core/pipeline.py
start_pipeline(pipeline, run_min, run_max, n_procs=1, disable_display=False, runs_to_skip=None)
Function from which a Pipeline should be run
Use this function to start running the Pipeline system. It will create a multiprocessed version of the pipeline and run a balanced load across the processes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pipeline |
Pipeline
|
The pipeline to be run |
required |
run_min |
int
|
The minimum run number (inclusive) |
required |
run_max |
int
|
The maximum run number (inclusive) |
required |
n_procs |
int
|
The number of parallel processes |
1
|
disable_display |
bool
|
Option to turn off terminal display. Default is False, i.e. terminal interface will be displayed. |
False
|
runs_to_skip |
list[int] | None
|
Option to specifiy a list of run numbers to skip. These runs should be within the range run_min, run_max. By default, no runs are skipped. |
None
|
Source code in src/spyral/core/pipeline.py
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 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|