Commit 3db57b0
Scheduler refactor [utils]: functions, mixins, statistics, text (#290)
## Summary
This PR adds new utility modules for safe math function operations,
object info extraction, and reorganizes to consolidate into the utils
package.
## Details
- **Move statistics classes from `objects` to `utils`**:
Relocates `DistributionSummary`, `Percentiles`, `RunningStats`, `StatusDistributionSummary`,
and `TimeRunningStats` from `guidellm.objects.statistics` to `guidellm.utils.statistics`
- **Add new `functions.py` module**: Implements defensive programming
utilities
including `safe_getattr`, `safe_divide`, `safe_multiply`, `safe_add`, `safe_format_timestamp`,
and `all_defined` for handling None values and edge cases
- **Add new `mixins.py` module**: Provides `InfoMixin` class for
standardized metadata extraction and object introspection across
different class hierarchies
- **Enhance `text.py` module**: Adds comprehensive
documentation, `format_value_display` function for consistent metric
formatting, and improved text processing utilities
- **Update import statements**: Modifies all affected modules
(`benchmark`, `presentation`) to import statistics classes from their
new location in `utils`
- **Remove deprecated `objects` package**: Deletes the
now-empty `objects` directory and associated test files
- **Add comprehensive test coverage**: Includes new test suites
for `functions.py`, `mixins.py`, and `statistics.py`
- **Update `__init__.py` exports**: Adds new utility functions and
classes to the main utils package exports for easy access
## Test Plan
- Run the existing test suite to ensure no regressions from the
statistics class relocation
- Execute new test files:
- test_functions.py - Tests for safe operation utilities
- test_mixins.py - Tests for InfoMixin functionality
- test_statistics.py - Comprehensive tests for statistical analysis
utilities
- test_text.py - Tests for enhanced text processing functions
## Related Issues
- Resolves #
---
- [X] "I certify that all code in this PR is my own, except as noted
below."
## Use of AI
- [X] Includes AI-assisted code completion
- [X] Includes code generated by an AI application
- [ ] Includes AI-generated tests (NOTE: AI written tests should have a
docstring that includes `## WRITTEN BY AI ##`)
---------
Signed-off-by: Mark Kurtz <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Samuel Monson <[email protected]>1 parent 3f7f7ac commit 3db57b0
File tree
16 files changed
+1454
-150
lines changed- src/guidellm
- benchmark
- objects
- presentation
- utils
- tests/unit
- objects
- utils
16 files changed
+1454
-150
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | 25 | | |
30 | 26 | | |
31 | 27 | | |
| |||
38 | 34 | | |
39 | 35 | | |
40 | 36 | | |
41 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | 15 | | |
19 | 16 | | |
20 | 17 | | |
| |||
30 | 27 | | |
31 | 28 | | |
32 | 29 | | |
33 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | 24 | | |
29 | 25 | | |
30 | 26 | | |
31 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
4 | 12 | | |
5 | 13 | | |
6 | 14 | | |
| |||
18 | 26 | | |
19 | 27 | | |
20 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
21 | 36 | | |
22 | 37 | | |
23 | 38 | | |
24 | 39 | | |
25 | | - | |
| 40 | + | |
26 | 41 | | |
27 | 42 | | |
28 | 43 | | |
| |||
33 | 48 | | |
34 | 49 | | |
35 | 50 | | |
| 51 | + | |
36 | 52 | | |
37 | 53 | | |
| 54 | + | |
38 | 55 | | |
39 | 56 | | |
40 | 57 | | |
| 58 | + | |
41 | 59 | | |
42 | 60 | | |
43 | 61 | | |
44 | 62 | | |
| 63 | + | |
45 | 64 | | |
| 65 | + | |
| 66 | + | |
46 | 67 | | |
47 | 68 | | |
48 | 69 | | |
49 | | - | |
| 70 | + | |
50 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
51 | 77 | | |
52 | 78 | | |
53 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 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 | + | |
| 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 | + | |
0 commit comments