tui
Terminal User Interface for Snakemake workflow monitoring (Textual).
This package provides a Textual-based TUI for monitoring Snakemake workflows.
The main entry point is SnakeseeApp, which is also exported as
WorkflowMonitorTUI for backward compatibility with existing callers.
Module structure: - app.py: SnakeseeApp (the main Textual application) and bindings/reactives - data_source.py: WorkflowDataSource (pure-data layer: polling, estimator, event/log readers, filter/sort helpers, log tail, tool-progress cache) - renderables.py: Rich renderables (header, progress, summary, help, easter egg) - tables.py: DataTable row builders and sort helpers - screens.py: Modal screens (HelpScreen, EasterEggScreen, JobLogScreen) - accessibility.py: Visual encoding configs for colorblind users
Classes¶
AccessibilityConfig
dataclass
¶
Visual encoding configuration for progress bar rendering.
Controls which characters are used for each segment of the progress bar and whether the legend is always displayed.
Attributes:
| Name | Type | Description |
|---|---|---|
succeeded |
BarStyle
|
Style for completed/succeeded jobs. |
failed |
BarStyle
|
Style for failed jobs. |
running |
BarStyle
|
Style for currently running jobs. |
remaining |
BarStyle
|
Style for remaining/pending jobs. |
incomplete |
BarStyle
|
Style for incomplete jobs (workflow interrupted). |
show_legend |
bool
|
If True, always show the legend (not just on failure). |
Source code in snakesee/tui/accessibility.py
LayoutMode ¶
SnakeseeApp ¶
Bases: App[None]
Textual application for monitoring Snakemake workflows.
Source code in snakesee/tui/app.py
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 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 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 449 450 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 588 589 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 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 | |
Attributes¶
last_poll
property
¶
last_poll: tuple[WorkflowProgress, TimeEstimate | None] | None
The most recent (progress, estimate) snapshot taken by the refresh cycle.
Read-only accessor for external tooling (e.g. the docs screenshot generator) so it does not have to reach into the private attribute. Returns None until the first refresh has polled the data source.
Methods:¶
__init__ ¶
__init__(workflow_dir: Path, refresh_rate: float = DEFAULT_REFRESH_RATE, use_estimation: bool = True, profile_path: Path | None = None, use_wildcard_conditioning: bool = True, weighting_strategy: WeightingStrategy = 'index', half_life_logs: int = 10, half_life_days: float = 7.0, accessibility_config: AccessibilityConfig | None = None) -> None
Initialize the SnakeseeApp.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workflow_dir
|
Path
|
Path to workflow directory containing |
required |
refresh_rate
|
float
|
Refresh interval in seconds. |
DEFAULT_REFRESH_RATE
|
use_estimation
|
bool
|
Whether to enable time estimation. |
True
|
profile_path
|
Path | None
|
Optional path to a timing profile for bootstrapping estimates. |
None
|
use_wildcard_conditioning
|
bool
|
Whether to enable wildcard-conditioned estimates. |
True
|
weighting_strategy
|
WeightingStrategy
|
Strategy for weighting historical data ("index" or "time"). |
'index'
|
half_life_logs
|
int
|
Half-life in run count for index-based weighting. |
10
|
half_life_days
|
float
|
Half-life in days for time-based weighting. |
7.0
|
accessibility_config
|
AccessibilityConfig | None
|
Optional accessibility configuration override. |
None
|
Source code in snakesee/tui/app.py
action_clear_filter ¶
Hide the filter Input if focused, otherwise clear the filter and return to latest log.
Source code in snakesee/tui/app.py
action_cycle_layout ¶
action_cycle_sort_back ¶
action_cycle_sort_forward ¶
action_easter_complete ¶
Push the EasterEggScreen if the f-then-g chord finished within the window.
Source code in snakesee/tui/app.py
action_easter_pending ¶
Start (or restart) the 2-second window for completing the f-then-g easter egg.
Source code in snakesee/tui/app.py
action_force_refresh ¶
action_hard_refresh ¶
action_log_newer ¶
Navigate to a newer log file by step entries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
int
|
Number of log entries to step forward (toward newer logs). |
required |
action_log_older ¶
Navigate to an older log file by step entries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
int
|
Number of log entries to step backward (toward older logs). |
required |
Source code in snakesee/tui/app.py
action_next_match ¶
action_open_filter ¶
Reveal the filter Input widget and focus it for keyboard entry.
action_prev_match ¶
action_rate_dec ¶
Decrease the refresh rate by delta seconds, clamped to MIN_REFRESH_RATE.
action_rate_inc ¶
Increase the refresh rate by delta seconds, clamped to MAX_REFRESH_RATE.
action_rate_min ¶
action_rate_reset ¶
action_show_help ¶
action_sort_column ¶
Set the sort column for the active sort target, or toggle direction if same column.
Columns are 0-indexed. Each table enforces its own maximum: running and stats support columns 0-3; completions 0-2; pending 0-1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
col
|
int
|
Zero-based column index to sort by. |
required |
Source code in snakesee/tui/app.py
action_toggle_accessibility ¶
Toggle accessibility mode, updating the accessibility config and refreshing panels.
Toggling off restores the constructor-supplied config (which may be a
custom override), not necessarily DEFAULT_CONFIG.
Source code in snakesee/tui/app.py
action_toggle_estimation ¶
Toggle time estimation and re-initialize the estimator in a worker thread.
Source code in snakesee/tui/app.py
action_toggle_pause ¶
Toggle the paused state of the monitor and repaint immediately.
The repaint bypasses the pause guard so the header's PAUSED indicator updates right away instead of waiting for the next interval tick.
Source code in snakesee/tui/app.py
action_toggle_wildcard ¶
Toggle wildcard conditioning and re-initialize the estimator in a worker thread.
Source code in snakesee/tui/app.py
compose ¶
Compose the widget tree (header / progress / six tables / summary / footer).
Source code in snakesee/tui/app.py
on_data_table_row_selected ¶
Open the JobLogScreen for the selected job in the running/completions tables.
Source code in snakesee/tui/app.py
on_input_submitted ¶
Apply the submitted filter text and hide the Input again.
Source code in snakesee/tui/app.py
on_mount ¶
Configure tables, populate panels, and start the refresh timer.
Source code in snakesee/tui/app.py
watch_current_log_index ¶
Sync the log index to the data source and refresh panels when it changes.
Log navigation only comes from user keystrokes, so the redraw bypasses the pause guard.
Source code in snakesee/tui/app.py
watch_filter_text ¶
Re-populate all panels when the filter text changes.
Filter changes only come from user keystrokes, so the redraw bypasses the pause guard.
Source code in snakesee/tui/app.py
watch_layout_mode ¶
watch_layout_mode(old: LayoutMode, new: LayoutMode) -> None
Swap the CSS class on the root when the layout mode changes.
watch_refresh_rate ¶
Restart the polling timer when the refresh rate changes.
Source code in snakesee/tui/app.py
Modules¶
accessibility ¶
Accessibility configuration for colorblind-friendly rendering.
Provides alternative visual encodings so that progress bar status can be distinguished without relying on color perception alone.
Classes¶
AccessibilityConfig
dataclass
¶
Visual encoding configuration for progress bar rendering.
Controls which characters are used for each segment of the progress bar and whether the legend is always displayed.
Attributes:
| Name | Type | Description |
|---|---|---|
succeeded |
BarStyle
|
Style for completed/succeeded jobs. |
failed |
BarStyle
|
Style for failed jobs. |
running |
BarStyle
|
Style for currently running jobs. |
remaining |
BarStyle
|
Style for remaining/pending jobs. |
incomplete |
BarStyle
|
Style for incomplete jobs (workflow interrupted). |
show_legend |
bool
|
If True, always show the legend (not just on failure). |
Source code in snakesee/tui/accessibility.py
BarStyle
dataclass
¶
Character and label for a single progress bar segment.
Attributes:
| Name | Type | Description |
|---|---|---|
char |
str
|
The character used to fill the segment. |
label |
str
|
Human-readable label for the legend. |
Source code in snakesee/tui/accessibility.py
app ¶
Textual App for snakesee TUI.
Classes¶
LayoutMode ¶
SnakeseeApp ¶
Bases: App[None]
Textual application for monitoring Snakemake workflows.
Source code in snakesee/tui/app.py
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 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 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 449 450 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 588 589 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 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 | |
Attributes¶
property
¶last_poll: tuple[WorkflowProgress, TimeEstimate | None] | None
The most recent (progress, estimate) snapshot taken by the refresh cycle.
Read-only accessor for external tooling (e.g. the docs screenshot generator) so it does not have to reach into the private attribute. Returns None until the first refresh has polled the data source.
Methods:¶
__init__(workflow_dir: Path, refresh_rate: float = DEFAULT_REFRESH_RATE, use_estimation: bool = True, profile_path: Path | None = None, use_wildcard_conditioning: bool = True, weighting_strategy: WeightingStrategy = 'index', half_life_logs: int = 10, half_life_days: float = 7.0, accessibility_config: AccessibilityConfig | None = None) -> None
Initialize the SnakeseeApp.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workflow_dir
|
Path
|
Path to workflow directory containing |
required |
refresh_rate
|
float
|
Refresh interval in seconds. |
DEFAULT_REFRESH_RATE
|
use_estimation
|
bool
|
Whether to enable time estimation. |
True
|
profile_path
|
Path | None
|
Optional path to a timing profile for bootstrapping estimates. |
None
|
use_wildcard_conditioning
|
bool
|
Whether to enable wildcard-conditioned estimates. |
True
|
weighting_strategy
|
WeightingStrategy
|
Strategy for weighting historical data ("index" or "time"). |
'index'
|
half_life_logs
|
int
|
Half-life in run count for index-based weighting. |
10
|
half_life_days
|
float
|
Half-life in days for time-based weighting. |
7.0
|
accessibility_config
|
AccessibilityConfig | None
|
Optional accessibility configuration override. |
None
|
Source code in snakesee/tui/app.py
Hide the filter Input if focused, otherwise clear the filter and return to latest log.
Source code in snakesee/tui/app.py
Push the EasterEggScreen if the f-then-g chord finished within the window.
Source code in snakesee/tui/app.py
Start (or restart) the 2-second window for completing the f-then-g easter egg.
Source code in snakesee/tui/app.py
Navigate to a newer log file by step entries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
int
|
Number of log entries to step forward (toward newer logs). |
required |
Navigate to an older log file by step entries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
int
|
Number of log entries to step backward (toward older logs). |
required |
Source code in snakesee/tui/app.py
Reveal the filter Input widget and focus it for keyboard entry.
Decrease the refresh rate by delta seconds, clamped to MIN_REFRESH_RATE.
Increase the refresh rate by delta seconds, clamped to MAX_REFRESH_RATE.
Set the sort column for the active sort target, or toggle direction if same column.
Columns are 0-indexed. Each table enforces its own maximum: running and stats support columns 0-3; completions 0-2; pending 0-1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
col
|
int
|
Zero-based column index to sort by. |
required |
Source code in snakesee/tui/app.py
Toggle accessibility mode, updating the accessibility config and refreshing panels.
Toggling off restores the constructor-supplied config (which may be a
custom override), not necessarily DEFAULT_CONFIG.
Source code in snakesee/tui/app.py
Toggle time estimation and re-initialize the estimator in a worker thread.
Source code in snakesee/tui/app.py
Toggle the paused state of the monitor and repaint immediately.
The repaint bypasses the pause guard so the header's PAUSED indicator updates right away instead of waiting for the next interval tick.
Source code in snakesee/tui/app.py
Toggle wildcard conditioning and re-initialize the estimator in a worker thread.
Source code in snakesee/tui/app.py
Compose the widget tree (header / progress / six tables / summary / footer).
Source code in snakesee/tui/app.py
Open the JobLogScreen for the selected job in the running/completions tables.
Source code in snakesee/tui/app.py
Apply the submitted filter text and hide the Input again.
Source code in snakesee/tui/app.py
Configure tables, populate panels, and start the refresh timer.
Source code in snakesee/tui/app.py
Sync the log index to the data source and refresh panels when it changes.
Log navigation only comes from user keystrokes, so the redraw bypasses the pause guard.
Source code in snakesee/tui/app.py
Re-populate all panels when the filter text changes.
Filter changes only come from user keystrokes, so the redraw bypasses the pause guard.
Source code in snakesee/tui/app.py
watch_layout_mode(old: LayoutMode, new: LayoutMode) -> None
Swap the CSS class on the root when the layout mode changes.
Restart the polling timer when the refresh rate changes.
Source code in snakesee/tui/app.py
SortTable ¶
Bases: StrEnum
Sortable DataTable identifiers; values match the widget IDs in compose().
Source code in snakesee/tui/app.py
Functions:¶
data_source ¶
Workflow data source: pure-data layer for the snakesee TUI.
This module contains :class:WorkflowDataSource, which owns the non-presentation
state of the TUI: polling, estimator initialization, event/log readers, event
handlers, filter/sort helpers, log tail caching, and tool-progress caching.
:class:snakesee.tui.app.SnakeseeApp composes a WorkflowDataSource
and delegates data-layer calls to it.
Classes¶
WorkflowDataSource ¶
Pure data layer for snakesee TUI.
Owns polling, estimator state, event/log readers, event handlers, filter/sort
helpers, log tail caching, and tool-progress caching. Rendering and input
handling live in :class:snakesee.tui.app.SnakeseeApp.
Source code in snakesee/tui/data_source.py
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 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 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 449 450 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 588 589 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 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 | |
Attributes¶
property
¶Number of historical log files currently discovered.
property
writable
¶Index into available_logs; 0 = most recent.
property
¶event_reader: EventReader | None
Event reader for the current workflow run, if any.
property
writable
¶Whether wildcard-conditioned estimates are enabled.
Methods:¶
__init__(workflow_dir: Path, refresh_rate: float = DEFAULT_REFRESH_RATE, use_estimation: bool = True, profile_path: Path | None = None, use_wildcard_conditioning: bool = True, weighting_strategy: WeightingStrategy = 'index', half_life_logs: int = 10, half_life_days: float = 7.0) -> None
Initialize the data source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workflow_dir
|
Path
|
Path to workflow directory containing |
required |
refresh_rate
|
float
|
Refresh interval in seconds (used to size cache TTL). |
DEFAULT_REFRESH_RATE
|
use_estimation
|
bool
|
Whether to enable time estimation. |
True
|
profile_path
|
Path | None
|
Optional path to a timing profile for bootstrapping estimates. |
None
|
use_wildcard_conditioning
|
bool
|
Whether to enable wildcard-conditioned estimates. |
True
|
weighting_strategy
|
WeightingStrategy
|
Strategy for weighting historical data ("index" or "time"). |
'index'
|
half_life_logs
|
int
|
Half-life in run count for index-based weighting. |
10
|
half_life_days
|
float
|
Half-life in days for time-based weighting. |
7.0
|
Source code in snakesee/tui/data_source.py
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 | |
apply_events_to_progress(progress: WorkflowProgress, events: list[SnakeseeEvent]) -> WorkflowProgress
Apply event updates to enhance progress accuracy.
Events from the logger plugin provide more accurate timing and
status information than log parsing. For remote executors this also
populates queued_jobs_list (jobs awaiting a node) and keeps those
jobs out of running_jobs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
progress
|
WorkflowProgress
|
The current workflow progress from parsing. |
required |
events
|
list[SnakeseeEvent]
|
New events from the logger plugin. |
required |
Returns:
| Type | Description |
|---|---|
WorkflowProgress
|
Updated WorkflowProgress with event data applied. |
Source code in snakesee/tui/data_source.py
936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 | |
build_running_job_data(jobs: list[JobInfo]) -> list[tuple[JobInfo, float | None, float | None, float | None, ToolProgress | None]]
Build per-job tuples of (job, elapsed, remaining, start_time, tool_progress).
Source code in snakesee/tui/data_source.py
Remove expired entries from tool progress cache.
Should be called periodically to prevent unbounded memory growth in long-running workflows.
Source code in snakesee/tui/data_source.py
Filter jobs by rule name if filter is active.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
jobs
|
Sequence[JobInfo]
|
Jobs to filter. |
required |
filter_text
|
str | None
|
Text to filter by (case-insensitive substring match). |
required |
Returns:
| Type | Description |
|---|---|
list[JobInfo]
|
Filtered list of jobs (all jobs if filter_text is empty). |
Source code in snakesee/tui/data_source.py
get_completions_list(progress: WorkflowProgress, *, filter_text: str | None, sort_table: SortTableName | None, sort_column: int, sort_ascending: bool) -> tuple[list[JobInfo], set[int]]
Get merged list of completed and failed jobs with same order as table.
Applies the same filtering and sorting as _make_completions_table() to
ensure the selected index matches between the table display and log panel.
Returns:
| Type | Description |
|---|---|
tuple[list[JobInfo], set[int]]
|
Tuple of (jobs_list, failed_job_ids_set). |
Source code in snakesee/tui/data_source.py
get_completions_sorted(progress: WorkflowProgress, *, filter_text: str | None, sort_table: SortTableName | None, sort_column: int, sort_ascending: bool, limit: int | None = None) -> tuple[list[JobInfo], set[int], list[str]]
Get merged, filtered, and sorted completions + failed jobs.
When limit is provided and no selection mode is active, uses
:func:heapq for O(n * log(limit)) top-N selection instead of a
full O(n * log(n)) sort.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
progress
|
WorkflowProgress
|
Current workflow progress. |
required |
filter_text
|
str | None
|
Optional filter text (case-insensitive substring match on rule name). |
required |
sort_table
|
SortTableName | None
|
Currently sorted table name (only "completions" triggers custom sort). |
required |
sort_column
|
int
|
0-indexed column to sort by when |
required |
sort_ascending
|
bool
|
Sort direction when sorting. |
required |
limit
|
int | None
|
If set, return at most this many items using heap selection. When None, returns the full sorted list. |
None
|
Returns:
| Type | Description |
|---|---|
list[JobInfo]
|
Tuple of (sorted jobs list, set of failed job ids, list of unique rule names |
set[int]
|
for filter navigation). |
Source code in snakesee/tui/data_source.py
1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 | |
Get the currently selected log file.
Source code in snakesee/tui/data_source.py
Get the cutoff time for filtering (when the next log started).
Source code in snakesee/tui/data_source.py
get_filtered_stats() -> list[RuleTimingStats]
Get rule stats filtered by cutoff time if viewing historical log.
Source code in snakesee/tui/data_source.py
get_inferred_pending_rules(progress: WorkflowProgress) -> dict[str, int] | None
Get inferred pending rules from completions and historical data.
Source code in snakesee/tui/data_source.py
get_running_jobs_list(progress: WorkflowProgress, *, filter_text: str | None, sort_table: SortTableName | None, sort_column: int, sort_ascending: bool) -> list[JobInfo]
Get running jobs list with same order as table.
Applies the same filtering and sorting as _make_running_table() to
ensure the selected index matches between the table display and log panel.
Returns:
| Type | Description |
|---|---|
list[JobInfo]
|
List of running jobs in display order. |
Source code in snakesee/tui/data_source.py
get_tool_progress(job: JobInfo) -> ToolProgress | None
Get tool-specific progress for a running job.
Results are cached for the TTL duration to avoid parsing job logs on every refresh cycle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job
|
JobInfo
|
The running job to check. |
required |
Returns:
| Type | Description |
|---|---|
ToolProgress | None
|
ToolProgress if parseable, None otherwise. |
Source code in snakesee/tui/data_source.py
Initialize or reinitialize the time estimator.
At startup the load can take many seconds and the user needs feedback before the App's compose() returns, so a transient Rich progress spinner is rendered directly to the terminal. This is a pragmatic exception to the data source being otherwise rendering-agnostic.
At runtime (re-init triggered by a key press while the Textual UI is
live), rendering Rich output would corrupt the display, so callers pass
show_progress=False to load silently.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
show_progress
|
bool
|
Render a transient Rich progress spinner during load. Set False when the Textual UI is already running. |
True
|
Source code in snakesee/tui/data_source.py
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 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 | |
Initialize the event reader if event file exists and is current.
The events file is validated against the current log file's start time to ensure we don't use stale events from a previous workflow run.
Source code in snakesee/tui/data_source.py
Initialize the incremental log reader.
Creates a reader for the current log file, enabling efficient incremental parsing instead of re-reading the entire file on each poll.
Source code in snakesee/tui/data_source.py
Initialize validation if event file exists.
Validation is automatically enabled when the logger plugin's event file is detected, allowing comparison between event-based and parsed state to find bugs in either approach.
Source code in snakesee/tui/data_source.py
poll_state() -> tuple[WorkflowProgress, TimeEstimate | None]
Poll the current workflow state and estimate.
For the latest run (current_log_index == 0) we merge live events and
the in-memory JobRegistry into the parsed log to enrich timing and
catch jobs the parser missed. For historical runs we deliberately skip
all of that — events and the registry describe the current run and
would otherwise leak into older log views.
Returns:
| Type | Description |
|---|---|
tuple[WorkflowProgress, TimeEstimate | None]
|
Tuple of (workflow progress, optional time estimate). |
Source code in snakesee/tui/data_source.py
1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 | |
Read the last N lines of a log file efficiently.
For large files, seeks near the end instead of reading the entire file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_path
|
Path
|
Path to the log file. |
required |
max_lines
|
int
|
Maximum number of lines to read. |
500
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of lines (most recent at end). |
Source code in snakesee/tui/data_source.py
read_new_events() -> list[SnakeseeEvent]
Read new events from the event file if available.
Returns:
| Type | Description |
|---|---|
list[SnakeseeEvent]
|
List of new events, or empty list if no events or event reading disabled. |
Source code in snakesee/tui/data_source.py
Refresh the list of available log files.
Source code in snakesee/tui/data_source.py
thread_stats_dict() -> dict[str, ThreadTimingStats]
Update tool progress cache TTL based on current refresh rate.
Called when refresh_rate changes to keep cache behavior in sync.
Source code in snakesee/tui/data_source.py
validate_state(events: list[SnakeseeEvent], parsed: WorkflowProgress) -> None
Compare event-based state with parsed state and log discrepancies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
events
|
list[SnakeseeEvent]
|
New events to process. |
required |
parsed
|
WorkflowProgress
|
Current parsed workflow progress. |
required |
Source code in snakesee/tui/data_source.py
Functions:¶
renderables ¶
Rich renderables (header, progress bar, progress panel, summary, help, easter egg).
Classes¶
Functions:¶
format_cost ¶
make_easter_egg ¶
Create the Fulcrum Genomics easter egg renderable.
Renders the bundled logo (snakesee/assets/logo.png, rasterized from the
upstream SVG with a flat dark background) into the terminal at the given
size using rich-pixels' half-block characters. Falls back to a text logo if
the image is missing or unreadable.
The image is downscaled directly to the target rich-pixels render size with bilinear resampling — bilinear blurs slightly more than LANCZOS, but the softer edges read better through 1px-wide half-block cells.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
console_width
|
int
|
Width of the terminal console in characters. |
80
|
console_height
|
int
|
Height of the terminal console in lines. |
24
|
Returns:
| Type | Description |
|---|---|
RenderableType
|
A Rich renderable (Group of centered pixels + dismiss hint) displaying |
RenderableType
|
the Fulcrum Genomics logo, or a text fallback. |
Source code in snakesee/tui/renderables.py
make_header ¶
make_header(progress: WorkflowProgress, workflow_path: str, paused: bool, event_reader: EventReader | None, max_path_len: int = 60) -> Panel
Create the header panel with workflow path and status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
progress
|
WorkflowProgress
|
Current workflow progress snapshot. |
required |
workflow_path
|
str
|
Resolved absolute path to the monitored workflow directory.
Resolving once at the call site keeps the per-frame cost to a string
truncation rather than a filesystem |
required |
paused
|
bool
|
Whether auto-refresh is currently paused. |
required |
event_reader
|
EventReader | None
|
Active event reader if using event-based monitoring, else None. |
required |
max_path_len
|
int
|
Maximum characters to spend on the path before middle-truncating, so a long path can't crowd out the status fields. |
60
|
Returns:
| Type | Description |
|---|---|
Panel
|
A Rich Panel containing the header text. |
Source code in snakesee/tui/renderables.py
make_help ¶
Create the help overlay panel.
Returns:
| Type | Description |
|---|---|
Panel
|
A Rich Panel containing the keyboard shortcut reference. |
Source code in snakesee/tui/renderables.py
make_progress_bar ¶
make_progress_bar(progress: WorkflowProgress, width: int, accessibility: AccessibilityConfig) -> Text
Create a colored progress bar showing succeeded/failed/in-flight/pending portions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
progress
|
WorkflowProgress
|
Current workflow progress snapshot. |
required |
width
|
int
|
Total character width of the bar. |
required |
accessibility
|
AccessibilityConfig
|
Visual encoding config controlling bar characters. |
required |
Returns:
| Type | Description |
|---|---|
Text
|
A Rich Text object representing the progress bar. |
Source code in snakesee/tui/renderables.py
make_progress_panel ¶
make_progress_panel(progress: WorkflowProgress, estimate: TimeEstimate | None, use_estimation: bool, accessibility: AccessibilityConfig, console_width: int = 80) -> Panel
Create the progress bar panel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
progress
|
WorkflowProgress
|
Current workflow progress snapshot. |
required |
estimate
|
TimeEstimate | None
|
Time estimate from the estimator, or None if unavailable. |
required |
use_estimation
|
bool
|
Whether time estimation is enabled. |
required |
accessibility
|
AccessibilityConfig
|
Visual encoding config for the progress bar. |
required |
console_width
|
int
|
Width of the terminal console in characters. |
80
|
Returns:
| Type | Description |
|---|---|
Panel
|
A Rich Panel containing the progress bar, ETA, and legend. |
Source code in snakesee/tui/renderables.py
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 414 415 416 417 | |
make_remote_job_info ¶
make_remote_job_info(job: JobInfo) -> list[Text]
Build display lines describing a remote job's external identifier and links.
For a job that ran on a remote executor (e.g. AWS Batch), this surfaces the external job id and, when enough information is available, deep links to the AWS console and CloudWatch logs. It degrades gracefully: a bare job id with no region yields just the id line; a local job yields no lines at all.
Lines are Rich Text rather than str so styling (e.g. the dimmed
termination-source parenthetical) survives the job-detail RichLog,
which deliberately disables markup to avoid misrendering log content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job
|
JobInfo
|
The job to describe. |
required |
Returns:
| Type | Description |
|---|---|
list[Text]
|
A list of text lines (empty if the job has no external identifier). |
Source code in snakesee/tui/renderables.py
make_summary_footer ¶
make_summary_footer(progress: WorkflowProgress) -> Panel
Create the job status summary as a one-line footer panel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
progress
|
WorkflowProgress
|
Current workflow progress snapshot. |
required |
Returns:
| Type | Description |
|---|---|
Panel
|
A Rich Panel containing the job status summary. |
Source code in snakesee/tui/renderables.py
screens ¶
Modal screens: HelpScreen, EasterEggScreen, JobLogScreen.
Classes¶
EasterEggScreen ¶
Bases: ModalScreen[None]
Modal easter egg overlay; any of escape/space/enter/q dismisses it.
The Fulcrum logo is rendered to fill the terminal at mount time and re-rendered on resize so it tracks window changes.
Source code in snakesee/tui/screens.py
HelpScreen ¶
Bases: ModalScreen[None]
Modal help overlay; any of escape/space/enter/q/? dismisses it.
Source code in snakesee/tui/screens.py
JobLogScreen ¶
Bases: ModalScreen[None]
Modal log viewer for a single job; escape or q dismisses it.
The global toggle keys (pause/estimation/wildcard/accessibility/refresh) are re-bound here to the app's actions so they keep working while a log is open — app-level BINDINGS don't fire under a modal screen, so the keys would otherwise be inert in log-viewing mode.
Source code in snakesee/tui/screens.py
Methods:¶
Initialize with the log path (shown as the border title) and tail lines.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_path
|
Path | None
|
Path to the job's log file, or None if unknown. |
required |
lines
|
list[str]
|
Tail lines (most recent at end) to render in the RichLog. |
required |
header_lines
|
list[Text] | None
|
Optional styled lines rendered above the log (e.g. a
remote job's external id and console/CloudWatch links). Rich
|
None
|
Source code in snakesee/tui/screens.py
Yield a single RichLog widget that will be populated on mount.
Source code in snakesee/tui/screens.py
Write the optional header and captured tail lines into the RichLog widget.
Source code in snakesee/tui/screens.py
Functions:¶
tables ¶
DataTable row builders and sort helpers.
Classes¶
CompletionRow ¶
FailedRow ¶
IncompleteRow ¶
PendingRow ¶
RunningRow ¶
Bases: NamedTuple
One row of the running-jobs table.
Fields mirror what _build_running_job_data returns for each job so that
callers can convert the existing data-source tuples with zero additional
computation.
Source code in snakesee/tui/tables.py
StatsRow ¶
Bases: NamedTuple
One row of the rule-statistics panel.
rule_display is the rule name for the first thread-count sub-row and
an empty string for subsequent sub-rows (visual grouping). threads
is the thread-count string shown in the Thr column ("-" when unknown).
stats holds the per-thread (or aggregate) timing data.
Source code in snakesee/tui/tables.py
Functions:¶
completion_rows ¶
completion_rows(jobs: list[JobInfo], failed_job_ids: set[int]) -> list[CompletionRow]
Build completion rows from a sorted list of completed/failed jobs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
jobs
|
list[JobInfo]
|
Ordered list of completed (and failed) jobs as returned by
:meth: |
required |
failed_job_ids
|
set[int]
|
Set of |
required |
Returns:
| Type | Description |
|---|---|
list[CompletionRow]
|
List of :class: |
Source code in snakesee/tui/tables.py
failed_rows ¶
failed_rows(progress: WorkflowProgress) -> list[FailedRow]
Build failed-job rows from workflow progress.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
progress
|
WorkflowProgress
|
Current :class: |
required |
Returns:
| Type | Description |
|---|---|
list[FailedRow]
|
List of :class: |
list[FailedRow]
|
|
Source code in snakesee/tui/tables.py
incomplete_rows ¶
incomplete_rows(progress: WorkflowProgress) -> list[IncompleteRow]
Build incomplete-job rows from workflow progress.
Each row's display_path is the output file path relative to the
workflow directory when possible, the absolute path otherwise, or the
string "unknown" when no output file is recorded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
progress
|
WorkflowProgress
|
Current :class: |
required |
Returns:
| Type | Description |
|---|---|
list[IncompleteRow]
|
List of :class: |
list[IncompleteRow]
|
|
Source code in snakesee/tui/tables.py
pending_rows ¶
pending_rows(pending_rules: dict[str, int]) -> list[PendingRow]
Build pending rows from the inferred pending-rule counts.
The default ordering (count descending) is applied here; callers may
re-sort via :func:sort_rows if custom sorting is active.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pending_rules
|
dict[str, int]
|
Mapping from rule name to estimated pending count, as
returned by
:meth: |
required |
Returns:
| Type | Description |
|---|---|
list[PendingRow]
|
List of :class: |
Source code in snakesee/tui/tables.py
running_rows ¶
running_rows(job_data: list[tuple[JobInfo, float | None, float | None, float | None, ToolProgress | None]]) -> list[RunningRow]
Convert raw running-job data tuples to typed :class:RunningRow objects.
The raw tuples are produced by
:meth:~snakesee.tui.data_source.WorkflowDataSource._build_running_job_data,
which already computes elapsed, remaining, start_time, and tool_progress.
This function is a thin adapter so that consumers hold typed data rather
than anonymous tuples.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_data
|
list[tuple[JobInfo, float | None, float | None, float | None, ToolProgress | None]]
|
List of |
required |
Returns:
| Type | Description |
|---|---|
list[RunningRow]
|
Equivalent list of :class: |
Source code in snakesee/tui/tables.py
sort_rows ¶
Sort rows by the value at column index, in-place, and return them.
Works on any :class:NamedTuple because named tuples support integer
indexing. None values sort last regardless of direction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rows
|
list[_R]
|
List of row tuples to sort. |
required |
column
|
int
|
Zero-based column index to use as the sort key. |
required |
ascending
|
bool
|
When |
required |
Returns:
| Type | Description |
|---|---|
list[_R]
|
The same list, sorted in-place and returned for convenience. |
Source code in snakesee/tui/tables.py
sort_stats_rows ¶
Sort stats rows by a visible column index, mapped to the right StatsRow field.
Unlike :func:sort_rows, this does not index the tuple positionally — the stats
table's visible columns don't line up with the StatsRow shape (see
_STATS_SORT_KEYS). An unrecognized column leaves the rows untouched.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rows
|
list[StatsRow]
|
List of :class: |
required |
column
|
int
|
Zero-based visible column index (0=Rule, 1=Thr, 2=Count, 3=Avg). |
required |
ascending
|
bool
|
When |
required |
Returns:
| Type | Description |
|---|---|
list[StatsRow]
|
A new sorted list, or the input list unchanged for an unknown column. |
Source code in snakesee/tui/tables.py
stats_rows ¶
stats_rows(stats_list: list[RuleTimingStats], thread_stats_dict: dict[str, ThreadTimingStats]) -> list[StatsRow]
Build flattened stats rows for the rule-statistics panel.
Rules with per-thread timing data are expanded into one sub-row per
thread count, with the rule name shown only on the first sub-row. Rules
without thread data get a single row with "-" in the Thr column.
The default ordering (count descending) should be applied by the caller before calling this function so that the thread expansion preserves the sorted order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stats_list
|
list[RuleTimingStats]
|
Ordered list of :class: |
required |
thread_stats_dict
|
dict[str, ThreadTimingStats]
|
Mapping from rule name to
:class: |
required |
Returns:
| Type | Description |
|---|---|
list[StatsRow]
|
Flat list of :class: |