-
Notifications
You must be signed in to change notification settings - Fork 299
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
Decouple Ray Resources: Construct ray k8spods from Resources #2943
base: master
Are you sure you want to change the base?
Changes from all commits
5f551d9
efd58f0
7c74bb7
3d84516
d192625
94b7797
0b72707
da7d6ae
17d9d66
72a3339
f3bd304
7692641
0edfb68
7676af6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,9 @@ | |
|
||
from flyteidl.plugins import ray_pb2 as _ray_pb2 | ||
|
||
from flytekit.core.resources import Resources, construct_k8s_pod_spec_from_resources | ||
from flytekit.models import common as _common | ||
from flytekit.models.task import K8sPod | ||
from flytekit.models.task import K8sObjectMetadata, K8sPod | ||
|
||
|
||
class WorkerGroupSpec(_common.FlyteIdlEntity): | ||
|
@@ -14,14 +15,22 @@ def __init__( | |
min_replicas: typing.Optional[int] = None, | ||
max_replicas: typing.Optional[int] = None, | ||
ray_start_params: typing.Optional[typing.Dict[str, str]] = None, | ||
k8s_pod: typing.Optional[K8sPod] = None, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yup, we should keep it. If someone specifies both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Talked with Eduardo about this today and agreed to only expose |
||
requests: typing.Optional[Resources] = None, | ||
limits: typing.Optional[Resources] = None, | ||
): | ||
self._group_name = group_name | ||
self._replicas = replicas | ||
self._max_replicas = max(replicas, max_replicas) if max_replicas is not None else replicas | ||
self._min_replicas = min(replicas, min_replicas) if min_replicas is not None else replicas | ||
self._ray_start_params = ray_start_params | ||
self._k8s_pod = k8s_pod | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should keep this as part of the interface and build helper functions that construct valid pod specs instead (as mentioned in the original flyte PR). This is going to help in the other problem we're having with passing the gpu resource name around (in other words, gpu can be an argument of one of the helper function that builds pod specs). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I get what you are saying. So we want users to construct the pod specs themself like calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would make the method name simple, maybe pod from resources |
||
self._requests = requests | ||
self._limits = limits | ||
self._k8s_pod = K8sPod( | ||
metadata=K8sObjectMetadata(), | ||
pod_spec=construct_k8s_pod_spec_from_resources( | ||
k8s_pod_name="ray-worker", requests=self._requests, limits=self._limits | ||
), | ||
) | ||
|
||
@property | ||
def group_name(self): | ||
|
@@ -104,10 +113,19 @@ class HeadGroupSpec(_common.FlyteIdlEntity): | |
def __init__( | ||
self, | ||
ray_start_params: typing.Optional[typing.Dict[str, str]] = None, | ||
k8s_pod: typing.Optional[K8sPod] = None, | ||
requests: typing.Optional[Resources] = None, | ||
limits: typing.Optional[Resources] = None, | ||
Comment on lines
+116
to
+117
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto. |
||
): | ||
self._ray_start_params = ray_start_params | ||
self._k8s_pod = k8s_pod | ||
self._requests = requests | ||
self._limits = limits | ||
|
||
self._k8s_pod = K8sPod( | ||
metadata=K8sObjectMetadata(), | ||
pod_spec=construct_k8s_pod_spec_from_resources( | ||
k8s_pod_name="ray-head", requests=self._requests, limits=self._limits | ||
), | ||
) | ||
|
||
@property | ||
def ray_start_params(self): | ||
|
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.
Using other gpus is going to be hard, even if we push this parameter to the outer function (i.e.
construct_k8s_pod_spec_from_resources
).