Skip to content

Conversation

@AlonKellner-RedHat
Copy link
Owner

No description provided.

markurtz and others added 13 commits August 20, 2025 13:19
…singleton (vllm-project#289)

## Summary

This PR introduces four new utility modules that provide foundational
capabilities for auto-discovery, registry patterns, singleton
management, and enhanced Pydantic utilities. It additionally
consolidates the pydantic utility classes from guidellm.objects into the
dedicated guidellm.utils module containing the new additions. This
change improves code organization and establishes the foundation for
upcoming scheduler refactoring work.

## Details

- **Moved core
utilities** from `guidellm.objects.pydantic` to `guidellm.utils.pydantic_utils`
- **Added `AutoImporterMixin`** for dynamic module discovery within
packages
- **Added `RegistryMixin`** for object registration with optional
auto-discovery
- **Added singleton
mixins** (`SingletonMixin`, `ThreadSafeSingletonMixin`) for instance
management
- **Enhanced Pydantic
utilities** with `ReloadableBaseModel`, `StandardBaseDict`,
and `PydanticClassRegistryMixin` for polymorphic model serialization
- **Updated all imports** across the codebase to reference new module
locations
- **Added comprehensive test coverage** for all new utility modules
- **Removed obsolete** `guidellm.objects.pydantic` module and associated
tests

## Test Plan

- Run existing test suite to ensure no regressions from import changes
- Execute new utility module test suites covering smoke, sanity, and
regression scenarios

## Related Issues


---

- [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]>
…-project#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]>
commit ea1e25d
Author: Mark Kurtz <[email protected]>
Date:   Wed Aug 27 02:35:58 2025 +0000

    update doc strings for clarifications in encoding.py

commit fe76616
Author: Mark Kurtz <[email protected]>
Date:   Wed Aug 27 02:31:06 2025 +0000

    Updates from review and requirements for worker integration

commit b08e52a
Author: Mark Kurtz <[email protected]>
Date:   Tue Aug 26 22:19:46 2025 -0400

    Update src/guidellm/utils/encoding.py

    Co-authored-by: Samuel Monson <[email protected]>
    Signed-off-by: Mark Kurtz <[email protected]>

commit cff8d91
Author: Mark Kurtz <[email protected]>
Date:   Tue Aug 26 17:52:18 2025 +0000

    Fix styling issues

commit 275f123
Author: Mark Kurtz <[email protected]>
Date:   Tue Aug 26 13:44:33 2025 -0400

    Apply suggestion from @Copilot

    Co-authored-by: Copilot <[email protected]>
    Signed-off-by: Mark Kurtz <[email protected]>

commit 77573a8
Author: Mark Kurtz <[email protected]>
Date:   Tue Aug 26 16:21:47 2025 +0000

    fix improper name update

commit 3629fd0
Author: Mark Kurtz <[email protected]>
Date:   Tue Aug 26 16:00:46 2025 +0000

    Add multiprocessing utils for encoding and messaging

commit 3e048e8
Author: Mark Kurtz <[email protected]>
Date:   Thu Aug 21 01:49:43 2025 +0000

    minor fixes and updates

commit 163e6e3
Author: Mark Kurtz <[email protected]>
Date:   Thu Aug 21 01:29:34 2025 +0000

    Implementation and tests for the next utils package modules iteration for the scheduler refactor

commit acf0646
Author: Mark Kurtz <[email protected]>
Date:   Wed Aug 20 19:01:42 2025 -0400

    Update tests/unit/utils/test_registry.py

    Co-authored-by: Copilot <[email protected]>
    Signed-off-by: Mark Kurtz <[email protected]>

commit e3a1c48
Author: Mark Kurtz <[email protected]>
Date:   Wed Aug 20 22:29:31 2025 +0000

    Implementation and tests for the core utils packages for the scheduler refactor
commit cfd8505
Author: Mark Kurtz <[email protected]>
Date:   Wed Aug 27 02:47:07 2025 +0000

    updates from reviews

commit 0f011c3
Author: Mark Kurtz <[email protected]>
Date:   Tue Aug 26 20:02:50 2025 +0000

    fixes after rebasing

commit 1cc24cd
Author: Mark Kurtz <[email protected]>
Date:   Tue Aug 26 19:33:35 2025 +0000

    Fixes to ensure tests will run

commit 6fbd4ba
Author: Mark Kurtz <[email protected]>
Date:   Tue Aug 26 19:06:52 2025 +0000

    fix improper arg for tests

commit 2304804
Author: Mark Kurtz <[email protected]>
Date:   Tue Aug 26 18:51:25 2025 +0000

    Add new scheduler constraints, objects, and strategy for refactor

commit 20664b4
Author: Mark Kurtz <[email protected]>
Date:   Thu Aug 21 01:29:34 2025 +0000

    Implementation and tests for the next utils package modules iteration for the scheduler refactor

commit 07f0773
Author: Mark Kurtz <[email protected]>
Date:   Wed Aug 20 22:29:31 2025 +0000

    Implementation and tests for the core utils packages for the scheduler refactor

commit ea1e25d
Author: Mark Kurtz <[email protected]>
Date:   Wed Aug 27 02:35:58 2025 +0000

    update doc strings for clarifications in encoding.py

commit fe76616
Author: Mark Kurtz <[email protected]>
Date:   Wed Aug 27 02:31:06 2025 +0000

    Updates from review and requirements for worker integration

commit b08e52a
Author: Mark Kurtz <[email protected]>
Date:   Tue Aug 26 22:19:46 2025 -0400

    Update src/guidellm/utils/encoding.py

    Co-authored-by: Samuel Monson <[email protected]>
    Signed-off-by: Mark Kurtz <[email protected]>

commit cff8d91
Author: Mark Kurtz <[email protected]>
Date:   Tue Aug 26 17:52:18 2025 +0000

    Fix styling issues

commit 275f123
Author: Mark Kurtz <[email protected]>
Date:   Tue Aug 26 13:44:33 2025 -0400

    Apply suggestion from @Copilot

    Co-authored-by: Copilot <[email protected]>
    Signed-off-by: Mark Kurtz <[email protected]>

commit 77573a8
Author: Mark Kurtz <[email protected]>
Date:   Tue Aug 26 16:21:47 2025 +0000

    fix improper name update

commit 3629fd0
Author: Mark Kurtz <[email protected]>
Date:   Tue Aug 26 16:00:46 2025 +0000

    Add multiprocessing utils for encoding and messaging

commit 3e048e8
Author: Mark Kurtz <[email protected]>
Date:   Thu Aug 21 01:49:43 2025 +0000

    minor fixes and updates

commit 163e6e3
Author: Mark Kurtz <[email protected]>
Date:   Thu Aug 21 01:29:34 2025 +0000

    Implementation and tests for the next utils package modules iteration for the scheduler refactor

commit acf0646
Author: Mark Kurtz <[email protected]>
Date:   Wed Aug 20 19:01:42 2025 -0400

    Update tests/unit/utils/test_registry.py

    Co-authored-by: Copilot <[email protected]>
    Signed-off-by: Mark Kurtz <[email protected]>

commit e3a1c48
Author: Mark Kurtz <[email protected]>
Date:   Wed Aug 20 22:29:31 2025 +0000

    Implementation and tests for the core utils packages for the scheduler refactor
commit 906ff49
Author: Samuel Monson <[email protected]>
Date:   Wed Aug 27 15:54:32 2025 -0400

    Add helper for converting literals to list of strings

    Signed-off-by: Samuel Monson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants