diff --git a/src/ray/protobuf/autoscaler.proto b/src/ray/protobuf/autoscaler.proto index 4373c137d209..d111d113c621 100644 --- a/src/ray/protobuf/autoscaler.proto +++ b/src/ray/protobuf/autoscaler.proto @@ -51,12 +51,46 @@ message PlacementConstraint { optional AffinityConstraint affinity = 2; } +// The type of operator to use for the label constraint. +enum LabelOperator { + LABEL_OPERATOR_UNSPECIFIED = 0; + // This is to support equality or in semantics. + LABEL_OPERATOR_IN = 1; + // This is to support not equal or not in semantics. + LABEL_OPERATOR_NOT_IN = 2; +} + +// A node label constraint with a key, one or a list of values and an operator. +message LabelConstraint { + // The key of the label + string label_key = 1; + // The operator to use for the label constraint. + LabelOperator operator = 2; + // The values to check against. + repeated string label_values = 3; +} + +// A list of node label constraints to specify the label requirements in a +// resource request. +message LabelSelector { + // The list of node label constraints with AND semantics. + repeated LabelConstraint label_constraints = 1; +} + message ResourceRequest { // resource requirements for the request. map resources_bundle = 1; // placement constraint for the request. multiple constraints // form AND semantics. repeated PlacementConstraint placement_constraints = 2; + // The node label requirements for the request. Multiple label selectors are for + // fallback mechanism. When trying to find a node that satisfies the label + // requirements, the first label selector should be tried first, if not found, + // the second label selector should be tried, and so on. + // Note that When the ResourceRequest is used within a BundleSelector for + // GangResourceRequest, the fallback mechanism is done at the BundleSelector level. + // So in that case, the label_selectors will only contain a single LabelSelector. + repeated LabelSelector label_selectors = 3; } message ResourceRequestByCount { @@ -64,14 +98,27 @@ message ResourceRequestByCount { int64 count = 2; } -// All bundles in the same resource request require gang +// A bundle selector used to specify the resource bundles that should be +// allocated together. All bundles in the same resource request require gang // allocation semantics: they should be allocated all or nothing. +message BundleSelector { + // The list of resource requests that should be allocated together. + repeated ResourceRequest resource_requests = 1; +} + message GangResourceRequest { // a map from bundles to the number of bundles requested. + // DEPRECATED: bundle_selector should be used instead so that we can support fallback + // mechanism. repeated ResourceRequest requests = 1; // Metadata associated with the request for observability, // e.g. placement group's strategy. string details = 2; + // The bundle requests. Multiple bundle selectors are for fallback mechanism. + // When trying to find nodes that satisfies the bundle selector, the first bundle + // selector should be tried first, if not found, the second bundle selector should be + // tried, and so on. + repeated BundleSelector bundle_selectors = 3; } // Cluster resource constraint represents minimal cluster size requirement,