feat: Implement resource requirements for components#194
feat: Implement resource requirements for components#194
Conversation
Co-authored-by: toby-coleman <13170610+toby-coleman@users.noreply.github.com>
Co-authored-by: toby-coleman <13170610+toby-coleman@users.noreply.github.com>
Co-authored-by: toby-coleman <13170610+toby-coleman@users.noreply.github.com>
Co-authored-by: toby-coleman <13170610+toby-coleman@users.noreply.github.com>
toby-coleman
left a comment
There was a problem hiding this comment.
@copilot see comments
…r, move imports to top Co-authored-by: toby-coleman <13170610+toby-coleman@users.noreply.github.com>
…ource-requirements
|
Benchmark comparison for |
|
Benchmark comparison for |
|
Benchmark comparison for |
|
Benchmark comparison for |
|
Benchmark comparison for |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Benchmark comparison for |
|
Benchmark comparison for |
|
Benchmark comparison for |
|
@copilot I have refactored the implementation of component resources so the resource requirements can now be declared with a class attribute Update any relevant docstrings, documentation and examples to explain how to specify resource requirements on the Component declaration, and how this can be overriden. |
Co-authored-by: chrisk314 <2366658+chrisk314@users.noreply.github.com>
Done in commit ea310c1. Updated:
|
|
Benchmark comparison for |
Summary
Adds resource specification support for components to enable Ray actor resource allocation and Tuner placement group optimization. Resources can be declared as class attributes on Component definitions (recommended) or overridden at instantiation time.
Changes
Core Schema
ResourcePydantic class inplugboard_schemas.componentwith fields:cpu,gpu,memory(integer bytes),resources(custom dict)n,u,m,k,M,G,T,P,E(e.g.,"250m"→ 0.25,"5k"→ 5000)Ki,Mi,Gi,Ti,Pi,Ei(e.g.,"10Mi"→ 10,485,760 bytes)cpu=0.001, others zeroto_ray_options()for Ray actor configurationComponent Integration
resourcesclass attribute toComponentfor declaring default resource requirementsComponent.__init__()with optionalresourcesparameter to override class-level defaultsComponentArgsDict,ComponentArgsSpecfor YAML supportRay Execution
RayProcess._create_component_actor()to apply resource requirements viaray.remote(**ray_options)Resource()when unspecifiedTuner Optimization
Tuner._calculate_placement_bundles()to aggregate component resourcesPlacementGroupFactorywith tuner overhead (0.5 CPU) + component bundleDocumentation
Componentclass docstring to document theresourcesclass attributeComponent.__init__()docstring explaining resource parameter behaviordocs/examples/tutorials/running-in-parallel.mdexplaining both approaches:Usage Examples
Class-level declaration (recommended):
Constructor override:
YAML config:
Tests
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.