-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Implement resource requirements for components #194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: toby-coleman <[email protected]>
Co-authored-by: toby-coleman <[email protected]>
Co-authored-by: toby-coleman <[email protected]>
Co-authored-by: toby-coleman <[email protected]>
| """Parse a resource value from string or number. | ||
|
|
||
| Supports: | ||
| - Direct numerical values: 1, 0.5, 2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Can you make this more general? For example by using/supporting any of the following suffixes:
suffixes = {
'n': 1e-9, 'u': 1e-6, 'm': 1e-3, # Decimal SI
'k': 1e3, 'M': 1e6, 'G': 1e9, 'T': 1e12, 'P': 1e15, 'E': 1e18,
'Ki': 1024, 'Mi': 1024**2, 'Gi': 1024**3, 'Ti': 1024**4, 'Pi': 1024**5, 'Ei': 1024**6
}|
|
||
| cpu: float = 0.001 | ||
| gpu: float = 0 | ||
| memory: float = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Memory should be specified as an integer number of bytes
| initial_values: _t.NotRequired[dict[str, _t.Any] | None] | ||
| parameters: _t.NotRequired[dict[str, _t.Any] | None] | ||
| constraints: _t.NotRequired[dict[str, _t.Any] | None] | ||
| resources: _t.NotRequired["Resource | None"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| resources: _t.NotRequired["Resource | None"] | |
| resources: _t.NotRequired[Resource | None] |
| ).remote(**args) | ||
|
|
||
| # Get resource requirements from component | ||
| from plugboard.schemas import Resource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this import to the top
Summary
Adds resource specification support for components to enable Ray actor resource allocation and Tuner placement group optimization.
Changes
Core Schema
ResourcePydantic class inplugboard_schemas.componentwith fields:cpu,gpu,memory,resources(custom dict)"250m"→ 0.25 CPU,"10Mi"→ 10,485,760 bytescpu=0.001, others zeroto_ray_options()for Ray actor configurationComponent Integration
Component.__init__()with optionalresourcesparameterComponentArgsDict,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 bundleUsage Example
Tests
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
astral.sh/usr/bin/curl curl -LsSf REDACTED(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.