init.py
Handles the configuration of our python modules
ConfigCompiler
Handles reading configs in the proper priorities.
Source code in lavlab/__init__.py
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | |
compile(**kwargs) staticmethod
Compiles the configuration from the default, system, and user configs.
Returns:
| Type | Description |
|---|---|
dict | dictionary containing the compiled configuration. |
Source code in lavlab/__init__.py
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 | |
load_default_config() staticmethod
Reads default.yaml from the package internals
Returns:
| Type | Description |
|---|---|
dict | default.yaml |
Source code in lavlab/__init__.py
454 455 456 457 458 459 460 461 462 463 464 465 | |
DependencyThreadConfiguration
Bases: Enum
Converts a module name into the environemental variable for controlling max cpu threads. Used for passing the module thread configurations into dependencies.
Source code in lavlab/__init__.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
is_module_imported(module_name) staticmethod
Checks if a given module is imported by the module's name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module_name | str | Name of the given module, ex. "pyvips". | required |
Returns:
| Type | Description |
|---|---|
bool | Bool representing whether the module has already been imported. |
Source code in lavlab/__init__.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
FileTypeEnum
Bases: Enum
Enum for file types and their MIME types.
Source code in lavlab/__init__.py
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 | |
get_mimetype(file_extension) staticmethod
Retrieve the MIME type based on the file extension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_extension | str | The extension of the file (including the period). | required |
Returns:
| Type | Description |
|---|---|
str | The MIME type of the file. Defaults to 'application/octet-stream' if unknown. |
Source code in lavlab/__init__.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
get_mimetype_from_path(file_path) staticmethod
Wrapper for get_mimetype, just splits the file extension off a path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path | str | Posix path. | required |
Returns:
| Type | Description |
|---|---|
str | Mimetype string from enum. |
Source code in lavlab/__init__.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
HistologyContext
Provides configuration options for histology tools and services
Source code in lavlab/__init__.py
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 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | |
fast_compression_options: dict property writable
Get the fast compression options.
service: dict property writable
Get the service.
service_provider property writable
Uses the ServiceProviderFactory to create a service provider based on the configuration.
Returns:
| Type | Description |
|---|---|
ServiceProvider | Implementation of the service provider. |
size_threshold: int property writable
Get the size threshold.
slow_compression_options: dict property writable
Get the slow compression options.
tiling_options: dict property writable
Get the tiling options.
use_fast_compression: bool property writable
Get the use fast compression flag.
get_compression_settings()
Get the compression settings.
Source code in lavlab/__init__.py
444 445 446 447 448 | |
ResourceContext
Controls resource utilization of child processes. Allows the configuration of CPU and memory limits. Ideally permeates to all dependencies for centralized configuration.
Source code in lavlab/__init__.py
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 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 | |
io_max_threads: int property writable
Amount of threads to spawn for IO requests. Useful for speeding up OMERO and XNAT requests.
io_pool: ThreadPoolExecutor property writable
Pool used for (mostly network) IO Mostly for internal stuff.
Returns:
| Type | Description |
|---|---|
ThreadPoolExecutor | Creates new threadpool if necessary |
max_cores: int property writable
Controls maximum cores to be used. Must not be greater than total cores or less than 1!
max_memory: int property writable
Controls max memory to be considered in bytes. Useful for exact limits on memory consumption when paired with memory_usage=1
max_temp_storage: int property writable
Amount of temporary storage to be used in bytes
memory_usage: float property writable
Controls ratio of max memory to use. Useful for using most of a systems memory. floating point 0-1
context_summary()
Summary of configurations used for logging.
Returns:
| Type | Description |
|---|---|
list of str | List of lines to log |
Source code in lavlab/__init__.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |
ServiceProviderFactory
Factory to dynamically load and create service providers based on registered entry points.
Source code in lavlab/__init__.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 | |
create_service_provider(service_name, **kwargs) staticmethod
Creates service provider based off registered entry points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
service_name | str | service name to create provider for. | required |
Returns:
| Type | Description |
|---|---|
ServiceProvider | Implementation of the service provider. |
Raises:
| Type | Description |
|---|---|
ValueError | Cannot find service provider for the given service name. |
Source code in lavlab/__init__.py
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 | |
log_installed_providers() staticmethod
Logs the installed service providers.
Source code in lavlab/__init__.py
66 67 68 69 | |
UtilContext
Provides the base for configuring the LavLab Python Utilities Expected to be extended through a child class, see LavLabContext
Source code in lavlab/__init__.py
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 | |
noninteractive property writable
Flag to indicate if the application should run in non-interactive mode.
temp_dir property writable
Directory for temporary files.
log_context_summary()
Log summary information about the hardware configurations in use.
Source code in lavlab/__init__.py
608 609 610 611 612 613 614 615 616 617 618 | |
assure_multiplication_string_is_int(string)
Converts a string with a multiplication operator into an integer.
Source code in lavlab/__init__.py
21 22 23 24 25 26 27 28 29 30 | |