From c6d865fe6703816cd20370f2c8ae11db8a2f83c6 Mon Sep 17 00:00:00 2001 From: Yicheng-Lu-llll Date: Mon, 6 Nov 2023 00:04:16 +0000 Subject: [PATCH 01/13] add enable_in_tree_autoscaling Signed-off-by: Yicheng-Lu-llll --- .../gen/pb-cpp/flyteidl/plugins/ray.pb.cc | 86 ++++++++++--- flyteidl/gen/pb-cpp/flyteidl/plugins/ray.pb.h | 21 ++++ flyteidl/gen/pb-go/flyteidl/plugins/ray.pb.go | 74 +++++++----- .../pb-go/flyteidl/plugins/ray.pb.validate.go | 2 + .../gen/pb-java/flyteidl/plugins/Ray.java | 114 +++++++++++++++--- .../gen/pb_python/flyteidl/plugins/ray_pb2.py | 20 +-- .../pb_python/flyteidl/plugins/ray_pb2.pyi | 6 +- flyteidl/gen/pb_rust/flyteidl.plugins.rs | 3 + flyteidl/protos/flyteidl/plugins/ray.proto | 2 + flyteplugins/go/tasks/plugins/k8s/ray/ray.go | 4 +- 10 files changed, 253 insertions(+), 79 deletions(-) diff --git a/flyteidl/gen/pb-cpp/flyteidl/plugins/ray.pb.cc b/flyteidl/gen/pb-cpp/flyteidl/plugins/ray.pb.cc index fc5ea74702..f36225f9f9 100644 --- a/flyteidl/gen/pb-cpp/flyteidl/plugins/ray.pb.cc +++ b/flyteidl/gen/pb-cpp/flyteidl/plugins/ray.pb.cc @@ -164,6 +164,7 @@ const ::google::protobuf::uint32 TableStruct_flyteidl_2fplugins_2fray_2eproto::o ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::flyteidl::plugins::RayCluster, head_group_spec_), PROTOBUF_FIELD_OFFSET(::flyteidl::plugins::RayCluster, worker_group_spec_), + PROTOBUF_FIELD_OFFSET(::flyteidl::plugins::RayCluster, enable_in_tree_autoscaling_), PROTOBUF_FIELD_OFFSET(::flyteidl::plugins::HeadGroupSpec_RayStartParamsEntry_DoNotUse, _has_bits_), PROTOBUF_FIELD_OFFSET(::flyteidl::plugins::HeadGroupSpec_RayStartParamsEntry_DoNotUse, _internal_metadata_), ~0u, // no _extensions_ @@ -202,10 +203,10 @@ const ::google::protobuf::uint32 TableStruct_flyteidl_2fplugins_2fray_2eproto::o static const ::google::protobuf::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, -1, sizeof(::flyteidl::plugins::RayJob)}, { 7, -1, sizeof(::flyteidl::plugins::RayCluster)}, - { 14, 21, sizeof(::flyteidl::plugins::HeadGroupSpec_RayStartParamsEntry_DoNotUse)}, - { 23, -1, sizeof(::flyteidl::plugins::HeadGroupSpec)}, - { 29, 36, sizeof(::flyteidl::plugins::WorkerGroupSpec_RayStartParamsEntry_DoNotUse)}, - { 38, -1, sizeof(::flyteidl::plugins::WorkerGroupSpec)}, + { 15, 22, sizeof(::flyteidl::plugins::HeadGroupSpec_RayStartParamsEntry_DoNotUse)}, + { 24, -1, sizeof(::flyteidl::plugins::HeadGroupSpec)}, + { 30, 37, sizeof(::flyteidl::plugins::WorkerGroupSpec_RayStartParamsEntry_DoNotUse)}, + { 39, -1, sizeof(::flyteidl::plugins::WorkerGroupSpec)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { @@ -227,27 +228,28 @@ const char descriptor_table_protodef_flyteidl_2fplugins_2fray_2eproto[] = "\n\032flyteidl/plugins/ray.proto\022\020flyteidl.p" "lugins\"P\n\006RayJob\0221\n\013ray_cluster\030\001 \001(\0132\034." "flyteidl.plugins.RayCluster\022\023\n\013runtime_e" - "nv\030\002 \001(\t\"\204\001\n\nRayCluster\0228\n\017head_group_sp" + "nv\030\002 \001(\t\"\250\001\n\nRayCluster\0228\n\017head_group_sp" "ec\030\001 \001(\0132\037.flyteidl.plugins.HeadGroupSpe" "c\022<\n\021worker_group_spec\030\002 \003(\0132!.flyteidl." - "plugins.WorkerGroupSpec\"\225\001\n\rHeadGroupSpe" - "c\022M\n\020ray_start_params\030\001 \003(\01323.flyteidl.p" - "lugins.HeadGroupSpec.RayStartParamsEntry" - "\0325\n\023RayStartParamsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005" - "value\030\002 \001(\t:\0028\001\"\353\001\n\017WorkerGroupSpec\022\022\n\ng" - "roup_name\030\001 \001(\t\022\020\n\010replicas\030\002 \001(\005\022\024\n\014min" - "_replicas\030\003 \001(\005\022\024\n\014max_replicas\030\004 \001(\005\022O\n" - "\020ray_start_params\030\005 \003(\01325.flyteidl.plugi" - "ns.WorkerGroupSpec.RayStartParamsEntry\0325" - "\n\023RayStartParamsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005va" - "lue\030\002 \001(\t:\0028\001B\?Z=github.com/flyteorg/fly" - "te/flyteidl/gen/pb-go/flyteidl/pluginsb\006" - "proto3" + "plugins.WorkerGroupSpec\022\"\n\032enable_in_tre" + "e_autoscaling\030\003 \001(\010\"\225\001\n\rHeadGroupSpec\022M\n" + "\020ray_start_params\030\001 \003(\01323.flyteidl.plugi" + "ns.HeadGroupSpec.RayStartParamsEntry\0325\n\023" + "RayStartParamsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005valu" + "e\030\002 \001(\t:\0028\001\"\353\001\n\017WorkerGroupSpec\022\022\n\ngroup" + "_name\030\001 \001(\t\022\020\n\010replicas\030\002 \001(\005\022\024\n\014min_rep" + "licas\030\003 \001(\005\022\024\n\014max_replicas\030\004 \001(\005\022O\n\020ray" + "_start_params\030\005 \003(\01325.flyteidl.plugins.W" + "orkerGroupSpec.RayStartParamsEntry\0325\n\023Ra" + "yStartParamsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030" + "\002 \001(\t:\0028\001B\?Z=github.com/flyteorg/flyte/f" + "lyteidl/gen/pb-go/flyteidl/pluginsb\006prot" + "o3" ; ::google::protobuf::internal::DescriptorTable descriptor_table_flyteidl_2fplugins_2fray_2eproto = { false, InitDefaults_flyteidl_2fplugins_2fray_2eproto, descriptor_table_protodef_flyteidl_2fplugins_2fray_2eproto, - "flyteidl/plugins/ray.proto", &assign_descriptors_table_flyteidl_2fplugins_2fray_2eproto, 726, + "flyteidl/plugins/ray.proto", &assign_descriptors_table_flyteidl_2fplugins_2fray_2eproto, 762, }; void AddDescriptors_flyteidl_2fplugins_2fray_2eproto() { @@ -644,6 +646,7 @@ RayCluster::HasBitSetters::head_group_spec(const RayCluster* msg) { #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int RayCluster::kHeadGroupSpecFieldNumber; const int RayCluster::kWorkerGroupSpecFieldNumber; +const int RayCluster::kEnableInTreeAutoscalingFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 RayCluster::RayCluster() @@ -661,13 +664,16 @@ RayCluster::RayCluster(const RayCluster& from) } else { head_group_spec_ = nullptr; } + enable_in_tree_autoscaling_ = from.enable_in_tree_autoscaling_; // @@protoc_insertion_point(copy_constructor:flyteidl.plugins.RayCluster) } void RayCluster::SharedCtor() { ::google::protobuf::internal::InitSCC( &scc_info_RayCluster_flyteidl_2fplugins_2fray_2eproto.base); - head_group_spec_ = nullptr; + ::memset(&head_group_spec_, 0, static_cast( + reinterpret_cast(&enable_in_tree_autoscaling_) - + reinterpret_cast(&head_group_spec_)) + sizeof(enable_in_tree_autoscaling_)); } RayCluster::~RayCluster() { @@ -699,6 +705,7 @@ void RayCluster::Clear() { delete head_group_spec_; } head_group_spec_ = nullptr; + enable_in_tree_autoscaling_ = false; _internal_metadata_.Clear(); } @@ -744,6 +751,13 @@ const char* RayCluster::_InternalParse(const char* begin, const char* end, void* } while ((::google::protobuf::io::UnalignedLoad<::google::protobuf::uint64>(ptr) & 255) == 18 && (ptr += 1)); break; } + // bool enable_in_tree_autoscaling = 3; + case 3: { + if (static_cast<::google::protobuf::uint8>(tag) != 24) goto handle_unusual; + msg->set_enable_in_tree_autoscaling(::google::protobuf::internal::ReadVarint(&ptr)); + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); + break; + } default: { handle_unusual: if ((tag & 7) == 4 || tag == 0) { @@ -796,6 +810,19 @@ bool RayCluster::MergePartialFromCodedStream( break; } + // bool enable_in_tree_autoscaling = 3; + case 3: { + if (static_cast< ::google::protobuf::uint8>(tag) == (24 & 0xFF)) { + + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &enable_in_tree_autoscaling_))); + } else { + goto handle_unusual; + } + break; + } + default: { handle_unusual: if (tag == 0) { @@ -838,6 +865,11 @@ void RayCluster::SerializeWithCachedSizes( output); } + // bool enable_in_tree_autoscaling = 3; + if (this->enable_in_tree_autoscaling() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteBool(3, this->enable_in_tree_autoscaling(), output); + } + if (_internal_metadata_.have_unknown_fields()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( _internal_metadata_.unknown_fields(), output); @@ -866,6 +898,11 @@ ::google::protobuf::uint8* RayCluster::InternalSerializeWithCachedSizesToArray( 2, this->worker_group_spec(static_cast(i)), target); } + // bool enable_in_tree_autoscaling = 3; + if (this->enable_in_tree_autoscaling() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(3, this->enable_in_tree_autoscaling(), target); + } + if (_internal_metadata_.have_unknown_fields()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields(), target); @@ -905,6 +942,11 @@ size_t RayCluster::ByteSizeLong() const { *head_group_spec_); } + // bool enable_in_tree_autoscaling = 3; + if (this->enable_in_tree_autoscaling() != 0) { + total_size += 1 + 1; + } + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; @@ -936,6 +978,9 @@ void RayCluster::MergeFrom(const RayCluster& from) { if (from.has_head_group_spec()) { mutable_head_group_spec()->::flyteidl::plugins::HeadGroupSpec::MergeFrom(from.head_group_spec()); } + if (from.enable_in_tree_autoscaling() != 0) { + set_enable_in_tree_autoscaling(from.enable_in_tree_autoscaling()); + } } void RayCluster::CopyFrom(const ::google::protobuf::Message& from) { @@ -965,6 +1010,7 @@ void RayCluster::InternalSwap(RayCluster* other) { _internal_metadata_.Swap(&other->_internal_metadata_); CastToBase(&worker_group_spec_)->InternalSwap(CastToBase(&other->worker_group_spec_)); swap(head_group_spec_, other->head_group_spec_); + swap(enable_in_tree_autoscaling_, other->enable_in_tree_autoscaling_); } ::google::protobuf::Metadata RayCluster::GetMetadata() const { diff --git a/flyteidl/gen/pb-cpp/flyteidl/plugins/ray.pb.h b/flyteidl/gen/pb-cpp/flyteidl/plugins/ray.pb.h index 5de7bb122c..a7bb22a042 100644 --- a/flyteidl/gen/pb-cpp/flyteidl/plugins/ray.pb.h +++ b/flyteidl/gen/pb-cpp/flyteidl/plugins/ray.pb.h @@ -334,6 +334,12 @@ class RayCluster final : ::flyteidl::plugins::HeadGroupSpec* mutable_head_group_spec(); void set_allocated_head_group_spec(::flyteidl::plugins::HeadGroupSpec* head_group_spec); + // bool enable_in_tree_autoscaling = 3; + void clear_enable_in_tree_autoscaling(); + static const int kEnableInTreeAutoscalingFieldNumber = 3; + bool enable_in_tree_autoscaling() const; + void set_enable_in_tree_autoscaling(bool value); + // @@protoc_insertion_point(class_scope:flyteidl.plugins.RayCluster) private: class HasBitSetters; @@ -341,6 +347,7 @@ class RayCluster final : ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::RepeatedPtrField< ::flyteidl::plugins::WorkerGroupSpec > worker_group_spec_; ::flyteidl::plugins::HeadGroupSpec* head_group_spec_; + bool enable_in_tree_autoscaling_; mutable ::google::protobuf::internal::CachedSize _cached_size_; friend struct ::TableStruct_flyteidl_2fplugins_2fray_2eproto; }; @@ -870,6 +877,20 @@ RayCluster::worker_group_spec() const { return worker_group_spec_; } +// bool enable_in_tree_autoscaling = 3; +inline void RayCluster::clear_enable_in_tree_autoscaling() { + enable_in_tree_autoscaling_ = false; +} +inline bool RayCluster::enable_in_tree_autoscaling() const { + // @@protoc_insertion_point(field_get:flyteidl.plugins.RayCluster.enable_in_tree_autoscaling) + return enable_in_tree_autoscaling_; +} +inline void RayCluster::set_enable_in_tree_autoscaling(bool value) { + + enable_in_tree_autoscaling_ = value; + // @@protoc_insertion_point(field_set:flyteidl.plugins.RayCluster.enable_in_tree_autoscaling) +} + // ------------------------------------------------------------------- // ------------------------------------------------------------------- diff --git a/flyteidl/gen/pb-go/flyteidl/plugins/ray.pb.go b/flyteidl/gen/pb-go/flyteidl/plugins/ray.pb.go index f19e755f85..8b5c96b018 100644 --- a/flyteidl/gen/pb-go/flyteidl/plugins/ray.pb.go +++ b/flyteidl/gen/pb-go/flyteidl/plugins/ray.pb.go @@ -76,10 +76,12 @@ type RayCluster struct { // HeadGroupSpecs are the spec for the head pod HeadGroupSpec *HeadGroupSpec `protobuf:"bytes,1,opt,name=head_group_spec,json=headGroupSpec,proto3" json:"head_group_spec,omitempty"` // WorkerGroupSpecs are the specs for the worker pods - WorkerGroupSpec []*WorkerGroupSpec `protobuf:"bytes,2,rep,name=worker_group_spec,json=workerGroupSpec,proto3" json:"worker_group_spec,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + WorkerGroupSpec []*WorkerGroupSpec `protobuf:"bytes,2,rep,name=worker_group_spec,json=workerGroupSpec,proto3" json:"worker_group_spec,omitempty"` + // Whether to enable in-tree autoscaling. + EnableInTreeAutoscaling bool `protobuf:"varint,3,opt,name=enable_in_tree_autoscaling,json=enableInTreeAutoscaling,proto3" json:"enable_in_tree_autoscaling,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *RayCluster) Reset() { *m = RayCluster{} } @@ -121,6 +123,13 @@ func (m *RayCluster) GetWorkerGroupSpec() []*WorkerGroupSpec { return nil } +func (m *RayCluster) GetEnableInTreeAutoscaling() bool { + if m != nil { + return m.EnableInTreeAutoscaling + } + return false +} + // HeadGroupSpec are the spec for the head pod type HeadGroupSpec struct { // Optional. RayStartParams are the params of the start command: address, object-store-memory. @@ -253,31 +262,34 @@ func init() { func init() { proto.RegisterFile("flyteidl/plugins/ray.proto", fileDescriptor_b980f6d58c7489d7) } var fileDescriptor_b980f6d58c7489d7 = []byte{ - // 413 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x93, 0xcd, 0xca, 0xd3, 0x40, - 0x14, 0x86, 0x49, 0x6a, 0x3f, 0xec, 0x89, 0x9f, 0xad, 0xa3, 0x8b, 0x52, 0x94, 0xb6, 0x59, 0x75, - 0x63, 0x02, 0x2d, 0x82, 0x08, 0x45, 0x54, 0x4a, 0x45, 0x50, 0x64, 0xba, 0x10, 0x04, 0x09, 0x93, - 0x74, 0x4c, 0x42, 0x93, 0x99, 0x61, 0x32, 0x69, 0x9b, 0xfb, 0xf1, 0x06, 0xdc, 0x78, 0x7d, 0x92, - 0x49, 0x4c, 0x7f, 0xa1, 0x3b, 0x77, 0xe7, 0xe7, 0x3d, 0xef, 0x99, 0x3c, 0xe1, 0xc0, 0xe0, 0x67, - 0x52, 0x28, 0x1a, 0xaf, 0x13, 0x57, 0x24, 0x79, 0x18, 0xb3, 0xcc, 0x95, 0xa4, 0x70, 0x84, 0xe4, - 0x8a, 0xa3, 0xde, 0xbf, 0x9e, 0x53, 0xf7, 0xec, 0x08, 0xee, 0x30, 0x29, 0x3e, 0x71, 0x1f, 0xcd, - 0xc1, 0x92, 0xa4, 0xf0, 0x82, 0x24, 0xcf, 0x14, 0x95, 0x7d, 0x63, 0x64, 0x4c, 0xac, 0xe9, 0x73, - 0xe7, 0x7c, 0xc2, 0xc1, 0xa4, 0xf8, 0x50, 0x69, 0x30, 0xc8, 0x26, 0x46, 0x43, 0xb0, 0x64, 0xce, - 0x54, 0x9c, 0x52, 0x8f, 0xb2, 0x6d, 0xdf, 0x1c, 0x19, 0x93, 0x0e, 0x86, 0xba, 0xb4, 0x60, 0x5b, - 0xfb, 0x97, 0x01, 0x70, 0x98, 0x45, 0x4b, 0xe8, 0x46, 0x94, 0xac, 0xbd, 0x50, 0xf2, 0x5c, 0x78, - 0x99, 0xa0, 0x41, 0xbd, 0x72, 0x78, 0xb9, 0xf2, 0x23, 0x25, 0xeb, 0x65, 0xa9, 0x5b, 0x09, 0x1a, - 0xe0, 0xfb, 0xe8, 0x38, 0x45, 0x9f, 0xe1, 0xc9, 0x8e, 0xcb, 0x0d, 0x95, 0xc7, 0x56, 0xe6, 0xa8, - 0x35, 0xb1, 0xa6, 0xe3, 0x4b, 0xab, 0x6f, 0x5a, 0x7a, 0x30, 0xeb, 0xee, 0x4e, 0x0b, 0xf6, 0x6f, - 0x03, 0xee, 0x4f, 0xf6, 0xa1, 0x1f, 0xd0, 0x2b, 0xc1, 0x64, 0x8a, 0x48, 0xe5, 0x09, 0x22, 0x49, - 0x9a, 0xf5, 0x0d, 0xed, 0x3f, 0xbb, 0xf1, 0xd4, 0x92, 0xd5, 0xaa, 0x1c, 0xfb, 0xaa, 0xa7, 0x16, - 0x4c, 0xc9, 0x02, 0x3f, 0x96, 0x27, 0xc5, 0xc1, 0x3b, 0x78, 0x7a, 0x45, 0x86, 0x7a, 0xd0, 0xda, - 0xd0, 0x42, 0x33, 0xe9, 0xe0, 0x32, 0x44, 0xcf, 0xa0, 0xbd, 0x25, 0x49, 0x4e, 0x6b, 0xb6, 0x55, - 0xf2, 0xc6, 0x7c, 0x6d, 0xd8, 0x7f, 0x4c, 0xe8, 0x9e, 0x7d, 0x18, 0x7a, 0x01, 0x50, 0xf1, 0x60, - 0x24, 0xa5, 0xb5, 0x4d, 0x47, 0x57, 0xbe, 0x90, 0x94, 0xa2, 0x01, 0x3c, 0x94, 0x54, 0x24, 0x71, - 0x40, 0x32, 0xed, 0xd7, 0xc6, 0x4d, 0x8e, 0xc6, 0xf0, 0x28, 0x8d, 0x99, 0xd7, 0xf4, 0x5b, 0xba, - 0x6f, 0xa5, 0x31, 0xc3, 0xc7, 0x12, 0xb2, 0x3f, 0x48, 0x1e, 0xd4, 0x12, 0xb2, 0x6f, 0x24, 0xde, - 0x15, 0x6c, 0x6d, 0x8d, 0xed, 0xd5, 0xcd, 0xdf, 0xf2, 0x9f, 0xc0, 0xbd, 0x7f, 0xfb, 0x7d, 0x1e, - 0xc6, 0x2a, 0xca, 0x7d, 0x27, 0xe0, 0xa9, 0xab, 0x5f, 0xc5, 0x65, 0x58, 0x05, 0x6e, 0x73, 0x47, - 0x21, 0x65, 0xae, 0xf0, 0x5f, 0x86, 0xdc, 0x3d, 0x3f, 0x2d, 0xff, 0x4e, 0xdf, 0xd5, 0xec, 0x6f, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xb4, 0x14, 0x29, 0x8c, 0x75, 0x03, 0x00, 0x00, + // 453 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x53, 0xdf, 0x6b, 0xd4, 0x40, + 0x10, 0x26, 0x77, 0x5e, 0xe9, 0x4d, 0xac, 0x77, 0xae, 0x82, 0xc7, 0xa1, 0xf4, 0x7a, 0x4f, 0xf7, + 0x62, 0x02, 0x2d, 0x82, 0x28, 0x45, 0xaa, 0x94, 0xaa, 0xa0, 0xc8, 0x56, 0x10, 0x04, 0x59, 0x26, + 0xb9, 0x31, 0x17, 0x9a, 0xec, 0x86, 0xcd, 0xe6, 0xda, 0xfc, 0x59, 0xbe, 0xf8, 0xff, 0xf8, 0x9f, + 0x48, 0x36, 0x31, 0xf7, 0xa3, 0x85, 0x7b, 0xf3, 0x6d, 0x66, 0xbe, 0x6f, 0xbe, 0x9d, 0xfd, 0x86, + 0x81, 0xf1, 0xcf, 0xa4, 0x34, 0x14, 0xcf, 0x13, 0x3f, 0x4b, 0x8a, 0x28, 0x96, 0xb9, 0xaf, 0xb1, + 0xf4, 0x32, 0xad, 0x8c, 0x62, 0xc3, 0x7f, 0x98, 0xd7, 0x60, 0xd3, 0x05, 0xec, 0x71, 0x2c, 0x3f, + 0xaa, 0x80, 0x9d, 0x82, 0xab, 0xb1, 0x14, 0x61, 0x52, 0xe4, 0x86, 0xf4, 0xc8, 0x99, 0x38, 0x33, + 0xf7, 0xf8, 0xa9, 0xb7, 0xdd, 0xe1, 0x71, 0x2c, 0xdf, 0xd5, 0x1c, 0x0e, 0xba, 0x8d, 0xd9, 0x21, + 0xb8, 0xba, 0x90, 0x26, 0x4e, 0x49, 0x90, 0x5c, 0x8e, 0x3a, 0x13, 0x67, 0xd6, 0xe7, 0xd0, 0x94, + 0xce, 0xe5, 0x72, 0xfa, 0xc7, 0x01, 0x58, 0xf5, 0xb2, 0x0b, 0x18, 0x2c, 0x08, 0xe7, 0x22, 0xd2, + 0xaa, 0xc8, 0x44, 0x9e, 0x51, 0xd8, 0x3c, 0x79, 0x78, 0xfb, 0xc9, 0xf7, 0x84, 0xf3, 0x8b, 0x8a, + 0x77, 0x99, 0x51, 0xc8, 0x0f, 0x16, 0xeb, 0x29, 0xfb, 0x04, 0x0f, 0xaf, 0x95, 0xbe, 0x22, 0xbd, + 0x2e, 0xd5, 0x99, 0x74, 0x67, 0xee, 0xf1, 0xd1, 0x6d, 0xa9, 0x6f, 0x96, 0xba, 0x12, 0x1b, 0x5c, + 0x6f, 0x16, 0xd8, 0x6b, 0x18, 0x93, 0xc4, 0x20, 0x21, 0x11, 0x4b, 0x61, 0x34, 0x91, 0xc0, 0xc2, + 0xa8, 0x3c, 0xc4, 0x24, 0x96, 0xd1, 0xa8, 0x3b, 0x71, 0x66, 0xfb, 0xfc, 0x49, 0xcd, 0xf8, 0x20, + 0xbf, 0x6a, 0xa2, 0xb3, 0x15, 0x3c, 0xfd, 0xe5, 0xc0, 0xc1, 0xc6, 0xb0, 0xec, 0x07, 0x0c, 0x2b, + 0x57, 0x73, 0x83, 0xda, 0x88, 0x0c, 0x35, 0xa6, 0xf9, 0xc8, 0xb1, 0xc3, 0x9d, 0xec, 0xf8, 0x67, + 0x65, 0xf4, 0x65, 0xd5, 0xf6, 0xc5, 0x76, 0x9d, 0x4b, 0xa3, 0x4b, 0xfe, 0x40, 0x6f, 0x14, 0xc7, + 0x67, 0xf0, 0xe8, 0x0e, 0x1a, 0x1b, 0x42, 0xf7, 0x8a, 0x4a, 0x6b, 0x68, 0x9f, 0x57, 0x21, 0x7b, + 0x0c, 0xbd, 0x25, 0x26, 0x05, 0x35, 0x8b, 0xa9, 0x93, 0x57, 0x9d, 0x97, 0xce, 0xf4, 0x77, 0x07, + 0x06, 0x5b, 0xae, 0xb0, 0x67, 0x00, 0xb5, 0x99, 0x12, 0x53, 0x6a, 0x64, 0xfa, 0xb6, 0xf2, 0x19, + 0x53, 0x62, 0x63, 0xd8, 0xd7, 0x94, 0x25, 0x71, 0x88, 0xb9, 0xd5, 0xeb, 0xf1, 0x36, 0x67, 0x47, + 0x70, 0x3f, 0x8d, 0xa5, 0x68, 0xf1, 0xae, 0xc5, 0xdd, 0x34, 0x96, 0x7c, 0x9d, 0x82, 0x37, 0x2b, + 0xca, 0xbd, 0x86, 0x82, 0x37, 0x2d, 0x45, 0xdc, 0x61, 0x5b, 0xcf, 0xda, 0xf6, 0x62, 0xe7, 0x4e, + 0xff, 0x93, 0x71, 0x6f, 0xdf, 0x7c, 0x3f, 0x8d, 0x62, 0xb3, 0x28, 0x02, 0x2f, 0x54, 0xa9, 0x6f, + 0xa7, 0x52, 0x3a, 0xaa, 0x03, 0xbf, 0x3d, 0xc2, 0x88, 0xa4, 0x9f, 0x05, 0xcf, 0x23, 0xe5, 0x6f, + 0xdf, 0x65, 0xb0, 0x67, 0x8f, 0xf2, 0xe4, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd2, 0x3e, 0xf0, + 0x04, 0xb2, 0x03, 0x00, 0x00, } diff --git a/flyteidl/gen/pb-go/flyteidl/plugins/ray.pb.validate.go b/flyteidl/gen/pb-go/flyteidl/plugins/ray.pb.validate.go index e85e27a8ac..1fc1a1df73 100644 --- a/flyteidl/gen/pb-go/flyteidl/plugins/ray.pb.validate.go +++ b/flyteidl/gen/pb-go/flyteidl/plugins/ray.pb.validate.go @@ -144,6 +144,8 @@ func (m *RayCluster) Validate() error { } + // no validation rules for EnableInTreeAutoscaling + return nil } diff --git a/flyteidl/gen/pb-java/flyteidl/plugins/Ray.java b/flyteidl/gen/pb-java/flyteidl/plugins/Ray.java index f035e962e8..fdcd30ef09 100644 --- a/flyteidl/gen/pb-java/flyteidl/plugins/Ray.java +++ b/flyteidl/gen/pb-java/flyteidl/plugins/Ray.java @@ -942,6 +942,15 @@ public interface RayClusterOrBuilder extends */ flyteidl.plugins.Ray.WorkerGroupSpecOrBuilder getWorkerGroupSpecOrBuilder( int index); + + /** + *
+     * Whether to enable in-tree autoscaling.
+     * 
+ * + * bool enable_in_tree_autoscaling = 3; + */ + boolean getEnableInTreeAutoscaling(); } /** *
@@ -1009,6 +1018,11 @@ private RayCluster(
                   input.readMessage(flyteidl.plugins.Ray.WorkerGroupSpec.parser(), extensionRegistry));
               break;
             }
+            case 24: {
+
+              enableInTreeAutoscaling_ = input.readBool();
+              break;
+            }
             default: {
               if (!parseUnknownField(
                   input, unknownFields, extensionRegistry, tag)) {
@@ -1133,6 +1147,19 @@ public flyteidl.plugins.Ray.WorkerGroupSpecOrBuilder getWorkerGroupSpecOrBuilder
       return workerGroupSpec_.get(index);
     }
 
+    public static final int ENABLE_IN_TREE_AUTOSCALING_FIELD_NUMBER = 3;
+    private boolean enableInTreeAutoscaling_;
+    /**
+     * 
+     * Whether to enable in-tree autoscaling.
+     * 
+ * + * bool enable_in_tree_autoscaling = 3; + */ + public boolean getEnableInTreeAutoscaling() { + return enableInTreeAutoscaling_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -1153,6 +1180,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) for (int i = 0; i < workerGroupSpec_.size(); i++) { output.writeMessage(2, workerGroupSpec_.get(i)); } + if (enableInTreeAutoscaling_ != false) { + output.writeBool(3, enableInTreeAutoscaling_); + } unknownFields.writeTo(output); } @@ -1170,6 +1200,10 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, workerGroupSpec_.get(i)); } + if (enableInTreeAutoscaling_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(3, enableInTreeAutoscaling_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -1192,6 +1226,8 @@ public boolean equals(final java.lang.Object obj) { } if (!getWorkerGroupSpecList() .equals(other.getWorkerGroupSpecList())) return false; + if (getEnableInTreeAutoscaling() + != other.getEnableInTreeAutoscaling()) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -1211,6 +1247,9 @@ public int hashCode() { hash = (37 * hash) + WORKER_GROUP_SPEC_FIELD_NUMBER; hash = (53 * hash) + getWorkerGroupSpecList().hashCode(); } + hash = (37 * hash) + ENABLE_IN_TREE_AUTOSCALING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getEnableInTreeAutoscaling()); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -1361,6 +1400,8 @@ public Builder clear() { } else { workerGroupSpecBuilder_.clear(); } + enableInTreeAutoscaling_ = false; + return this; } @@ -1403,6 +1444,7 @@ public flyteidl.plugins.Ray.RayCluster buildPartial() { } else { result.workerGroupSpec_ = workerGroupSpecBuilder_.build(); } + result.enableInTreeAutoscaling_ = enableInTreeAutoscaling_; result.bitField0_ = to_bitField0_; onBuilt(); return result; @@ -1481,6 +1523,9 @@ public Builder mergeFrom(flyteidl.plugins.Ray.RayCluster other) { } } } + if (other.getEnableInTreeAutoscaling() != false) { + setEnableInTreeAutoscaling(other.getEnableInTreeAutoscaling()); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -1975,6 +2020,44 @@ public flyteidl.plugins.Ray.WorkerGroupSpec.Builder addWorkerGroupSpecBuilder( } return workerGroupSpecBuilder_; } + + private boolean enableInTreeAutoscaling_ ; + /** + *
+       * Whether to enable in-tree autoscaling.
+       * 
+ * + * bool enable_in_tree_autoscaling = 3; + */ + public boolean getEnableInTreeAutoscaling() { + return enableInTreeAutoscaling_; + } + /** + *
+       * Whether to enable in-tree autoscaling.
+       * 
+ * + * bool enable_in_tree_autoscaling = 3; + */ + public Builder setEnableInTreeAutoscaling(boolean value) { + + enableInTreeAutoscaling_ = value; + onChanged(); + return this; + } + /** + *
+       * Whether to enable in-tree autoscaling.
+       * 
+ * + * bool enable_in_tree_autoscaling = 3; + */ + public Builder clearEnableInTreeAutoscaling() { + + enableInTreeAutoscaling_ = false; + onChanged(); + return this; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { @@ -4110,22 +4193,23 @@ public flyteidl.plugins.Ray.WorkerGroupSpec getDefaultInstanceForType() { "\n\032flyteidl/plugins/ray.proto\022\020flyteidl.p" + "lugins\"P\n\006RayJob\0221\n\013ray_cluster\030\001 \001(\0132\034." + "flyteidl.plugins.RayCluster\022\023\n\013runtime_e" + - "nv\030\002 \001(\t\"\204\001\n\nRayCluster\0228\n\017head_group_sp" + + "nv\030\002 \001(\t\"\250\001\n\nRayCluster\0228\n\017head_group_sp" + "ec\030\001 \001(\0132\037.flyteidl.plugins.HeadGroupSpe" + "c\022<\n\021worker_group_spec\030\002 \003(\0132!.flyteidl." + - "plugins.WorkerGroupSpec\"\225\001\n\rHeadGroupSpe" + - "c\022M\n\020ray_start_params\030\001 \003(\01323.flyteidl.p" + - "lugins.HeadGroupSpec.RayStartParamsEntry" + - "\0325\n\023RayStartParamsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005" + - "value\030\002 \001(\t:\0028\001\"\353\001\n\017WorkerGroupSpec\022\022\n\ng" + - "roup_name\030\001 \001(\t\022\020\n\010replicas\030\002 \001(\005\022\024\n\014min" + - "_replicas\030\003 \001(\005\022\024\n\014max_replicas\030\004 \001(\005\022O\n" + - "\020ray_start_params\030\005 \003(\01325.flyteidl.plugi" + - "ns.WorkerGroupSpec.RayStartParamsEntry\0325" + - "\n\023RayStartParamsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005va" + - "lue\030\002 \001(\t:\0028\001B?Z=github.com/flyteorg/fly" + - "te/flyteidl/gen/pb-go/flyteidl/pluginsb\006" + - "proto3" + "plugins.WorkerGroupSpec\022\"\n\032enable_in_tre" + + "e_autoscaling\030\003 \001(\010\"\225\001\n\rHeadGroupSpec\022M\n" + + "\020ray_start_params\030\001 \003(\01323.flyteidl.plugi" + + "ns.HeadGroupSpec.RayStartParamsEntry\0325\n\023" + + "RayStartParamsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005valu" + + "e\030\002 \001(\t:\0028\001\"\353\001\n\017WorkerGroupSpec\022\022\n\ngroup" + + "_name\030\001 \001(\t\022\020\n\010replicas\030\002 \001(\005\022\024\n\014min_rep" + + "licas\030\003 \001(\005\022\024\n\014max_replicas\030\004 \001(\005\022O\n\020ray" + + "_start_params\030\005 \003(\01325.flyteidl.plugins.W" + + "orkerGroupSpec.RayStartParamsEntry\0325\n\023Ra" + + "yStartParamsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030" + + "\002 \001(\t:\0028\001B?Z=github.com/flyteorg/flyte/f" + + "lyteidl/gen/pb-go/flyteidl/pluginsb\006prot" + + "o3" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { @@ -4150,7 +4234,7 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( internal_static_flyteidl_plugins_RayCluster_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_flyteidl_plugins_RayCluster_descriptor, - new java.lang.String[] { "HeadGroupSpec", "WorkerGroupSpec", }); + new java.lang.String[] { "HeadGroupSpec", "WorkerGroupSpec", "EnableInTreeAutoscaling", }); internal_static_flyteidl_plugins_HeadGroupSpec_descriptor = getDescriptor().getMessageTypes().get(2); internal_static_flyteidl_plugins_HeadGroupSpec_fieldAccessorTable = new diff --git a/flyteidl/gen/pb_python/flyteidl/plugins/ray_pb2.py b/flyteidl/gen/pb_python/flyteidl/plugins/ray_pb2.py index 08c33c782c..7871f53400 100644 --- a/flyteidl/gen/pb_python/flyteidl/plugins/ray_pb2.py +++ b/flyteidl/gen/pb_python/flyteidl/plugins/ray_pb2.py @@ -13,7 +13,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1a\x66lyteidl/plugins/ray.proto\x12\x10\x66lyteidl.plugins\"h\n\x06RayJob\x12=\n\x0bray_cluster\x18\x01 \x01(\x0b\x32\x1c.flyteidl.plugins.RayClusterR\nrayCluster\x12\x1f\n\x0bruntime_env\x18\x02 \x01(\tR\nruntimeEnv\"\xa4\x01\n\nRayCluster\x12G\n\x0fhead_group_spec\x18\x01 \x01(\x0b\x32\x1f.flyteidl.plugins.HeadGroupSpecR\rheadGroupSpec\x12M\n\x11worker_group_spec\x18\x02 \x03(\x0b\x32!.flyteidl.plugins.WorkerGroupSpecR\x0fworkerGroupSpec\"\xb1\x01\n\rHeadGroupSpec\x12]\n\x10ray_start_params\x18\x01 \x03(\x0b\x32\x33.flyteidl.plugins.HeadGroupSpec.RayStartParamsEntryR\x0erayStartParams\x1a\x41\n\x13RayStartParamsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\"\xb6\x02\n\x0fWorkerGroupSpec\x12\x1d\n\ngroup_name\x18\x01 \x01(\tR\tgroupName\x12\x1a\n\x08replicas\x18\x02 \x01(\x05R\x08replicas\x12!\n\x0cmin_replicas\x18\x03 \x01(\x05R\x0bminReplicas\x12!\n\x0cmax_replicas\x18\x04 \x01(\x05R\x0bmaxReplicas\x12_\n\x10ray_start_params\x18\x05 \x03(\x0b\x32\x35.flyteidl.plugins.WorkerGroupSpec.RayStartParamsEntryR\x0erayStartParams\x1a\x41\n\x13RayStartParamsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\x42\xc0\x01\n\x14\x63om.flyteidl.pluginsB\x08RayProtoP\x01Z=github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/plugins\xa2\x02\x03\x46PX\xaa\x02\x10\x46lyteidl.Plugins\xca\x02\x10\x46lyteidl\\Plugins\xe2\x02\x1c\x46lyteidl\\Plugins\\GPBMetadata\xea\x02\x11\x46lyteidl::Pluginsb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1a\x66lyteidl/plugins/ray.proto\x12\x10\x66lyteidl.plugins\"h\n\x06RayJob\x12=\n\x0bray_cluster\x18\x01 \x01(\x0b\x32\x1c.flyteidl.plugins.RayClusterR\nrayCluster\x12\x1f\n\x0bruntime_env\x18\x02 \x01(\tR\nruntimeEnv\"\xe1\x01\n\nRayCluster\x12G\n\x0fhead_group_spec\x18\x01 \x01(\x0b\x32\x1f.flyteidl.plugins.HeadGroupSpecR\rheadGroupSpec\x12M\n\x11worker_group_spec\x18\x02 \x03(\x0b\x32!.flyteidl.plugins.WorkerGroupSpecR\x0fworkerGroupSpec\x12;\n\x1a\x65nable_in_tree_autoscaling\x18\x03 \x01(\x08R\x17\x65nableInTreeAutoscaling\"\xb1\x01\n\rHeadGroupSpec\x12]\n\x10ray_start_params\x18\x01 \x03(\x0b\x32\x33.flyteidl.plugins.HeadGroupSpec.RayStartParamsEntryR\x0erayStartParams\x1a\x41\n\x13RayStartParamsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\"\xb6\x02\n\x0fWorkerGroupSpec\x12\x1d\n\ngroup_name\x18\x01 \x01(\tR\tgroupName\x12\x1a\n\x08replicas\x18\x02 \x01(\x05R\x08replicas\x12!\n\x0cmin_replicas\x18\x03 \x01(\x05R\x0bminReplicas\x12!\n\x0cmax_replicas\x18\x04 \x01(\x05R\x0bmaxReplicas\x12_\n\x10ray_start_params\x18\x05 \x03(\x0b\x32\x35.flyteidl.plugins.WorkerGroupSpec.RayStartParamsEntryR\x0erayStartParams\x1a\x41\n\x13RayStartParamsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\x42\xc0\x01\n\x14\x63om.flyteidl.pluginsB\x08RayProtoP\x01Z=github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/plugins\xa2\x02\x03\x46PX\xaa\x02\x10\x46lyteidl.Plugins\xca\x02\x10\x46lyteidl\\Plugins\xe2\x02\x1c\x46lyteidl\\Plugins\\GPBMetadata\xea\x02\x11\x46lyteidl::Pluginsb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -29,13 +29,13 @@ _globals['_RAYJOB']._serialized_start=48 _globals['_RAYJOB']._serialized_end=152 _globals['_RAYCLUSTER']._serialized_start=155 - _globals['_RAYCLUSTER']._serialized_end=319 - _globals['_HEADGROUPSPEC']._serialized_start=322 - _globals['_HEADGROUPSPEC']._serialized_end=499 - _globals['_HEADGROUPSPEC_RAYSTARTPARAMSENTRY']._serialized_start=434 - _globals['_HEADGROUPSPEC_RAYSTARTPARAMSENTRY']._serialized_end=499 - _globals['_WORKERGROUPSPEC']._serialized_start=502 - _globals['_WORKERGROUPSPEC']._serialized_end=812 - _globals['_WORKERGROUPSPEC_RAYSTARTPARAMSENTRY']._serialized_start=434 - _globals['_WORKERGROUPSPEC_RAYSTARTPARAMSENTRY']._serialized_end=499 + _globals['_RAYCLUSTER']._serialized_end=380 + _globals['_HEADGROUPSPEC']._serialized_start=383 + _globals['_HEADGROUPSPEC']._serialized_end=560 + _globals['_HEADGROUPSPEC_RAYSTARTPARAMSENTRY']._serialized_start=495 + _globals['_HEADGROUPSPEC_RAYSTARTPARAMSENTRY']._serialized_end=560 + _globals['_WORKERGROUPSPEC']._serialized_start=563 + _globals['_WORKERGROUPSPEC']._serialized_end=873 + _globals['_WORKERGROUPSPEC_RAYSTARTPARAMSENTRY']._serialized_start=495 + _globals['_WORKERGROUPSPEC_RAYSTARTPARAMSENTRY']._serialized_end=560 # @@protoc_insertion_point(module_scope) diff --git a/flyteidl/gen/pb_python/flyteidl/plugins/ray_pb2.pyi b/flyteidl/gen/pb_python/flyteidl/plugins/ray_pb2.pyi index 16b67e478a..f5daa7f0b6 100644 --- a/flyteidl/gen/pb_python/flyteidl/plugins/ray_pb2.pyi +++ b/flyteidl/gen/pb_python/flyteidl/plugins/ray_pb2.pyi @@ -14,12 +14,14 @@ class RayJob(_message.Message): def __init__(self, ray_cluster: _Optional[_Union[RayCluster, _Mapping]] = ..., runtime_env: _Optional[str] = ...) -> None: ... class RayCluster(_message.Message): - __slots__ = ["head_group_spec", "worker_group_spec"] + __slots__ = ["head_group_spec", "worker_group_spec", "enable_in_tree_autoscaling"] HEAD_GROUP_SPEC_FIELD_NUMBER: _ClassVar[int] WORKER_GROUP_SPEC_FIELD_NUMBER: _ClassVar[int] + ENABLE_IN_TREE_AUTOSCALING_FIELD_NUMBER: _ClassVar[int] head_group_spec: HeadGroupSpec worker_group_spec: _containers.RepeatedCompositeFieldContainer[WorkerGroupSpec] - def __init__(self, head_group_spec: _Optional[_Union[HeadGroupSpec, _Mapping]] = ..., worker_group_spec: _Optional[_Iterable[_Union[WorkerGroupSpec, _Mapping]]] = ...) -> None: ... + enable_in_tree_autoscaling: bool + def __init__(self, head_group_spec: _Optional[_Union[HeadGroupSpec, _Mapping]] = ..., worker_group_spec: _Optional[_Iterable[_Union[WorkerGroupSpec, _Mapping]]] = ..., enable_in_tree_autoscaling: bool = ...) -> None: ... class HeadGroupSpec(_message.Message): __slots__ = ["ray_start_params"] diff --git a/flyteidl/gen/pb_rust/flyteidl.plugins.rs b/flyteidl/gen/pb_rust/flyteidl.plugins.rs index 11e4ad05af..49f8a10a14 100644 --- a/flyteidl/gen/pb_rust/flyteidl.plugins.rs +++ b/flyteidl/gen/pb_rust/flyteidl.plugins.rs @@ -186,6 +186,9 @@ pub struct RayCluster { /// WorkerGroupSpecs are the specs for the worker pods #[prost(message, repeated, tag="2")] pub worker_group_spec: ::prost::alloc::vec::Vec, + /// Whether to enable in-tree autoscaling. + #[prost(bool, tag="3")] + pub enable_in_tree_autoscaling: bool, } /// HeadGroupSpec are the spec for the head pod #[allow(clippy::derive_partial_eq_without_eq)] diff --git a/flyteidl/protos/flyteidl/plugins/ray.proto b/flyteidl/protos/flyteidl/plugins/ray.proto index 1f80a4b4f3..abe54a8bce 100644 --- a/flyteidl/protos/flyteidl/plugins/ray.proto +++ b/flyteidl/protos/flyteidl/plugins/ray.proto @@ -19,6 +19,8 @@ message RayCluster { HeadGroupSpec head_group_spec = 1; // WorkerGroupSpecs are the specs for the worker pods repeated WorkerGroupSpec worker_group_spec = 2; + // Whether to enable in-tree autoscaling. + bool enable_in_tree_autoscaling = 3; } // HeadGroupSpec are the spec for the head pod diff --git a/flyteplugins/go/tasks/plugins/k8s/ray/ray.go b/flyteplugins/go/tasks/plugins/k8s/ray/ray.go index c1dcc2b8e2..bd312b65ee 100644 --- a/flyteplugins/go/tasks/plugins/k8s/ray/ray.go +++ b/flyteplugins/go/tasks/plugins/k8s/ray/ray.go @@ -79,6 +79,7 @@ func (rayJobResourceHandler) BuildResource(ctx context.Context, taskCtx pluginsC } cfg := GetConfig() + fmt.Println("cfg", cfg) headReplicas := int32(1) headNodeRayStartParams := make(map[string]string) if rayJob.RayCluster.HeadGroupSpec != nil && rayJob.RayCluster.HeadGroupSpec.RayStartParams != nil { @@ -118,7 +119,8 @@ func (rayJobResourceHandler) BuildResource(ctx context.Context, taskCtx pluginsC EnableIngress: &enableIngress, RayStartParams: headNodeRayStartParams, }, - WorkerGroupSpecs: []rayv1alpha1.WorkerGroupSpec{}, + WorkerGroupSpecs: []rayv1alpha1.WorkerGroupSpec{}, + EnableInTreeAutoscaling: &rayJob.RayCluster.EnableInTreeAutoscaling, } for _, spec := range rayJob.RayCluster.WorkerGroupSpec { From 3803e375baef8d0798fc0f73d494fd56a4bf3832 Mon Sep 17 00:00:00 2001 From: Yicheng-Lu-llll Date: Mon, 6 Nov 2023 00:05:41 +0000 Subject: [PATCH 02/13] remove print Signed-off-by: Yicheng-Lu-llll --- flyteplugins/go/tasks/plugins/k8s/ray/ray.go | 1 - 1 file changed, 1 deletion(-) diff --git a/flyteplugins/go/tasks/plugins/k8s/ray/ray.go b/flyteplugins/go/tasks/plugins/k8s/ray/ray.go index bd312b65ee..791797f7c2 100644 --- a/flyteplugins/go/tasks/plugins/k8s/ray/ray.go +++ b/flyteplugins/go/tasks/plugins/k8s/ray/ray.go @@ -79,7 +79,6 @@ func (rayJobResourceHandler) BuildResource(ctx context.Context, taskCtx pluginsC } cfg := GetConfig() - fmt.Println("cfg", cfg) headReplicas := int32(1) headNodeRayStartParams := make(map[string]string) if rayJob.RayCluster.HeadGroupSpec != nil && rayJob.RayCluster.HeadGroupSpec.RayStartParams != nil { From 4d91dce5f4b7ac278ff816e545877a2385a2a2ff Mon Sep 17 00:00:00 2001 From: Yicheng-Lu-llll Date: Mon, 6 Nov 2023 02:49:00 +0000 Subject: [PATCH 03/13] allow MinReplicas to be zero Signed-off-by: Yicheng-Lu-llll --- flyteplugins/go/tasks/plugins/k8s/ray/ray.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/flyteplugins/go/tasks/plugins/k8s/ray/ray.go b/flyteplugins/go/tasks/plugins/k8s/ray/ray.go index 791797f7c2..4561e40df3 100644 --- a/flyteplugins/go/tasks/plugins/k8s/ray/ray.go +++ b/flyteplugins/go/tasks/plugins/k8s/ray/ray.go @@ -131,16 +131,6 @@ func (rayJobResourceHandler) BuildResource(ctx context.Context, taskCtx pluginsC taskCtx, ) - minReplicas := spec.Replicas - maxReplicas := spec.Replicas - if spec.MinReplicas != 0 { - minReplicas = spec.MinReplicas - } - - if spec.MaxReplicas != 0 { - maxReplicas = spec.MaxReplicas - } - workerNodeRayStartParams := make(map[string]string) if spec.RayStartParams != nil { workerNodeRayStartParams = spec.RayStartParams @@ -158,8 +148,8 @@ func (rayJobResourceHandler) BuildResource(ctx context.Context, taskCtx pluginsC workerNodeSpec := rayv1alpha1.WorkerGroupSpec{ GroupName: spec.GroupName, - MinReplicas: &minReplicas, - MaxReplicas: &maxReplicas, + MinReplicas: &spec.MinReplicas, + MaxReplicas: &spec.MaxReplicas, Replicas: &spec.Replicas, RayStartParams: workerNodeRayStartParams, Template: workerPodTemplate, From 29cd14d4ad9d7f55a87bcf3c22245e4367bf0de8 Mon Sep 17 00:00:00 2001 From: Yicheng-Lu-llll Date: Mon, 6 Nov 2023 18:36:26 +0000 Subject: [PATCH 04/13] fix ci test Signed-off-by: Yicheng-Lu-llll --- .../go/tasks/plugins/k8s/ray/ray_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go b/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go index 920fa85d61..66d522cf29 100644 --- a/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go +++ b/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go @@ -176,7 +176,7 @@ func TestBuildResourceRay(t *testing.T) { assert.True(t, ok) headReplica := int32(1) - assert.Equal(t, ray.Spec.RayClusterSpec.HeadGroupSpec.Replicas, &headReplica) + assert.Equal(t, *ray.Spec.RayClusterSpec.HeadGroupSpec.Replicas, headReplica) assert.Equal(t, ray.Spec.RayClusterSpec.HeadGroupSpec.Template.Spec.ServiceAccountName, serviceAccount) assert.Equal(t, ray.Spec.RayClusterSpec.HeadGroupSpec.RayStartParams, map[string]string{ @@ -187,9 +187,9 @@ func TestBuildResourceRay(t *testing.T) { assert.Equal(t, ray.Spec.RayClusterSpec.HeadGroupSpec.Template.Spec.Tolerations, toleration) workerReplica := int32(3) - assert.Equal(t, ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].Replicas, &workerReplica) - assert.Equal(t, ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].MinReplicas, &workerReplica) - assert.Equal(t, ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].MaxReplicas, &workerReplica) + assert.Equal(t, *ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].Replicas, workerReplica) + assert.Equal(t, *ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].MinReplicas, workerReplica) + assert.Equal(t, *ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].MaxReplicas, workerReplica) assert.Equal(t, ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].GroupName, workerGroupName) assert.Equal(t, ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].Template.Spec.ServiceAccountName, serviceAccount) assert.Equal(t, ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].RayStartParams, map[string]string{"disable-usage-stats": "true", "node-ip-address": "$MY_POD_IP"}) @@ -367,7 +367,7 @@ func TestDefaultStartParameters(t *testing.T) { assert.True(t, ok) headReplica := int32(1) - assert.Equal(t, ray.Spec.RayClusterSpec.HeadGroupSpec.Replicas, &headReplica) + assert.Equal(t, *ray.Spec.RayClusterSpec.HeadGroupSpec.Replicas, headReplica) assert.Equal(t, ray.Spec.RayClusterSpec.HeadGroupSpec.Template.Spec.ServiceAccountName, serviceAccount) assert.Equal(t, ray.Spec.RayClusterSpec.HeadGroupSpec.RayStartParams, map[string]string{ @@ -378,9 +378,9 @@ func TestDefaultStartParameters(t *testing.T) { assert.Equal(t, ray.Spec.RayClusterSpec.HeadGroupSpec.Template.Spec.Tolerations, toleration) workerReplica := int32(3) - assert.Equal(t, ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].Replicas, &workerReplica) - assert.Equal(t, ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].MinReplicas, &workerReplica) - assert.Equal(t, ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].MaxReplicas, &workerReplica) + assert.Equal(t, *ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].Replicas, workerReplica) + assert.Equal(t, *ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].MinReplicas, workerReplica) + assert.Equal(t, *ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].MaxReplicas, workerReplica) assert.Equal(t, ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].GroupName, workerGroupName) assert.Equal(t, ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].Template.Spec.ServiceAccountName, serviceAccount) assert.Equal(t, ray.Spec.RayClusterSpec.WorkerGroupSpecs[0].RayStartParams, map[string]string{"disable-usage-stats": "true", "node-ip-address": "$MY_POD_IP"}) From b3e0121ac4aeb48d28c460ce0bc4532254b0849e Mon Sep 17 00:00:00 2001 From: Yicheng-Lu-llll Date: Mon, 6 Nov 2023 20:03:22 +0000 Subject: [PATCH 05/13] fix ci test Signed-off-by: Yicheng-Lu-llll --- flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go b/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go index 66d522cf29..b524befcc4 100644 --- a/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go +++ b/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go @@ -78,8 +78,9 @@ func transformPodSpecToTaskTemplateTarget(podSpec *corev1.PodSpec) *core.TaskTem func dummyRayCustomObj() *plugins.RayJob { return &plugins.RayJob{ RayCluster: &plugins.RayCluster{ - HeadGroupSpec: &plugins.HeadGroupSpec{RayStartParams: map[string]string{"num-cpus": "1"}}, - WorkerGroupSpec: []*plugins.WorkerGroupSpec{{GroupName: workerGroupName, Replicas: 3}}, + HeadGroupSpec: &plugins.HeadGroupSpec{RayStartParams: map[string]string{"num-cpus": "1"}}, + WorkerGroupSpec: []*plugins.WorkerGroupSpec{{GroupName: workerGroupName, Replicas: 3, MinReplicas: 3, MaxReplicas: 3}}, + EnableInTreeAutoscaling: false, }, } } @@ -175,6 +176,8 @@ func TestBuildResourceRay(t *testing.T) { ray, ok := RayResource.(*rayv1alpha1.RayJob) assert.True(t, ok) + assert.Equal(t, *ray.Spec.RayClusterSpec.EnableInTreeAutoscaling, false) + headReplica := int32(1) assert.Equal(t, *ray.Spec.RayClusterSpec.HeadGroupSpec.Replicas, headReplica) assert.Equal(t, ray.Spec.RayClusterSpec.HeadGroupSpec.Template.Spec.ServiceAccountName, serviceAccount) @@ -344,8 +347,9 @@ func TestDefaultStartParameters(t *testing.T) { rayJobResourceHandler := rayJobResourceHandler{} rayJob := &plugins.RayJob{ RayCluster: &plugins.RayCluster{ - HeadGroupSpec: &plugins.HeadGroupSpec{}, - WorkerGroupSpec: []*plugins.WorkerGroupSpec{{GroupName: workerGroupName, Replicas: 3}}, + HeadGroupSpec: &plugins.HeadGroupSpec{}, + WorkerGroupSpec: []*plugins.WorkerGroupSpec{{GroupName: workerGroupName, Replicas: 3, MinReplicas: 3, MaxReplicas: 3}}, + EnableInTreeAutoscaling: false, }, } @@ -366,6 +370,8 @@ func TestDefaultStartParameters(t *testing.T) { ray, ok := RayResource.(*rayv1alpha1.RayJob) assert.True(t, ok) + assert.Equal(t, *ray.Spec.RayClusterSpec.EnableInTreeAutoscaling, false) + headReplica := int32(1) assert.Equal(t, *ray.Spec.RayClusterSpec.HeadGroupSpec.Replicas, headReplica) assert.Equal(t, ray.Spec.RayClusterSpec.HeadGroupSpec.Template.Spec.ServiceAccountName, serviceAccount) From 4081020779bcc8855175c32ca480b382eb3c7d8d Mon Sep 17 00:00:00 2001 From: Yicheng-Lu-llll Date: Fri, 22 Dec 2023 02:19:58 +0000 Subject: [PATCH 06/13] add ttl Signed-off-by: Yicheng-Lu-llll --- .../gen/pb-cpp/flyteidl/plugins/ray.pb.cc | 187 +++++++++--- flyteidl/gen/pb-cpp/flyteidl/plugins/ray.pb.h | 72 ++++- flyteidl/gen/pb-go/flyteidl/plugins/ray.pb.go | 103 ++++--- .../pb-go/flyteidl/plugins/ray.pb.validate.go | 6 +- .../gen/pb-java/flyteidl/plugins/Ray.java | 278 ++++++++++++++---- .../gen/pb_python/flyteidl/plugins/ray_pb2.py | 26 +- .../pb_python/flyteidl/plugins/ray_pb2.pyi | 16 +- flyteidl/gen/pb_rust/flyteidl.plugins.rs | 10 +- flyteidl/protos/flyteidl/plugins/ray.proto | 8 +- flyteplugins/go/tasks/plugins/k8s/ray/ray.go | 13 +- 10 files changed, 533 insertions(+), 186 deletions(-) diff --git a/flyteidl/gen/pb-cpp/flyteidl/plugins/ray.pb.cc b/flyteidl/gen/pb-cpp/flyteidl/plugins/ray.pb.cc index f36225f9f9..7579e59cc0 100644 --- a/flyteidl/gen/pb-cpp/flyteidl/plugins/ray.pb.cc +++ b/flyteidl/gen/pb-cpp/flyteidl/plugins/ray.pb.cc @@ -157,6 +157,8 @@ const ::google::protobuf::uint32 TableStruct_flyteidl_2fplugins_2fray_2eproto::o ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::flyteidl::plugins::RayJob, ray_cluster_), PROTOBUF_FIELD_OFFSET(::flyteidl::plugins::RayJob, runtime_env_), + PROTOBUF_FIELD_OFFSET(::flyteidl::plugins::RayJob, shutdown_after_job_finishes_), + PROTOBUF_FIELD_OFFSET(::flyteidl::plugins::RayJob, ttl_seconds_after_finished_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::flyteidl::plugins::RayCluster, _internal_metadata_), ~0u, // no _extensions_ @@ -164,7 +166,7 @@ const ::google::protobuf::uint32 TableStruct_flyteidl_2fplugins_2fray_2eproto::o ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::flyteidl::plugins::RayCluster, head_group_spec_), PROTOBUF_FIELD_OFFSET(::flyteidl::plugins::RayCluster, worker_group_spec_), - PROTOBUF_FIELD_OFFSET(::flyteidl::plugins::RayCluster, enable_in_tree_autoscaling_), + PROTOBUF_FIELD_OFFSET(::flyteidl::plugins::RayCluster, enable_autoscaling_), PROTOBUF_FIELD_OFFSET(::flyteidl::plugins::HeadGroupSpec_RayStartParamsEntry_DoNotUse, _has_bits_), PROTOBUF_FIELD_OFFSET(::flyteidl::plugins::HeadGroupSpec_RayStartParamsEntry_DoNotUse, _internal_metadata_), ~0u, // no _extensions_ @@ -202,11 +204,11 @@ const ::google::protobuf::uint32 TableStruct_flyteidl_2fplugins_2fray_2eproto::o }; static const ::google::protobuf::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, -1, sizeof(::flyteidl::plugins::RayJob)}, - { 7, -1, sizeof(::flyteidl::plugins::RayCluster)}, - { 15, 22, sizeof(::flyteidl::plugins::HeadGroupSpec_RayStartParamsEntry_DoNotUse)}, - { 24, -1, sizeof(::flyteidl::plugins::HeadGroupSpec)}, - { 30, 37, sizeof(::flyteidl::plugins::WorkerGroupSpec_RayStartParamsEntry_DoNotUse)}, - { 39, -1, sizeof(::flyteidl::plugins::WorkerGroupSpec)}, + { 9, -1, sizeof(::flyteidl::plugins::RayCluster)}, + { 17, 24, sizeof(::flyteidl::plugins::HeadGroupSpec_RayStartParamsEntry_DoNotUse)}, + { 26, -1, sizeof(::flyteidl::plugins::HeadGroupSpec)}, + { 32, 39, sizeof(::flyteidl::plugins::WorkerGroupSpec_RayStartParamsEntry_DoNotUse)}, + { 41, -1, sizeof(::flyteidl::plugins::WorkerGroupSpec)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { @@ -226,30 +228,31 @@ ::google::protobuf::internal::AssignDescriptorsTable assign_descriptors_table_fl const char descriptor_table_protodef_flyteidl_2fplugins_2fray_2eproto[] = "\n\032flyteidl/plugins/ray.proto\022\020flyteidl.p" - "lugins\"P\n\006RayJob\0221\n\013ray_cluster\030\001 \001(\0132\034." - "flyteidl.plugins.RayCluster\022\023\n\013runtime_e" - "nv\030\002 \001(\t\"\250\001\n\nRayCluster\0228\n\017head_group_sp" - "ec\030\001 \001(\0132\037.flyteidl.plugins.HeadGroupSpe" - "c\022<\n\021worker_group_spec\030\002 \003(\0132!.flyteidl." - "plugins.WorkerGroupSpec\022\"\n\032enable_in_tre" - "e_autoscaling\030\003 \001(\010\"\225\001\n\rHeadGroupSpec\022M\n" - "\020ray_start_params\030\001 \003(\01323.flyteidl.plugi" - "ns.HeadGroupSpec.RayStartParamsEntry\0325\n\023" - "RayStartParamsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005valu" - "e\030\002 \001(\t:\0028\001\"\353\001\n\017WorkerGroupSpec\022\022\n\ngroup" - "_name\030\001 \001(\t\022\020\n\010replicas\030\002 \001(\005\022\024\n\014min_rep" - "licas\030\003 \001(\005\022\024\n\014max_replicas\030\004 \001(\005\022O\n\020ray" - "_start_params\030\005 \003(\01325.flyteidl.plugins.W" - "orkerGroupSpec.RayStartParamsEntry\0325\n\023Ra" - "yStartParamsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030" - "\002 \001(\t:\0028\001B\?Z=github.com/flyteorg/flyte/f" - "lyteidl/gen/pb-go/flyteidl/pluginsb\006prot" - "o3" + "lugins\"\231\001\n\006RayJob\0221\n\013ray_cluster\030\001 \001(\0132\034" + ".flyteidl.plugins.RayCluster\022\023\n\013runtime_" + "env\030\002 \001(\t\022#\n\033shutdown_after_job_finishes" + "\030\003 \001(\010\022\"\n\032ttl_seconds_after_finished\030\004 \001" + "(\005\"\240\001\n\nRayCluster\0228\n\017head_group_spec\030\001 \001" + "(\0132\037.flyteidl.plugins.HeadGroupSpec\022<\n\021w" + "orker_group_spec\030\002 \003(\0132!.flyteidl.plugin" + "s.WorkerGroupSpec\022\032\n\022enable_autoscaling\030" + "\003 \001(\010\"\225\001\n\rHeadGroupSpec\022M\n\020ray_start_par" + "ams\030\001 \003(\01323.flyteidl.plugins.HeadGroupSp" + "ec.RayStartParamsEntry\0325\n\023RayStartParams" + "Entry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\353\001" + "\n\017WorkerGroupSpec\022\022\n\ngroup_name\030\001 \001(\t\022\020\n" + "\010replicas\030\002 \001(\005\022\024\n\014min_replicas\030\003 \001(\005\022\024\n" + "\014max_replicas\030\004 \001(\005\022O\n\020ray_start_params\030" + "\005 \003(\01325.flyteidl.plugins.WorkerGroupSpec" + ".RayStartParamsEntry\0325\n\023RayStartParamsEn" + "try\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001B\?Z=g" + "ithub.com/flyteorg/flyte/flyteidl/gen/pb" + "-go/flyteidl/pluginsb\006proto3" ; ::google::protobuf::internal::DescriptorTable descriptor_table_flyteidl_2fplugins_2fray_2eproto = { false, InitDefaults_flyteidl_2fplugins_2fray_2eproto, descriptor_table_protodef_flyteidl_2fplugins_2fray_2eproto, - "flyteidl/plugins/ray.proto", &assign_descriptors_table_flyteidl_2fplugins_2fray_2eproto, 762, + "flyteidl/plugins/ray.proto", &assign_descriptors_table_flyteidl_2fplugins_2fray_2eproto, 828, }; void AddDescriptors_flyteidl_2fplugins_2fray_2eproto() { @@ -282,6 +285,8 @@ RayJob::HasBitSetters::ray_cluster(const RayJob* msg) { #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int RayJob::kRayClusterFieldNumber; const int RayJob::kRuntimeEnvFieldNumber; +const int RayJob::kShutdownAfterJobFinishesFieldNumber; +const int RayJob::kTtlSecondsAfterFinishedFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 RayJob::RayJob() @@ -302,6 +307,9 @@ RayJob::RayJob(const RayJob& from) } else { ray_cluster_ = nullptr; } + ::memcpy(&shutdown_after_job_finishes_, &from.shutdown_after_job_finishes_, + static_cast(reinterpret_cast(&ttl_seconds_after_finished_) - + reinterpret_cast(&shutdown_after_job_finishes_)) + sizeof(ttl_seconds_after_finished_)); // @@protoc_insertion_point(copy_constructor:flyteidl.plugins.RayJob) } @@ -309,7 +317,9 @@ void RayJob::SharedCtor() { ::google::protobuf::internal::InitSCC( &scc_info_RayJob_flyteidl_2fplugins_2fray_2eproto.base); runtime_env_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ray_cluster_ = nullptr; + ::memset(&ray_cluster_, 0, static_cast( + reinterpret_cast(&ttl_seconds_after_finished_) - + reinterpret_cast(&ray_cluster_)) + sizeof(ttl_seconds_after_finished_)); } RayJob::~RayJob() { @@ -342,6 +352,9 @@ void RayJob::Clear() { delete ray_cluster_; } ray_cluster_ = nullptr; + ::memset(&shutdown_after_job_finishes_, 0, static_cast( + reinterpret_cast(&ttl_seconds_after_finished_) - + reinterpret_cast(&shutdown_after_job_finishes_)) + sizeof(ttl_seconds_after_finished_)); _internal_metadata_.Clear(); } @@ -387,6 +400,20 @@ const char* RayJob::_InternalParse(const char* begin, const char* end, void* obj ptr += size; break; } + // bool shutdown_after_job_finishes = 3; + case 3: { + if (static_cast<::google::protobuf::uint8>(tag) != 24) goto handle_unusual; + msg->set_shutdown_after_job_finishes(::google::protobuf::internal::ReadVarint(&ptr)); + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); + break; + } + // int32 ttl_seconds_after_finished = 4; + case 4: { + if (static_cast<::google::protobuf::uint8>(tag) != 32) goto handle_unusual; + msg->set_ttl_seconds_after_finished(::google::protobuf::internal::ReadVarint(&ptr)); + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); + break; + } default: { handle_unusual: if ((tag & 7) == 4 || tag == 0) { @@ -447,6 +474,32 @@ bool RayJob::MergePartialFromCodedStream( break; } + // bool shutdown_after_job_finishes = 3; + case 3: { + if (static_cast< ::google::protobuf::uint8>(tag) == (24 & 0xFF)) { + + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &shutdown_after_job_finishes_))); + } else { + goto handle_unusual; + } + break; + } + + // int32 ttl_seconds_after_finished = 4; + case 4: { + if (static_cast< ::google::protobuf::uint8>(tag) == (32 & 0xFF)) { + + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &ttl_seconds_after_finished_))); + } else { + goto handle_unusual; + } + break; + } + default: { handle_unusual: if (tag == 0) { @@ -490,6 +543,16 @@ void RayJob::SerializeWithCachedSizes( 2, this->runtime_env(), output); } + // bool shutdown_after_job_finishes = 3; + if (this->shutdown_after_job_finishes() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteBool(3, this->shutdown_after_job_finishes(), output); + } + + // int32 ttl_seconds_after_finished = 4; + if (this->ttl_seconds_after_finished() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->ttl_seconds_after_finished(), output); + } + if (_internal_metadata_.have_unknown_fields()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( _internal_metadata_.unknown_fields(), output); @@ -521,6 +584,16 @@ ::google::protobuf::uint8* RayJob::InternalSerializeWithCachedSizesToArray( 2, this->runtime_env(), target); } + // bool shutdown_after_job_finishes = 3; + if (this->shutdown_after_job_finishes() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(3, this->shutdown_after_job_finishes(), target); + } + + // int32 ttl_seconds_after_finished = 4; + if (this->ttl_seconds_after_finished() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(4, this->ttl_seconds_after_finished(), target); + } + if (_internal_metadata_.have_unknown_fields()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields(), target); @@ -556,6 +629,18 @@ size_t RayJob::ByteSizeLong() const { *ray_cluster_); } + // bool shutdown_after_job_finishes = 3; + if (this->shutdown_after_job_finishes() != 0) { + total_size += 1 + 1; + } + + // int32 ttl_seconds_after_finished = 4; + if (this->ttl_seconds_after_finished() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->ttl_seconds_after_finished()); + } + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; @@ -590,6 +675,12 @@ void RayJob::MergeFrom(const RayJob& from) { if (from.has_ray_cluster()) { mutable_ray_cluster()->::flyteidl::plugins::RayCluster::MergeFrom(from.ray_cluster()); } + if (from.shutdown_after_job_finishes() != 0) { + set_shutdown_after_job_finishes(from.shutdown_after_job_finishes()); + } + if (from.ttl_seconds_after_finished() != 0) { + set_ttl_seconds_after_finished(from.ttl_seconds_after_finished()); + } } void RayJob::CopyFrom(const ::google::protobuf::Message& from) { @@ -620,6 +711,8 @@ void RayJob::InternalSwap(RayJob* other) { runtime_env_.Swap(&other->runtime_env_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); swap(ray_cluster_, other->ray_cluster_); + swap(shutdown_after_job_finishes_, other->shutdown_after_job_finishes_); + swap(ttl_seconds_after_finished_, other->ttl_seconds_after_finished_); } ::google::protobuf::Metadata RayJob::GetMetadata() const { @@ -646,7 +739,7 @@ RayCluster::HasBitSetters::head_group_spec(const RayCluster* msg) { #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int RayCluster::kHeadGroupSpecFieldNumber; const int RayCluster::kWorkerGroupSpecFieldNumber; -const int RayCluster::kEnableInTreeAutoscalingFieldNumber; +const int RayCluster::kEnableAutoscalingFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 RayCluster::RayCluster() @@ -664,7 +757,7 @@ RayCluster::RayCluster(const RayCluster& from) } else { head_group_spec_ = nullptr; } - enable_in_tree_autoscaling_ = from.enable_in_tree_autoscaling_; + enable_autoscaling_ = from.enable_autoscaling_; // @@protoc_insertion_point(copy_constructor:flyteidl.plugins.RayCluster) } @@ -672,8 +765,8 @@ void RayCluster::SharedCtor() { ::google::protobuf::internal::InitSCC( &scc_info_RayCluster_flyteidl_2fplugins_2fray_2eproto.base); ::memset(&head_group_spec_, 0, static_cast( - reinterpret_cast(&enable_in_tree_autoscaling_) - - reinterpret_cast(&head_group_spec_)) + sizeof(enable_in_tree_autoscaling_)); + reinterpret_cast(&enable_autoscaling_) - + reinterpret_cast(&head_group_spec_)) + sizeof(enable_autoscaling_)); } RayCluster::~RayCluster() { @@ -705,7 +798,7 @@ void RayCluster::Clear() { delete head_group_spec_; } head_group_spec_ = nullptr; - enable_in_tree_autoscaling_ = false; + enable_autoscaling_ = false; _internal_metadata_.Clear(); } @@ -751,10 +844,10 @@ const char* RayCluster::_InternalParse(const char* begin, const char* end, void* } while ((::google::protobuf::io::UnalignedLoad<::google::protobuf::uint64>(ptr) & 255) == 18 && (ptr += 1)); break; } - // bool enable_in_tree_autoscaling = 3; + // bool enable_autoscaling = 3; case 3: { if (static_cast<::google::protobuf::uint8>(tag) != 24) goto handle_unusual; - msg->set_enable_in_tree_autoscaling(::google::protobuf::internal::ReadVarint(&ptr)); + msg->set_enable_autoscaling(::google::protobuf::internal::ReadVarint(&ptr)); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); break; } @@ -810,13 +903,13 @@ bool RayCluster::MergePartialFromCodedStream( break; } - // bool enable_in_tree_autoscaling = 3; + // bool enable_autoscaling = 3; case 3: { if (static_cast< ::google::protobuf::uint8>(tag) == (24 & 0xFF)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( - input, &enable_in_tree_autoscaling_))); + input, &enable_autoscaling_))); } else { goto handle_unusual; } @@ -865,9 +958,9 @@ void RayCluster::SerializeWithCachedSizes( output); } - // bool enable_in_tree_autoscaling = 3; - if (this->enable_in_tree_autoscaling() != 0) { - ::google::protobuf::internal::WireFormatLite::WriteBool(3, this->enable_in_tree_autoscaling(), output); + // bool enable_autoscaling = 3; + if (this->enable_autoscaling() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteBool(3, this->enable_autoscaling(), output); } if (_internal_metadata_.have_unknown_fields()) { @@ -898,9 +991,9 @@ ::google::protobuf::uint8* RayCluster::InternalSerializeWithCachedSizesToArray( 2, this->worker_group_spec(static_cast(i)), target); } - // bool enable_in_tree_autoscaling = 3; - if (this->enable_in_tree_autoscaling() != 0) { - target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(3, this->enable_in_tree_autoscaling(), target); + // bool enable_autoscaling = 3; + if (this->enable_autoscaling() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(3, this->enable_autoscaling(), target); } if (_internal_metadata_.have_unknown_fields()) { @@ -942,8 +1035,8 @@ size_t RayCluster::ByteSizeLong() const { *head_group_spec_); } - // bool enable_in_tree_autoscaling = 3; - if (this->enable_in_tree_autoscaling() != 0) { + // bool enable_autoscaling = 3; + if (this->enable_autoscaling() != 0) { total_size += 1 + 1; } @@ -978,8 +1071,8 @@ void RayCluster::MergeFrom(const RayCluster& from) { if (from.has_head_group_spec()) { mutable_head_group_spec()->::flyteidl::plugins::HeadGroupSpec::MergeFrom(from.head_group_spec()); } - if (from.enable_in_tree_autoscaling() != 0) { - set_enable_in_tree_autoscaling(from.enable_in_tree_autoscaling()); + if (from.enable_autoscaling() != 0) { + set_enable_autoscaling(from.enable_autoscaling()); } } @@ -1010,7 +1103,7 @@ void RayCluster::InternalSwap(RayCluster* other) { _internal_metadata_.Swap(&other->_internal_metadata_); CastToBase(&worker_group_spec_)->InternalSwap(CastToBase(&other->worker_group_spec_)); swap(head_group_spec_, other->head_group_spec_); - swap(enable_in_tree_autoscaling_, other->enable_in_tree_autoscaling_); + swap(enable_autoscaling_, other->enable_autoscaling_); } ::google::protobuf::Metadata RayCluster::GetMetadata() const { diff --git a/flyteidl/gen/pb-cpp/flyteidl/plugins/ray.pb.h b/flyteidl/gen/pb-cpp/flyteidl/plugins/ray.pb.h index a7bb22a042..6d49906b97 100644 --- a/flyteidl/gen/pb-cpp/flyteidl/plugins/ray.pb.h +++ b/flyteidl/gen/pb-cpp/flyteidl/plugins/ray.pb.h @@ -206,6 +206,18 @@ class RayJob final : ::flyteidl::plugins::RayCluster* mutable_ray_cluster(); void set_allocated_ray_cluster(::flyteidl::plugins::RayCluster* ray_cluster); + // bool shutdown_after_job_finishes = 3; + void clear_shutdown_after_job_finishes(); + static const int kShutdownAfterJobFinishesFieldNumber = 3; + bool shutdown_after_job_finishes() const; + void set_shutdown_after_job_finishes(bool value); + + // int32 ttl_seconds_after_finished = 4; + void clear_ttl_seconds_after_finished(); + static const int kTtlSecondsAfterFinishedFieldNumber = 4; + ::google::protobuf::int32 ttl_seconds_after_finished() const; + void set_ttl_seconds_after_finished(::google::protobuf::int32 value); + // @@protoc_insertion_point(class_scope:flyteidl.plugins.RayJob) private: class HasBitSetters; @@ -213,6 +225,8 @@ class RayJob final : ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::internal::ArenaStringPtr runtime_env_; ::flyteidl::plugins::RayCluster* ray_cluster_; + bool shutdown_after_job_finishes_; + ::google::protobuf::int32 ttl_seconds_after_finished_; mutable ::google::protobuf::internal::CachedSize _cached_size_; friend struct ::TableStruct_flyteidl_2fplugins_2fray_2eproto; }; @@ -334,11 +348,11 @@ class RayCluster final : ::flyteidl::plugins::HeadGroupSpec* mutable_head_group_spec(); void set_allocated_head_group_spec(::flyteidl::plugins::HeadGroupSpec* head_group_spec); - // bool enable_in_tree_autoscaling = 3; - void clear_enable_in_tree_autoscaling(); - static const int kEnableInTreeAutoscalingFieldNumber = 3; - bool enable_in_tree_autoscaling() const; - void set_enable_in_tree_autoscaling(bool value); + // bool enable_autoscaling = 3; + void clear_enable_autoscaling(); + static const int kEnableAutoscalingFieldNumber = 3; + bool enable_autoscaling() const; + void set_enable_autoscaling(bool value); // @@protoc_insertion_point(class_scope:flyteidl.plugins.RayCluster) private: @@ -347,7 +361,7 @@ class RayCluster final : ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::RepeatedPtrField< ::flyteidl::plugins::WorkerGroupSpec > worker_group_spec_; ::flyteidl::plugins::HeadGroupSpec* head_group_spec_; - bool enable_in_tree_autoscaling_; + bool enable_autoscaling_; mutable ::google::protobuf::internal::CachedSize _cached_size_; friend struct ::TableStruct_flyteidl_2fplugins_2fray_2eproto; }; @@ -792,6 +806,34 @@ inline void RayJob::set_allocated_runtime_env(::std::string* runtime_env) { // @@protoc_insertion_point(field_set_allocated:flyteidl.plugins.RayJob.runtime_env) } +// bool shutdown_after_job_finishes = 3; +inline void RayJob::clear_shutdown_after_job_finishes() { + shutdown_after_job_finishes_ = false; +} +inline bool RayJob::shutdown_after_job_finishes() const { + // @@protoc_insertion_point(field_get:flyteidl.plugins.RayJob.shutdown_after_job_finishes) + return shutdown_after_job_finishes_; +} +inline void RayJob::set_shutdown_after_job_finishes(bool value) { + + shutdown_after_job_finishes_ = value; + // @@protoc_insertion_point(field_set:flyteidl.plugins.RayJob.shutdown_after_job_finishes) +} + +// int32 ttl_seconds_after_finished = 4; +inline void RayJob::clear_ttl_seconds_after_finished() { + ttl_seconds_after_finished_ = 0; +} +inline ::google::protobuf::int32 RayJob::ttl_seconds_after_finished() const { + // @@protoc_insertion_point(field_get:flyteidl.plugins.RayJob.ttl_seconds_after_finished) + return ttl_seconds_after_finished_; +} +inline void RayJob::set_ttl_seconds_after_finished(::google::protobuf::int32 value) { + + ttl_seconds_after_finished_ = value; + // @@protoc_insertion_point(field_set:flyteidl.plugins.RayJob.ttl_seconds_after_finished) +} + // ------------------------------------------------------------------- // RayCluster @@ -877,18 +919,18 @@ RayCluster::worker_group_spec() const { return worker_group_spec_; } -// bool enable_in_tree_autoscaling = 3; -inline void RayCluster::clear_enable_in_tree_autoscaling() { - enable_in_tree_autoscaling_ = false; +// bool enable_autoscaling = 3; +inline void RayCluster::clear_enable_autoscaling() { + enable_autoscaling_ = false; } -inline bool RayCluster::enable_in_tree_autoscaling() const { - // @@protoc_insertion_point(field_get:flyteidl.plugins.RayCluster.enable_in_tree_autoscaling) - return enable_in_tree_autoscaling_; +inline bool RayCluster::enable_autoscaling() const { + // @@protoc_insertion_point(field_get:flyteidl.plugins.RayCluster.enable_autoscaling) + return enable_autoscaling_; } -inline void RayCluster::set_enable_in_tree_autoscaling(bool value) { +inline void RayCluster::set_enable_autoscaling(bool value) { - enable_in_tree_autoscaling_ = value; - // @@protoc_insertion_point(field_set:flyteidl.plugins.RayCluster.enable_in_tree_autoscaling) + enable_autoscaling_ = value; + // @@protoc_insertion_point(field_set:flyteidl.plugins.RayCluster.enable_autoscaling) } // ------------------------------------------------------------------- diff --git a/flyteidl/gen/pb-go/flyteidl/plugins/ray.pb.go b/flyteidl/gen/pb-go/flyteidl/plugins/ray.pb.go index 8b5c96b018..b092b143cc 100644 --- a/flyteidl/gen/pb-go/flyteidl/plugins/ray.pb.go +++ b/flyteidl/gen/pb-go/flyteidl/plugins/ray.pb.go @@ -26,10 +26,14 @@ type RayJob struct { RayCluster *RayCluster `protobuf:"bytes,1,opt,name=ray_cluster,json=rayCluster,proto3" json:"ray_cluster,omitempty"` // runtime_env is base64 encoded. // Ray runtime environments: https://docs.ray.io/en/latest/ray-core/handling-dependencies.html#runtime-environments - RuntimeEnv string `protobuf:"bytes,2,opt,name=runtime_env,json=runtimeEnv,proto3" json:"runtime_env,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + RuntimeEnv string `protobuf:"bytes,2,opt,name=runtime_env,json=runtimeEnv,proto3" json:"runtime_env,omitempty"` + // shutdown_after_job_finishes specifies whether the RayCluster should be deleted after the RayJob finishes. + ShutdownAfterJobFinishes bool `protobuf:"varint,3,opt,name=shutdown_after_job_finishes,json=shutdownAfterJobFinishes,proto3" json:"shutdown_after_job_finishes,omitempty"` + // ttl_seconds_after_finished specifies the number of seconds after which the RayCluster will be deleted after the RayJob finishes. + TtlSecondsAfterFinished int32 `protobuf:"varint,4,opt,name=ttl_seconds_after_finished,json=ttlSecondsAfterFinished,proto3" json:"ttl_seconds_after_finished,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *RayJob) Reset() { *m = RayJob{} } @@ -71,17 +75,31 @@ func (m *RayJob) GetRuntimeEnv() string { return "" } +func (m *RayJob) GetShutdownAfterJobFinishes() bool { + if m != nil { + return m.ShutdownAfterJobFinishes + } + return false +} + +func (m *RayJob) GetTtlSecondsAfterFinished() int32 { + if m != nil { + return m.TtlSecondsAfterFinished + } + return 0 +} + // Define Ray cluster defines the desired state of RayCluster type RayCluster struct { // HeadGroupSpecs are the spec for the head pod HeadGroupSpec *HeadGroupSpec `protobuf:"bytes,1,opt,name=head_group_spec,json=headGroupSpec,proto3" json:"head_group_spec,omitempty"` // WorkerGroupSpecs are the specs for the worker pods WorkerGroupSpec []*WorkerGroupSpec `protobuf:"bytes,2,rep,name=worker_group_spec,json=workerGroupSpec,proto3" json:"worker_group_spec,omitempty"` - // Whether to enable in-tree autoscaling. - EnableInTreeAutoscaling bool `protobuf:"varint,3,opt,name=enable_in_tree_autoscaling,json=enableInTreeAutoscaling,proto3" json:"enable_in_tree_autoscaling,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Whether to enable autoscaling. + EnableAutoscaling bool `protobuf:"varint,3,opt,name=enable_autoscaling,json=enableAutoscaling,proto3" json:"enable_autoscaling,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *RayCluster) Reset() { *m = RayCluster{} } @@ -123,9 +141,9 @@ func (m *RayCluster) GetWorkerGroupSpec() []*WorkerGroupSpec { return nil } -func (m *RayCluster) GetEnableInTreeAutoscaling() bool { +func (m *RayCluster) GetEnableAutoscaling() bool { if m != nil { - return m.EnableInTreeAutoscaling + return m.EnableAutoscaling } return false } @@ -262,34 +280,37 @@ func init() { func init() { proto.RegisterFile("flyteidl/plugins/ray.proto", fileDescriptor_b980f6d58c7489d7) } var fileDescriptor_b980f6d58c7489d7 = []byte{ - // 453 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x53, 0xdf, 0x6b, 0xd4, 0x40, - 0x10, 0x26, 0x77, 0x5e, 0xe9, 0x4d, 0xac, 0x77, 0xae, 0x82, 0xc7, 0xa1, 0xf4, 0x7a, 0x4f, 0xf7, - 0x62, 0x02, 0x2d, 0x82, 0x28, 0x45, 0xaa, 0x94, 0xaa, 0xa0, 0xc8, 0x56, 0x10, 0x04, 0x59, 0x26, - 0xb9, 0x31, 0x17, 0x9a, 0xec, 0x86, 0xcd, 0xe6, 0xda, 0xfc, 0x59, 0xbe, 0xf8, 0xff, 0xf8, 0x9f, - 0x48, 0x36, 0x31, 0xf7, 0xa3, 0x85, 0x7b, 0xf3, 0x6d, 0x66, 0xbe, 0x6f, 0xbe, 0x9d, 0xfd, 0x86, - 0x81, 0xf1, 0xcf, 0xa4, 0x34, 0x14, 0xcf, 0x13, 0x3f, 0x4b, 0x8a, 0x28, 0x96, 0xb9, 0xaf, 0xb1, - 0xf4, 0x32, 0xad, 0x8c, 0x62, 0xc3, 0x7f, 0x98, 0xd7, 0x60, 0xd3, 0x05, 0xec, 0x71, 0x2c, 0x3f, - 0xaa, 0x80, 0x9d, 0x82, 0xab, 0xb1, 0x14, 0x61, 0x52, 0xe4, 0x86, 0xf4, 0xc8, 0x99, 0x38, 0x33, - 0xf7, 0xf8, 0xa9, 0xb7, 0xdd, 0xe1, 0x71, 0x2c, 0xdf, 0xd5, 0x1c, 0x0e, 0xba, 0x8d, 0xd9, 0x21, - 0xb8, 0xba, 0x90, 0x26, 0x4e, 0x49, 0x90, 0x5c, 0x8e, 0x3a, 0x13, 0x67, 0xd6, 0xe7, 0xd0, 0x94, - 0xce, 0xe5, 0x72, 0xfa, 0xc7, 0x01, 0x58, 0xf5, 0xb2, 0x0b, 0x18, 0x2c, 0x08, 0xe7, 0x22, 0xd2, - 0xaa, 0xc8, 0x44, 0x9e, 0x51, 0xd8, 0x3c, 0x79, 0x78, 0xfb, 0xc9, 0xf7, 0x84, 0xf3, 0x8b, 0x8a, - 0x77, 0x99, 0x51, 0xc8, 0x0f, 0x16, 0xeb, 0x29, 0xfb, 0x04, 0x0f, 0xaf, 0x95, 0xbe, 0x22, 0xbd, - 0x2e, 0xd5, 0x99, 0x74, 0x67, 0xee, 0xf1, 0xd1, 0x6d, 0xa9, 0x6f, 0x96, 0xba, 0x12, 0x1b, 0x5c, - 0x6f, 0x16, 0xd8, 0x6b, 0x18, 0x93, 0xc4, 0x20, 0x21, 0x11, 0x4b, 0x61, 0x34, 0x91, 0xc0, 0xc2, - 0xa8, 0x3c, 0xc4, 0x24, 0x96, 0xd1, 0xa8, 0x3b, 0x71, 0x66, 0xfb, 0xfc, 0x49, 0xcd, 0xf8, 0x20, - 0xbf, 0x6a, 0xa2, 0xb3, 0x15, 0x3c, 0xfd, 0xe5, 0xc0, 0xc1, 0xc6, 0xb0, 0xec, 0x07, 0x0c, 0x2b, - 0x57, 0x73, 0x83, 0xda, 0x88, 0x0c, 0x35, 0xa6, 0xf9, 0xc8, 0xb1, 0xc3, 0x9d, 0xec, 0xf8, 0x67, - 0x65, 0xf4, 0x65, 0xd5, 0xf6, 0xc5, 0x76, 0x9d, 0x4b, 0xa3, 0x4b, 0xfe, 0x40, 0x6f, 0x14, 0xc7, - 0x67, 0xf0, 0xe8, 0x0e, 0x1a, 0x1b, 0x42, 0xf7, 0x8a, 0x4a, 0x6b, 0x68, 0x9f, 0x57, 0x21, 0x7b, - 0x0c, 0xbd, 0x25, 0x26, 0x05, 0x35, 0x8b, 0xa9, 0x93, 0x57, 0x9d, 0x97, 0xce, 0xf4, 0x77, 0x07, - 0x06, 0x5b, 0xae, 0xb0, 0x67, 0x00, 0xb5, 0x99, 0x12, 0x53, 0x6a, 0x64, 0xfa, 0xb6, 0xf2, 0x19, - 0x53, 0x62, 0x63, 0xd8, 0xd7, 0x94, 0x25, 0x71, 0x88, 0xb9, 0xd5, 0xeb, 0xf1, 0x36, 0x67, 0x47, - 0x70, 0x3f, 0x8d, 0xa5, 0x68, 0xf1, 0xae, 0xc5, 0xdd, 0x34, 0x96, 0x7c, 0x9d, 0x82, 0x37, 0x2b, - 0xca, 0xbd, 0x86, 0x82, 0x37, 0x2d, 0x45, 0xdc, 0x61, 0x5b, 0xcf, 0xda, 0xf6, 0x62, 0xe7, 0x4e, - 0xff, 0x93, 0x71, 0x6f, 0xdf, 0x7c, 0x3f, 0x8d, 0x62, 0xb3, 0x28, 0x02, 0x2f, 0x54, 0xa9, 0x6f, - 0xa7, 0x52, 0x3a, 0xaa, 0x03, 0xbf, 0x3d, 0xc2, 0x88, 0xa4, 0x9f, 0x05, 0xcf, 0x23, 0xe5, 0x6f, - 0xdf, 0x65, 0xb0, 0x67, 0x8f, 0xf2, 0xe4, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd2, 0x3e, 0xf0, - 0x04, 0xb2, 0x03, 0x00, 0x00, + // 512 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0xdd, 0x6a, 0xdb, 0x30, + 0x14, 0xc6, 0x49, 0x53, 0x9a, 0x93, 0x75, 0x49, 0xb5, 0xc1, 0x4c, 0xb6, 0xd1, 0x34, 0x57, 0xb9, + 0x69, 0x0c, 0x2d, 0x83, 0xb1, 0x11, 0x46, 0x36, 0xba, 0x8e, 0xc2, 0xc6, 0x50, 0x2e, 0x06, 0x83, + 0x21, 0x64, 0x5b, 0x71, 0xbc, 0xda, 0x92, 0x91, 0xe4, 0xa4, 0x7e, 0xac, 0xdd, 0xec, 0x45, 0xf6, + 0x0a, 0x7b, 0x90, 0x61, 0x59, 0x75, 0x7e, 0x5a, 0xe8, 0xdd, 0xee, 0xa4, 0xf3, 0xfd, 0x70, 0xce, + 0x77, 0x6c, 0x41, 0x7f, 0x9e, 0x14, 0x9a, 0xc5, 0x61, 0xe2, 0x65, 0x49, 0x1e, 0xc5, 0x5c, 0x79, + 0x92, 0x16, 0xe3, 0x4c, 0x0a, 0x2d, 0x50, 0xef, 0x16, 0x1b, 0x5b, 0x6c, 0xf8, 0xd7, 0x81, 0x7d, + 0x4c, 0x8b, 0x2b, 0xe1, 0xa3, 0x09, 0x74, 0x24, 0x2d, 0x48, 0x90, 0xe4, 0x4a, 0x33, 0xe9, 0x3a, + 0x03, 0x67, 0xd4, 0x39, 0x7b, 0x31, 0xde, 0x95, 0x8c, 0x31, 0x2d, 0x3e, 0x54, 0x1c, 0x0c, 0xb2, + 0x3e, 0xa3, 0x63, 0xe8, 0xc8, 0x9c, 0xeb, 0x38, 0x65, 0x84, 0xf1, 0xa5, 0xdb, 0x18, 0x38, 0xa3, + 0x36, 0x06, 0x5b, 0xba, 0xe0, 0x4b, 0x34, 0x81, 0xe7, 0x6a, 0x91, 0xeb, 0x50, 0xac, 0x38, 0xa1, + 0x73, 0xcd, 0x24, 0xf9, 0x29, 0x7c, 0x32, 0x8f, 0x79, 0xac, 0x16, 0x4c, 0xb9, 0xcd, 0x81, 0x33, + 0x3a, 0xc0, 0xee, 0x2d, 0x65, 0x5a, 0x32, 0xae, 0x84, 0xff, 0xd1, 0xe2, 0xe8, 0x2d, 0xf4, 0xb5, + 0x4e, 0x88, 0x62, 0x81, 0xe0, 0xa1, 0xb2, 0x0e, 0x56, 0x1d, 0xba, 0x7b, 0x03, 0x67, 0xd4, 0xc2, + 0xcf, 0xb4, 0x4e, 0x66, 0x15, 0xc1, 0xe8, 0xad, 0x38, 0x1c, 0xfe, 0x71, 0x00, 0xd6, 0x7d, 0xa3, + 0x4b, 0xe8, 0x2e, 0x18, 0x0d, 0x49, 0x24, 0x45, 0x9e, 0x11, 0x95, 0xb1, 0xc0, 0x8e, 0x7b, 0x7c, + 0x77, 0xdc, 0x4f, 0x8c, 0x86, 0x97, 0x25, 0x6f, 0x96, 0xb1, 0x00, 0x1f, 0x2e, 0x36, 0xaf, 0xe8, + 0x33, 0x1c, 0xad, 0x84, 0xbc, 0x66, 0x72, 0xd3, 0xaa, 0x31, 0x68, 0x8e, 0x3a, 0x67, 0x27, 0x77, + 0xad, 0xbe, 0x19, 0xea, 0xda, 0xac, 0xbb, 0xda, 0x2e, 0xa0, 0x53, 0x40, 0x8c, 0x53, 0x3f, 0x61, + 0x84, 0xe6, 0x5a, 0xa8, 0x80, 0x26, 0x31, 0x8f, 0x6c, 0x32, 0x47, 0x15, 0x32, 0x5d, 0x03, 0xc3, + 0x5f, 0x0e, 0x1c, 0x6e, 0xb5, 0x87, 0x7e, 0x40, 0xaf, 0xdc, 0xa1, 0xd2, 0x54, 0x6a, 0x92, 0x51, + 0x49, 0x53, 0xe5, 0x3a, 0xa6, 0x9d, 0xf3, 0x07, 0x26, 0x2b, 0xd7, 0x3a, 0x2b, 0x65, 0x5f, 0x8d, + 0xea, 0x82, 0x6b, 0x59, 0xe0, 0xc7, 0x72, 0xab, 0xd8, 0x9f, 0xc2, 0x93, 0x7b, 0x68, 0xa8, 0x07, + 0xcd, 0x6b, 0x56, 0x98, 0x08, 0xdb, 0xb8, 0x3c, 0xa2, 0xa7, 0xd0, 0x5a, 0xd2, 0x24, 0x67, 0xf6, + 0x33, 0xa8, 0x2e, 0x6f, 0x1a, 0xaf, 0x9d, 0xe1, 0xef, 0x06, 0x74, 0x77, 0x72, 0x40, 0x2f, 0x01, + 0xaa, 0xf8, 0x38, 0x4d, 0x99, 0xb5, 0x69, 0x9b, 0xca, 0x17, 0x9a, 0x32, 0xd4, 0x87, 0x03, 0xc9, + 0xb2, 0x24, 0x0e, 0xa8, 0x32, 0x7e, 0x2d, 0x5c, 0xdf, 0xd1, 0x09, 0x3c, 0x4a, 0x63, 0x4e, 0x6a, + 0xbc, 0x69, 0xf0, 0x4e, 0x1a, 0x73, 0xbc, 0x49, 0xa1, 0x37, 0x6b, 0xca, 0x9e, 0xa5, 0xd0, 0x9b, + 0x9a, 0x42, 0xee, 0x89, 0xad, 0x65, 0x62, 0x7b, 0xf5, 0xe0, 0x16, 0xff, 0x53, 0x70, 0xef, 0xdf, + 0x7d, 0x9f, 0x44, 0xb1, 0x5e, 0xe4, 0xfe, 0x38, 0x10, 0xa9, 0x67, 0xba, 0x12, 0x32, 0xaa, 0x0e, + 0x5e, 0xfd, 0xcf, 0x47, 0x8c, 0x7b, 0x99, 0x7f, 0x1a, 0x09, 0x6f, 0xf7, 0x19, 0xf0, 0xf7, 0xcd, + 0x1b, 0x70, 0xfe, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xe5, 0x00, 0x39, 0x5b, 0x21, 0x04, 0x00, 0x00, } diff --git a/flyteidl/gen/pb-go/flyteidl/plugins/ray.pb.validate.go b/flyteidl/gen/pb-go/flyteidl/plugins/ray.pb.validate.go index 1fc1a1df73..b079e610f5 100644 --- a/flyteidl/gen/pb-go/flyteidl/plugins/ray.pb.validate.go +++ b/flyteidl/gen/pb-go/flyteidl/plugins/ray.pb.validate.go @@ -55,6 +55,10 @@ func (m *RayJob) Validate() error { // no validation rules for RuntimeEnv + // no validation rules for ShutdownAfterJobFinishes + + // no validation rules for TtlSecondsAfterFinished + return nil } @@ -144,7 +148,7 @@ func (m *RayCluster) Validate() error { } - // no validation rules for EnableInTreeAutoscaling + // no validation rules for EnableAutoscaling return nil } diff --git a/flyteidl/gen/pb-java/flyteidl/plugins/Ray.java b/flyteidl/gen/pb-java/flyteidl/plugins/Ray.java index fdcd30ef09..5dd419f827 100644 --- a/flyteidl/gen/pb-java/flyteidl/plugins/Ray.java +++ b/flyteidl/gen/pb-java/flyteidl/plugins/Ray.java @@ -62,6 +62,24 @@ public interface RayJobOrBuilder extends */ com.google.protobuf.ByteString getRuntimeEnvBytes(); + + /** + *
+     * shutdown_after_job_finishes specifies whether the RayCluster should be deleted after the RayJob finishes.
+     * 
+ * + * bool shutdown_after_job_finishes = 3; + */ + boolean getShutdownAfterJobFinishes(); + + /** + *
+     * ttl_seconds_after_finished specifies the number of seconds after which the RayCluster will be deleted after the RayJob finishes.
+     * 
+ * + * int32 ttl_seconds_after_finished = 4; + */ + int getTtlSecondsAfterFinished(); } /** *
@@ -126,6 +144,16 @@ private RayJob(
               runtimeEnv_ = s;
               break;
             }
+            case 24: {
+
+              shutdownAfterJobFinishes_ = input.readBool();
+              break;
+            }
+            case 32: {
+
+              ttlSecondsAfterFinished_ = input.readInt32();
+              break;
+            }
             default: {
               if (!parseUnknownField(
                   input, unknownFields, extensionRegistry, tag)) {
@@ -235,6 +263,32 @@ public java.lang.String getRuntimeEnv() {
       }
     }
 
+    public static final int SHUTDOWN_AFTER_JOB_FINISHES_FIELD_NUMBER = 3;
+    private boolean shutdownAfterJobFinishes_;
+    /**
+     * 
+     * shutdown_after_job_finishes specifies whether the RayCluster should be deleted after the RayJob finishes.
+     * 
+ * + * bool shutdown_after_job_finishes = 3; + */ + public boolean getShutdownAfterJobFinishes() { + return shutdownAfterJobFinishes_; + } + + public static final int TTL_SECONDS_AFTER_FINISHED_FIELD_NUMBER = 4; + private int ttlSecondsAfterFinished_; + /** + *
+     * ttl_seconds_after_finished specifies the number of seconds after which the RayCluster will be deleted after the RayJob finishes.
+     * 
+ * + * int32 ttl_seconds_after_finished = 4; + */ + public int getTtlSecondsAfterFinished() { + return ttlSecondsAfterFinished_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -255,6 +309,12 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (!getRuntimeEnvBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, runtimeEnv_); } + if (shutdownAfterJobFinishes_ != false) { + output.writeBool(3, shutdownAfterJobFinishes_); + } + if (ttlSecondsAfterFinished_ != 0) { + output.writeInt32(4, ttlSecondsAfterFinished_); + } unknownFields.writeTo(output); } @@ -271,6 +331,14 @@ public int getSerializedSize() { if (!getRuntimeEnvBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, runtimeEnv_); } + if (shutdownAfterJobFinishes_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(3, shutdownAfterJobFinishes_); + } + if (ttlSecondsAfterFinished_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, ttlSecondsAfterFinished_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -293,6 +361,10 @@ public boolean equals(final java.lang.Object obj) { } if (!getRuntimeEnv() .equals(other.getRuntimeEnv())) return false; + if (getShutdownAfterJobFinishes() + != other.getShutdownAfterJobFinishes()) return false; + if (getTtlSecondsAfterFinished() + != other.getTtlSecondsAfterFinished()) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -310,6 +382,11 @@ public int hashCode() { } hash = (37 * hash) + RUNTIME_ENV_FIELD_NUMBER; hash = (53 * hash) + getRuntimeEnv().hashCode(); + hash = (37 * hash) + SHUTDOWN_AFTER_JOB_FINISHES_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getShutdownAfterJobFinishes()); + hash = (37 * hash) + TTL_SECONDS_AFTER_FINISHED_FIELD_NUMBER; + hash = (53 * hash) + getTtlSecondsAfterFinished(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -455,6 +532,10 @@ public Builder clear() { } runtimeEnv_ = ""; + shutdownAfterJobFinishes_ = false; + + ttlSecondsAfterFinished_ = 0; + return this; } @@ -487,6 +568,8 @@ public flyteidl.plugins.Ray.RayJob buildPartial() { result.rayCluster_ = rayClusterBuilder_.build(); } result.runtimeEnv_ = runtimeEnv_; + result.shutdownAfterJobFinishes_ = shutdownAfterJobFinishes_; + result.ttlSecondsAfterFinished_ = ttlSecondsAfterFinished_; onBuilt(); return result; } @@ -542,6 +625,12 @@ public Builder mergeFrom(flyteidl.plugins.Ray.RayJob other) { runtimeEnv_ = other.runtimeEnv_; onChanged(); } + if (other.getShutdownAfterJobFinishes() != false) { + setShutdownAfterJobFinishes(other.getShutdownAfterJobFinishes()); + } + if (other.getTtlSecondsAfterFinished() != 0) { + setTtlSecondsAfterFinished(other.getTtlSecondsAfterFinished()); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -817,6 +906,82 @@ public Builder setRuntimeEnvBytes( onChanged(); return this; } + + private boolean shutdownAfterJobFinishes_ ; + /** + *
+       * shutdown_after_job_finishes specifies whether the RayCluster should be deleted after the RayJob finishes.
+       * 
+ * + * bool shutdown_after_job_finishes = 3; + */ + public boolean getShutdownAfterJobFinishes() { + return shutdownAfterJobFinishes_; + } + /** + *
+       * shutdown_after_job_finishes specifies whether the RayCluster should be deleted after the RayJob finishes.
+       * 
+ * + * bool shutdown_after_job_finishes = 3; + */ + public Builder setShutdownAfterJobFinishes(boolean value) { + + shutdownAfterJobFinishes_ = value; + onChanged(); + return this; + } + /** + *
+       * shutdown_after_job_finishes specifies whether the RayCluster should be deleted after the RayJob finishes.
+       * 
+ * + * bool shutdown_after_job_finishes = 3; + */ + public Builder clearShutdownAfterJobFinishes() { + + shutdownAfterJobFinishes_ = false; + onChanged(); + return this; + } + + private int ttlSecondsAfterFinished_ ; + /** + *
+       * ttl_seconds_after_finished specifies the number of seconds after which the RayCluster will be deleted after the RayJob finishes.
+       * 
+ * + * int32 ttl_seconds_after_finished = 4; + */ + public int getTtlSecondsAfterFinished() { + return ttlSecondsAfterFinished_; + } + /** + *
+       * ttl_seconds_after_finished specifies the number of seconds after which the RayCluster will be deleted after the RayJob finishes.
+       * 
+ * + * int32 ttl_seconds_after_finished = 4; + */ + public Builder setTtlSecondsAfterFinished(int value) { + + ttlSecondsAfterFinished_ = value; + onChanged(); + return this; + } + /** + *
+       * ttl_seconds_after_finished specifies the number of seconds after which the RayCluster will be deleted after the RayJob finishes.
+       * 
+ * + * int32 ttl_seconds_after_finished = 4; + */ + public Builder clearTtlSecondsAfterFinished() { + + ttlSecondsAfterFinished_ = 0; + onChanged(); + return this; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { @@ -945,12 +1110,12 @@ flyteidl.plugins.Ray.WorkerGroupSpecOrBuilder getWorkerGroupSpecOrBuilder( /** *
-     * Whether to enable in-tree autoscaling.
+     * Whether to enable autoscaling.
      * 
* - * bool enable_in_tree_autoscaling = 3; + * bool enable_autoscaling = 3; */ - boolean getEnableInTreeAutoscaling(); + boolean getEnableAutoscaling(); } /** *
@@ -1020,7 +1185,7 @@ private RayCluster(
             }
             case 24: {
 
-              enableInTreeAutoscaling_ = input.readBool();
+              enableAutoscaling_ = input.readBool();
               break;
             }
             default: {
@@ -1147,17 +1312,17 @@ public flyteidl.plugins.Ray.WorkerGroupSpecOrBuilder getWorkerGroupSpecOrBuilder
       return workerGroupSpec_.get(index);
     }
 
-    public static final int ENABLE_IN_TREE_AUTOSCALING_FIELD_NUMBER = 3;
-    private boolean enableInTreeAutoscaling_;
+    public static final int ENABLE_AUTOSCALING_FIELD_NUMBER = 3;
+    private boolean enableAutoscaling_;
     /**
      * 
-     * Whether to enable in-tree autoscaling.
+     * Whether to enable autoscaling.
      * 
* - * bool enable_in_tree_autoscaling = 3; + * bool enable_autoscaling = 3; */ - public boolean getEnableInTreeAutoscaling() { - return enableInTreeAutoscaling_; + public boolean getEnableAutoscaling() { + return enableAutoscaling_; } private byte memoizedIsInitialized = -1; @@ -1180,8 +1345,8 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) for (int i = 0; i < workerGroupSpec_.size(); i++) { output.writeMessage(2, workerGroupSpec_.get(i)); } - if (enableInTreeAutoscaling_ != false) { - output.writeBool(3, enableInTreeAutoscaling_); + if (enableAutoscaling_ != false) { + output.writeBool(3, enableAutoscaling_); } unknownFields.writeTo(output); } @@ -1200,9 +1365,9 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, workerGroupSpec_.get(i)); } - if (enableInTreeAutoscaling_ != false) { + if (enableAutoscaling_ != false) { size += com.google.protobuf.CodedOutputStream - .computeBoolSize(3, enableInTreeAutoscaling_); + .computeBoolSize(3, enableAutoscaling_); } size += unknownFields.getSerializedSize(); memoizedSize = size; @@ -1226,8 +1391,8 @@ public boolean equals(final java.lang.Object obj) { } if (!getWorkerGroupSpecList() .equals(other.getWorkerGroupSpecList())) return false; - if (getEnableInTreeAutoscaling() - != other.getEnableInTreeAutoscaling()) return false; + if (getEnableAutoscaling() + != other.getEnableAutoscaling()) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -1247,9 +1412,9 @@ public int hashCode() { hash = (37 * hash) + WORKER_GROUP_SPEC_FIELD_NUMBER; hash = (53 * hash) + getWorkerGroupSpecList().hashCode(); } - hash = (37 * hash) + ENABLE_IN_TREE_AUTOSCALING_FIELD_NUMBER; + hash = (37 * hash) + ENABLE_AUTOSCALING_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( - getEnableInTreeAutoscaling()); + getEnableAutoscaling()); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -1400,7 +1565,7 @@ public Builder clear() { } else { workerGroupSpecBuilder_.clear(); } - enableInTreeAutoscaling_ = false; + enableAutoscaling_ = false; return this; } @@ -1444,7 +1609,7 @@ public flyteidl.plugins.Ray.RayCluster buildPartial() { } else { result.workerGroupSpec_ = workerGroupSpecBuilder_.build(); } - result.enableInTreeAutoscaling_ = enableInTreeAutoscaling_; + result.enableAutoscaling_ = enableAutoscaling_; result.bitField0_ = to_bitField0_; onBuilt(); return result; @@ -1523,8 +1688,8 @@ public Builder mergeFrom(flyteidl.plugins.Ray.RayCluster other) { } } } - if (other.getEnableInTreeAutoscaling() != false) { - setEnableInTreeAutoscaling(other.getEnableInTreeAutoscaling()); + if (other.getEnableAutoscaling() != false) { + setEnableAutoscaling(other.getEnableAutoscaling()); } this.mergeUnknownFields(other.unknownFields); onChanged(); @@ -2021,40 +2186,40 @@ public flyteidl.plugins.Ray.WorkerGroupSpec.Builder addWorkerGroupSpecBuilder( return workerGroupSpecBuilder_; } - private boolean enableInTreeAutoscaling_ ; + private boolean enableAutoscaling_ ; /** *
-       * Whether to enable in-tree autoscaling.
+       * Whether to enable autoscaling.
        * 
* - * bool enable_in_tree_autoscaling = 3; + * bool enable_autoscaling = 3; */ - public boolean getEnableInTreeAutoscaling() { - return enableInTreeAutoscaling_; + public boolean getEnableAutoscaling() { + return enableAutoscaling_; } /** *
-       * Whether to enable in-tree autoscaling.
+       * Whether to enable autoscaling.
        * 
* - * bool enable_in_tree_autoscaling = 3; + * bool enable_autoscaling = 3; */ - public Builder setEnableInTreeAutoscaling(boolean value) { + public Builder setEnableAutoscaling(boolean value) { - enableInTreeAutoscaling_ = value; + enableAutoscaling_ = value; onChanged(); return this; } /** *
-       * Whether to enable in-tree autoscaling.
+       * Whether to enable autoscaling.
        * 
* - * bool enable_in_tree_autoscaling = 3; + * bool enable_autoscaling = 3; */ - public Builder clearEnableInTreeAutoscaling() { + public Builder clearEnableAutoscaling() { - enableInTreeAutoscaling_ = false; + enableAutoscaling_ = false; onChanged(); return this; } @@ -4191,25 +4356,26 @@ public flyteidl.plugins.Ray.WorkerGroupSpec getDefaultInstanceForType() { static { java.lang.String[] descriptorData = { "\n\032flyteidl/plugins/ray.proto\022\020flyteidl.p" + - "lugins\"P\n\006RayJob\0221\n\013ray_cluster\030\001 \001(\0132\034." + - "flyteidl.plugins.RayCluster\022\023\n\013runtime_e" + - "nv\030\002 \001(\t\"\250\001\n\nRayCluster\0228\n\017head_group_sp" + - "ec\030\001 \001(\0132\037.flyteidl.plugins.HeadGroupSpe" + - "c\022<\n\021worker_group_spec\030\002 \003(\0132!.flyteidl." + - "plugins.WorkerGroupSpec\022\"\n\032enable_in_tre" + - "e_autoscaling\030\003 \001(\010\"\225\001\n\rHeadGroupSpec\022M\n" + - "\020ray_start_params\030\001 \003(\01323.flyteidl.plugi" + - "ns.HeadGroupSpec.RayStartParamsEntry\0325\n\023" + - "RayStartParamsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005valu" + - "e\030\002 \001(\t:\0028\001\"\353\001\n\017WorkerGroupSpec\022\022\n\ngroup" + - "_name\030\001 \001(\t\022\020\n\010replicas\030\002 \001(\005\022\024\n\014min_rep" + - "licas\030\003 \001(\005\022\024\n\014max_replicas\030\004 \001(\005\022O\n\020ray" + - "_start_params\030\005 \003(\01325.flyteidl.plugins.W" + - "orkerGroupSpec.RayStartParamsEntry\0325\n\023Ra" + - "yStartParamsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030" + - "\002 \001(\t:\0028\001B?Z=github.com/flyteorg/flyte/f" + - "lyteidl/gen/pb-go/flyteidl/pluginsb\006prot" + - "o3" + "lugins\"\231\001\n\006RayJob\0221\n\013ray_cluster\030\001 \001(\0132\034" + + ".flyteidl.plugins.RayCluster\022\023\n\013runtime_" + + "env\030\002 \001(\t\022#\n\033shutdown_after_job_finishes" + + "\030\003 \001(\010\022\"\n\032ttl_seconds_after_finished\030\004 \001" + + "(\005\"\240\001\n\nRayCluster\0228\n\017head_group_spec\030\001 \001" + + "(\0132\037.flyteidl.plugins.HeadGroupSpec\022<\n\021w" + + "orker_group_spec\030\002 \003(\0132!.flyteidl.plugin" + + "s.WorkerGroupSpec\022\032\n\022enable_autoscaling\030" + + "\003 \001(\010\"\225\001\n\rHeadGroupSpec\022M\n\020ray_start_par" + + "ams\030\001 \003(\01323.flyteidl.plugins.HeadGroupSp" + + "ec.RayStartParamsEntry\0325\n\023RayStartParams" + + "Entry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\353\001" + + "\n\017WorkerGroupSpec\022\022\n\ngroup_name\030\001 \001(\t\022\020\n" + + "\010replicas\030\002 \001(\005\022\024\n\014min_replicas\030\003 \001(\005\022\024\n" + + "\014max_replicas\030\004 \001(\005\022O\n\020ray_start_params\030" + + "\005 \003(\01325.flyteidl.plugins.WorkerGroupSpec" + + ".RayStartParamsEntry\0325\n\023RayStartParamsEn" + + "try\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001B?Z=g" + + "ithub.com/flyteorg/flyte/flyteidl/gen/pb" + + "-go/flyteidl/pluginsb\006proto3" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { @@ -4228,13 +4394,13 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( internal_static_flyteidl_plugins_RayJob_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_flyteidl_plugins_RayJob_descriptor, - new java.lang.String[] { "RayCluster", "RuntimeEnv", }); + new java.lang.String[] { "RayCluster", "RuntimeEnv", "ShutdownAfterJobFinishes", "TtlSecondsAfterFinished", }); internal_static_flyteidl_plugins_RayCluster_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_flyteidl_plugins_RayCluster_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_flyteidl_plugins_RayCluster_descriptor, - new java.lang.String[] { "HeadGroupSpec", "WorkerGroupSpec", "EnableInTreeAutoscaling", }); + new java.lang.String[] { "HeadGroupSpec", "WorkerGroupSpec", "EnableAutoscaling", }); internal_static_flyteidl_plugins_HeadGroupSpec_descriptor = getDescriptor().getMessageTypes().get(2); internal_static_flyteidl_plugins_HeadGroupSpec_fieldAccessorTable = new diff --git a/flyteidl/gen/pb_python/flyteidl/plugins/ray_pb2.py b/flyteidl/gen/pb_python/flyteidl/plugins/ray_pb2.py index 7871f53400..1c5de3b666 100644 --- a/flyteidl/gen/pb_python/flyteidl/plugins/ray_pb2.py +++ b/flyteidl/gen/pb_python/flyteidl/plugins/ray_pb2.py @@ -13,7 +13,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1a\x66lyteidl/plugins/ray.proto\x12\x10\x66lyteidl.plugins\"h\n\x06RayJob\x12=\n\x0bray_cluster\x18\x01 \x01(\x0b\x32\x1c.flyteidl.plugins.RayClusterR\nrayCluster\x12\x1f\n\x0bruntime_env\x18\x02 \x01(\tR\nruntimeEnv\"\xe1\x01\n\nRayCluster\x12G\n\x0fhead_group_spec\x18\x01 \x01(\x0b\x32\x1f.flyteidl.plugins.HeadGroupSpecR\rheadGroupSpec\x12M\n\x11worker_group_spec\x18\x02 \x03(\x0b\x32!.flyteidl.plugins.WorkerGroupSpecR\x0fworkerGroupSpec\x12;\n\x1a\x65nable_in_tree_autoscaling\x18\x03 \x01(\x08R\x17\x65nableInTreeAutoscaling\"\xb1\x01\n\rHeadGroupSpec\x12]\n\x10ray_start_params\x18\x01 \x03(\x0b\x32\x33.flyteidl.plugins.HeadGroupSpec.RayStartParamsEntryR\x0erayStartParams\x1a\x41\n\x13RayStartParamsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\"\xb6\x02\n\x0fWorkerGroupSpec\x12\x1d\n\ngroup_name\x18\x01 \x01(\tR\tgroupName\x12\x1a\n\x08replicas\x18\x02 \x01(\x05R\x08replicas\x12!\n\x0cmin_replicas\x18\x03 \x01(\x05R\x0bminReplicas\x12!\n\x0cmax_replicas\x18\x04 \x01(\x05R\x0bmaxReplicas\x12_\n\x10ray_start_params\x18\x05 \x03(\x0b\x32\x35.flyteidl.plugins.WorkerGroupSpec.RayStartParamsEntryR\x0erayStartParams\x1a\x41\n\x13RayStartParamsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\x42\xc0\x01\n\x14\x63om.flyteidl.pluginsB\x08RayProtoP\x01Z=github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/plugins\xa2\x02\x03\x46PX\xaa\x02\x10\x46lyteidl.Plugins\xca\x02\x10\x46lyteidl\\Plugins\xe2\x02\x1c\x46lyteidl\\Plugins\\GPBMetadata\xea\x02\x11\x46lyteidl::Pluginsb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1a\x66lyteidl/plugins/ray.proto\x12\x10\x66lyteidl.plugins\"\xe4\x01\n\x06RayJob\x12=\n\x0bray_cluster\x18\x01 \x01(\x0b\x32\x1c.flyteidl.plugins.RayClusterR\nrayCluster\x12\x1f\n\x0bruntime_env\x18\x02 \x01(\tR\nruntimeEnv\x12=\n\x1bshutdown_after_job_finishes\x18\x03 \x01(\x08R\x18shutdownAfterJobFinishes\x12;\n\x1attl_seconds_after_finished\x18\x04 \x01(\x05R\x17ttlSecondsAfterFinished\"\xd3\x01\n\nRayCluster\x12G\n\x0fhead_group_spec\x18\x01 \x01(\x0b\x32\x1f.flyteidl.plugins.HeadGroupSpecR\rheadGroupSpec\x12M\n\x11worker_group_spec\x18\x02 \x03(\x0b\x32!.flyteidl.plugins.WorkerGroupSpecR\x0fworkerGroupSpec\x12-\n\x12\x65nable_autoscaling\x18\x03 \x01(\x08R\x11\x65nableAutoscaling\"\xb1\x01\n\rHeadGroupSpec\x12]\n\x10ray_start_params\x18\x01 \x03(\x0b\x32\x33.flyteidl.plugins.HeadGroupSpec.RayStartParamsEntryR\x0erayStartParams\x1a\x41\n\x13RayStartParamsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\"\xb6\x02\n\x0fWorkerGroupSpec\x12\x1d\n\ngroup_name\x18\x01 \x01(\tR\tgroupName\x12\x1a\n\x08replicas\x18\x02 \x01(\x05R\x08replicas\x12!\n\x0cmin_replicas\x18\x03 \x01(\x05R\x0bminReplicas\x12!\n\x0cmax_replicas\x18\x04 \x01(\x05R\x0bmaxReplicas\x12_\n\x10ray_start_params\x18\x05 \x03(\x0b\x32\x35.flyteidl.plugins.WorkerGroupSpec.RayStartParamsEntryR\x0erayStartParams\x1a\x41\n\x13RayStartParamsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\x42\xc0\x01\n\x14\x63om.flyteidl.pluginsB\x08RayProtoP\x01Z=github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/plugins\xa2\x02\x03\x46PX\xaa\x02\x10\x46lyteidl.Plugins\xca\x02\x10\x46lyteidl\\Plugins\xe2\x02\x1c\x46lyteidl\\Plugins\\GPBMetadata\xea\x02\x11\x46lyteidl::Pluginsb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -26,16 +26,16 @@ _HEADGROUPSPEC_RAYSTARTPARAMSENTRY._serialized_options = b'8\001' _WORKERGROUPSPEC_RAYSTARTPARAMSENTRY._options = None _WORKERGROUPSPEC_RAYSTARTPARAMSENTRY._serialized_options = b'8\001' - _globals['_RAYJOB']._serialized_start=48 - _globals['_RAYJOB']._serialized_end=152 - _globals['_RAYCLUSTER']._serialized_start=155 - _globals['_RAYCLUSTER']._serialized_end=380 - _globals['_HEADGROUPSPEC']._serialized_start=383 - _globals['_HEADGROUPSPEC']._serialized_end=560 - _globals['_HEADGROUPSPEC_RAYSTARTPARAMSENTRY']._serialized_start=495 - _globals['_HEADGROUPSPEC_RAYSTARTPARAMSENTRY']._serialized_end=560 - _globals['_WORKERGROUPSPEC']._serialized_start=563 - _globals['_WORKERGROUPSPEC']._serialized_end=873 - _globals['_WORKERGROUPSPEC_RAYSTARTPARAMSENTRY']._serialized_start=495 - _globals['_WORKERGROUPSPEC_RAYSTARTPARAMSENTRY']._serialized_end=560 + _globals['_RAYJOB']._serialized_start=49 + _globals['_RAYJOB']._serialized_end=277 + _globals['_RAYCLUSTER']._serialized_start=280 + _globals['_RAYCLUSTER']._serialized_end=491 + _globals['_HEADGROUPSPEC']._serialized_start=494 + _globals['_HEADGROUPSPEC']._serialized_end=671 + _globals['_HEADGROUPSPEC_RAYSTARTPARAMSENTRY']._serialized_start=606 + _globals['_HEADGROUPSPEC_RAYSTARTPARAMSENTRY']._serialized_end=671 + _globals['_WORKERGROUPSPEC']._serialized_start=674 + _globals['_WORKERGROUPSPEC']._serialized_end=984 + _globals['_WORKERGROUPSPEC_RAYSTARTPARAMSENTRY']._serialized_start=606 + _globals['_WORKERGROUPSPEC_RAYSTARTPARAMSENTRY']._serialized_end=671 # @@protoc_insertion_point(module_scope) diff --git a/flyteidl/gen/pb_python/flyteidl/plugins/ray_pb2.pyi b/flyteidl/gen/pb_python/flyteidl/plugins/ray_pb2.pyi index f5daa7f0b6..15c78912bd 100644 --- a/flyteidl/gen/pb_python/flyteidl/plugins/ray_pb2.pyi +++ b/flyteidl/gen/pb_python/flyteidl/plugins/ray_pb2.pyi @@ -6,22 +6,26 @@ from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Map DESCRIPTOR: _descriptor.FileDescriptor class RayJob(_message.Message): - __slots__ = ["ray_cluster", "runtime_env"] + __slots__ = ["ray_cluster", "runtime_env", "shutdown_after_job_finishes", "ttl_seconds_after_finished"] RAY_CLUSTER_FIELD_NUMBER: _ClassVar[int] RUNTIME_ENV_FIELD_NUMBER: _ClassVar[int] + SHUTDOWN_AFTER_JOB_FINISHES_FIELD_NUMBER: _ClassVar[int] + TTL_SECONDS_AFTER_FINISHED_FIELD_NUMBER: _ClassVar[int] ray_cluster: RayCluster runtime_env: str - def __init__(self, ray_cluster: _Optional[_Union[RayCluster, _Mapping]] = ..., runtime_env: _Optional[str] = ...) -> None: ... + shutdown_after_job_finishes: bool + ttl_seconds_after_finished: int + def __init__(self, ray_cluster: _Optional[_Union[RayCluster, _Mapping]] = ..., runtime_env: _Optional[str] = ..., shutdown_after_job_finishes: bool = ..., ttl_seconds_after_finished: _Optional[int] = ...) -> None: ... class RayCluster(_message.Message): - __slots__ = ["head_group_spec", "worker_group_spec", "enable_in_tree_autoscaling"] + __slots__ = ["head_group_spec", "worker_group_spec", "enable_autoscaling"] HEAD_GROUP_SPEC_FIELD_NUMBER: _ClassVar[int] WORKER_GROUP_SPEC_FIELD_NUMBER: _ClassVar[int] - ENABLE_IN_TREE_AUTOSCALING_FIELD_NUMBER: _ClassVar[int] + ENABLE_AUTOSCALING_FIELD_NUMBER: _ClassVar[int] head_group_spec: HeadGroupSpec worker_group_spec: _containers.RepeatedCompositeFieldContainer[WorkerGroupSpec] - enable_in_tree_autoscaling: bool - def __init__(self, head_group_spec: _Optional[_Union[HeadGroupSpec, _Mapping]] = ..., worker_group_spec: _Optional[_Iterable[_Union[WorkerGroupSpec, _Mapping]]] = ..., enable_in_tree_autoscaling: bool = ...) -> None: ... + enable_autoscaling: bool + def __init__(self, head_group_spec: _Optional[_Union[HeadGroupSpec, _Mapping]] = ..., worker_group_spec: _Optional[_Iterable[_Union[WorkerGroupSpec, _Mapping]]] = ..., enable_autoscaling: bool = ...) -> None: ... class HeadGroupSpec(_message.Message): __slots__ = ["ray_start_params"] diff --git a/flyteidl/gen/pb_rust/flyteidl.plugins.rs b/flyteidl/gen/pb_rust/flyteidl.plugins.rs index 49f8a10a14..bfed40f1a8 100644 --- a/flyteidl/gen/pb_rust/flyteidl.plugins.rs +++ b/flyteidl/gen/pb_rust/flyteidl.plugins.rs @@ -175,6 +175,12 @@ pub struct RayJob { /// Ray runtime environments: #[prost(string, tag="2")] pub runtime_env: ::prost::alloc::string::String, + /// shutdown_after_job_finishes specifies whether the RayCluster should be deleted after the RayJob finishes. + #[prost(bool, tag="3")] + pub shutdown_after_job_finishes: bool, + /// ttl_seconds_after_finished specifies the number of seconds after which the RayCluster will be deleted after the RayJob finishes. + #[prost(int32, tag="4")] + pub ttl_seconds_after_finished: i32, } /// Define Ray cluster defines the desired state of RayCluster #[allow(clippy::derive_partial_eq_without_eq)] @@ -186,9 +192,9 @@ pub struct RayCluster { /// WorkerGroupSpecs are the specs for the worker pods #[prost(message, repeated, tag="2")] pub worker_group_spec: ::prost::alloc::vec::Vec, - /// Whether to enable in-tree autoscaling. + /// Whether to enable autoscaling. #[prost(bool, tag="3")] - pub enable_in_tree_autoscaling: bool, + pub enable_autoscaling: bool, } /// HeadGroupSpec are the spec for the head pod #[allow(clippy::derive_partial_eq_without_eq)] diff --git a/flyteidl/protos/flyteidl/plugins/ray.proto b/flyteidl/protos/flyteidl/plugins/ray.proto index abe54a8bce..1afcee8d93 100644 --- a/flyteidl/protos/flyteidl/plugins/ray.proto +++ b/flyteidl/protos/flyteidl/plugins/ray.proto @@ -11,6 +11,10 @@ message RayJob { // runtime_env is base64 encoded. // Ray runtime environments: https://docs.ray.io/en/latest/ray-core/handling-dependencies.html#runtime-environments string runtime_env = 2; + // shutdown_after_job_finishes specifies whether the RayCluster should be deleted after the RayJob finishes. + bool shutdown_after_job_finishes = 3; + // ttl_seconds_after_finished specifies the number of seconds after which the RayCluster will be deleted after the RayJob finishes. + int32 ttl_seconds_after_finished = 4; } // Define Ray cluster defines the desired state of RayCluster @@ -19,8 +23,8 @@ message RayCluster { HeadGroupSpec head_group_spec = 1; // WorkerGroupSpecs are the specs for the worker pods repeated WorkerGroupSpec worker_group_spec = 2; - // Whether to enable in-tree autoscaling. - bool enable_in_tree_autoscaling = 3; + // Whether to enable autoscaling. + bool enable_autoscaling = 3; } // HeadGroupSpec are the spec for the head pod diff --git a/flyteplugins/go/tasks/plugins/k8s/ray/ray.go b/flyteplugins/go/tasks/plugins/k8s/ray/ray.go index 4561e40df3..2f01448db8 100644 --- a/flyteplugins/go/tasks/plugins/k8s/ray/ray.go +++ b/flyteplugins/go/tasks/plugins/k8s/ray/ray.go @@ -119,7 +119,7 @@ func (rayJobResourceHandler) BuildResource(ctx context.Context, taskCtx pluginsC RayStartParams: headNodeRayStartParams, }, WorkerGroupSpecs: []rayv1alpha1.WorkerGroupSpec{}, - EnableInTreeAutoscaling: &rayJob.RayCluster.EnableInTreeAutoscaling, + EnableInTreeAutoscaling: &rayJob.RayCluster.EnableAutoscaling, } for _, spec := range rayJob.RayCluster.WorkerGroupSpec { @@ -165,11 +165,18 @@ func (rayJobResourceHandler) BuildResource(ctx context.Context, taskCtx pluginsC rayClusterSpec.WorkerGroupSpecs[index].Template.Spec.ServiceAccountName = serviceAccountName } + shutdownAfterJobFinishes := cfg.ShutdownAfterJobFinishes + ttlSecondsAfterFinished := &cfg.TTLSecondsAfterFinished + if rayJob.ShutdownAfterJobFinishes { + shutdownAfterJobFinishes = true + ttlSecondsAfterFinished = &rayJob.TtlSecondsAfterFinished + } + jobSpec := rayv1alpha1.RayJobSpec{ RayClusterSpec: rayClusterSpec, Entrypoint: strings.Join(primaryContainer.Args, " "), - ShutdownAfterJobFinishes: cfg.ShutdownAfterJobFinishes, - TTLSecondsAfterFinished: &cfg.TTLSecondsAfterFinished, + ShutdownAfterJobFinishes: shutdownAfterJobFinishes, + TTLSecondsAfterFinished: ttlSecondsAfterFinished, RuntimeEnv: rayJob.RuntimeEnv, } From 0122a24544fe07354b5b2f5993b20078d1ed3496 Mon Sep 17 00:00:00 2001 From: Yicheng-Lu-llll Date: Fri, 22 Dec 2023 02:32:19 +0000 Subject: [PATCH 07/13] nit Signed-off-by: Yicheng-Lu-llll --- flyteplugins/go/tasks/plugins/k8s/ray/ray.go | 6 ++-- .../go/tasks/plugins/k8s/ray/ray_test.go | 30 +++++++++++-------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/flyteplugins/go/tasks/plugins/k8s/ray/ray.go b/flyteplugins/go/tasks/plugins/k8s/ray/ray.go index 2f01448db8..4b9e251e26 100644 --- a/flyteplugins/go/tasks/plugins/k8s/ray/ray.go +++ b/flyteplugins/go/tasks/plugins/k8s/ray/ray.go @@ -36,8 +36,7 @@ const ( DisableUsageStatsStartParameter = "disable-usage-stats" ) -type rayJobResourceHandler struct { -} +type rayJobResourceHandler struct{} func (rayJobResourceHandler) GetProperties() k8s.PluginProperties { return k8s.PluginProperties{} @@ -171,7 +170,7 @@ func (rayJobResourceHandler) BuildResource(ctx context.Context, taskCtx pluginsC shutdownAfterJobFinishes = true ttlSecondsAfterFinished = &rayJob.TtlSecondsAfterFinished } - + jobSpec := rayv1alpha1.RayJobSpec{ RayClusterSpec: rayClusterSpec, Entrypoint: strings.Join(primaryContainer.Args, " "), @@ -447,7 +446,6 @@ func getEventInfoForRayJob(logConfig logs.LogConfig, pluginContext k8s.PluginCon Namespace: rayJob.Namespace, TaskExecutionIdentifier: &taskID, }) - if err != nil { return nil, fmt.Errorf("failed to generate task logs. Error: %w", err) } diff --git a/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go b/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go index b524befcc4..09c03ca854 100644 --- a/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go +++ b/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go @@ -27,8 +27,10 @@ import ( "github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/utils" ) -const testImage = "image://" -const serviceAccount = "ray_sa" +const ( + testImage = "image://" + serviceAccount = "ray_sa" +) var ( dummyEnvVars = []*core.KeyValuePair{ @@ -78,9 +80,9 @@ func transformPodSpecToTaskTemplateTarget(podSpec *corev1.PodSpec) *core.TaskTem func dummyRayCustomObj() *plugins.RayJob { return &plugins.RayJob{ RayCluster: &plugins.RayCluster{ - HeadGroupSpec: &plugins.HeadGroupSpec{RayStartParams: map[string]string{"num-cpus": "1"}}, - WorkerGroupSpec: []*plugins.WorkerGroupSpec{{GroupName: workerGroupName, Replicas: 3, MinReplicas: 3, MaxReplicas: 3}}, - EnableInTreeAutoscaling: false, + HeadGroupSpec: &plugins.HeadGroupSpec{RayStartParams: map[string]string{"num-cpus": "1"}}, + WorkerGroupSpec: []*plugins.WorkerGroupSpec{{GroupName: workerGroupName, Replicas: 3, MinReplicas: 3, MaxReplicas: 3}}, + EnableAutoscaling: false, }, } } @@ -184,7 +186,8 @@ func TestBuildResourceRay(t *testing.T) { assert.Equal(t, ray.Spec.RayClusterSpec.HeadGroupSpec.RayStartParams, map[string]string{ "dashboard-host": "0.0.0.0", "disable-usage-stats": "true", "include-dashboard": "true", - "node-ip-address": "$MY_POD_IP", "num-cpus": "1"}) + "node-ip-address": "$MY_POD_IP", "num-cpus": "1", + }) assert.Equal(t, ray.Spec.RayClusterSpec.HeadGroupSpec.Template.Annotations, map[string]string{"annotation-1": "val1"}) assert.Equal(t, ray.Spec.RayClusterSpec.HeadGroupSpec.Template.Labels, map[string]string{"label-1": "val1"}) assert.Equal(t, ray.Spec.RayClusterSpec.HeadGroupSpec.Template.Spec.Tolerations, toleration) @@ -232,7 +235,7 @@ func TestBuildResourceRayExtendedResources(t *testing.T) { []corev1.NodeSelectorTerm{ { MatchExpressions: []corev1.NodeSelectorRequirement{ - corev1.NodeSelectorRequirement{ + { Key: "gpu-node-label", Operator: corev1.NodeSelectorOpIn, Values: []string{"nvidia-tesla-t4"}, @@ -272,12 +275,12 @@ func TestBuildResourceRayExtendedResources(t *testing.T) { []corev1.NodeSelectorTerm{ { MatchExpressions: []corev1.NodeSelectorRequirement{ - corev1.NodeSelectorRequirement{ + { Key: "gpu-node-label", Operator: corev1.NodeSelectorOpIn, Values: []string{"nvidia-tesla-a100"}, }, - corev1.NodeSelectorRequirement{ + { Key: "gpu-partition-size", Operator: corev1.NodeSelectorOpIn, Values: []string{"1g.5gb"}, @@ -347,9 +350,9 @@ func TestDefaultStartParameters(t *testing.T) { rayJobResourceHandler := rayJobResourceHandler{} rayJob := &plugins.RayJob{ RayCluster: &plugins.RayCluster{ - HeadGroupSpec: &plugins.HeadGroupSpec{}, - WorkerGroupSpec: []*plugins.WorkerGroupSpec{{GroupName: workerGroupName, Replicas: 3, MinReplicas: 3, MaxReplicas: 3}}, - EnableInTreeAutoscaling: false, + HeadGroupSpec: &plugins.HeadGroupSpec{}, + WorkerGroupSpec: []*plugins.WorkerGroupSpec{{GroupName: workerGroupName, Replicas: 3, MinReplicas: 3, MaxReplicas: 3}}, + EnableAutoscaling: false, }, } @@ -378,7 +381,8 @@ func TestDefaultStartParameters(t *testing.T) { assert.Equal(t, ray.Spec.RayClusterSpec.HeadGroupSpec.RayStartParams, map[string]string{ "dashboard-host": "0.0.0.0", "disable-usage-stats": "true", "include-dashboard": "true", - "node-ip-address": "$MY_POD_IP"}) + "node-ip-address": "$MY_POD_IP", + }) assert.Equal(t, ray.Spec.RayClusterSpec.HeadGroupSpec.Template.Annotations, map[string]string{"annotation-1": "val1"}) assert.Equal(t, ray.Spec.RayClusterSpec.HeadGroupSpec.Template.Labels, map[string]string{"label-1": "val1"}) assert.Equal(t, ray.Spec.RayClusterSpec.HeadGroupSpec.Template.Spec.Tolerations, toleration) From ee1aafb394a5c73dc6dddb1d04adf94e284d9268 Mon Sep 17 00:00:00 2001 From: Yicheng-Lu-llll Date: Fri, 22 Dec 2023 03:22:00 +0000 Subject: [PATCH 08/13] change JobDeploymentStatusFailedToGetJobStatus -> PhaseInfoRunning Signed-off-by: Yicheng-Lu-llll --- flyteplugins/go/tasks/plugins/k8s/ray/ray.go | 2 +- flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/flyteplugins/go/tasks/plugins/k8s/ray/ray.go b/flyteplugins/go/tasks/plugins/k8s/ray/ray.go index 4b9e251e26..13edda71ea 100644 --- a/flyteplugins/go/tasks/plugins/k8s/ray/ray.go +++ b/flyteplugins/go/tasks/plugins/k8s/ray/ray.go @@ -476,7 +476,7 @@ func (plugin rayJobResourceHandler) GetTaskPhase(ctx context.Context, pluginCont case rayv1alpha1.JobDeploymentStatusFailedJobDeploy: reason := fmt.Sprintf("Failed to submit Ray job %s with error: %s", rayJob.Name, rayJob.Status.Message) return pluginsCore.PhaseInfoFailure(flyteerr.TaskFailedWithError, reason, info), nil - case rayv1alpha1.JobDeploymentStatusWaitForDashboard: + case rayv1alpha1.JobDeploymentStatusWaitForDashboard, rayv1alpha1.JobDeploymentStatusFailedToGetJobStatus: return pluginsCore.PhaseInfoRunning(pluginsCore.DefaultPhaseVersion, info), nil case rayv1alpha1.JobDeploymentStatusRunning, rayv1alpha1.JobDeploymentStatusComplete: switch rayJob.Status.JobStatus { diff --git a/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go b/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go index 09c03ca854..fec485d40e 100644 --- a/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go +++ b/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go @@ -658,7 +658,7 @@ func TestGetTaskPhase(t *testing.T) { {rayv1alpha1.JobStatusPending, rayv1alpha1.JobDeploymentStatusWaitForDashboard, pluginsCore.PhaseRunning}, {rayv1alpha1.JobStatusPending, rayv1alpha1.JobDeploymentStatusFailedJobDeploy, pluginsCore.PhasePermanentFailure}, {rayv1alpha1.JobStatusPending, rayv1alpha1.JobDeploymentStatusRunning, pluginsCore.PhaseRunning}, - {rayv1alpha1.JobStatusPending, rayv1alpha1.JobDeploymentStatusFailedToGetJobStatus, pluginsCore.PhaseUndefined}, + {rayv1alpha1.JobStatusPending, rayv1alpha1.JobDeploymentStatusFailedToGetJobStatus, pluginsCore.PhaseRunning}, {rayv1alpha1.JobStatusRunning, rayv1alpha1.JobDeploymentStatusRunning, pluginsCore.PhaseRunning}, {rayv1alpha1.JobStatusFailed, rayv1alpha1.JobDeploymentStatusRunning, pluginsCore.PhasePermanentFailure}, {rayv1alpha1.JobStatusSucceeded, rayv1alpha1.JobDeploymentStatusRunning, pluginsCore.PhaseSuccess}, From 1fb115a21201e8c146ec50de2d953fdbb3815011 Mon Sep 17 00:00:00 2001 From: Yicheng-Lu-llll Date: Fri, 22 Dec 2023 06:30:46 +0000 Subject: [PATCH 09/13] rebasing Signed-off-by: Yicheng-Lu-llll --- flyteplugins/go/tasks/plugins/k8s/ray/ray.go | 17 +++++++++------ .../go/tasks/plugins/k8s/ray/ray_test.go | 21 ++++++++++--------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/flyteplugins/go/tasks/plugins/k8s/ray/ray.go b/flyteplugins/go/tasks/plugins/k8s/ray/ray.go index 13edda71ea..ecddc57c8f 100644 --- a/flyteplugins/go/tasks/plugins/k8s/ray/ray.go +++ b/flyteplugins/go/tasks/plugins/k8s/ray/ray.go @@ -36,7 +36,16 @@ const ( DisableUsageStatsStartParameter = "disable-usage-stats" ) -type rayJobResourceHandler struct{} +var logTemplateRegexes = struct { + RayClusterName *regexp.Regexp + RayJobID *regexp.Regexp +}{ + tasklog.MustCreateRegex("rayClusterName"), + tasklog.MustCreateRegex("rayJobID"), +} + +type rayJobResourceHandler struct { +} func (rayJobResourceHandler) GetProperties() k8s.PluginProperties { return k8s.PluginProperties{} @@ -441,11 +450,7 @@ func getEventInfoForRayJob(logConfig logs.LogConfig, pluginContext k8s.PluginCon // TODO: Retrieve the name of head pod from rayJob.status, and add it to task logs // RayJob CRD does not include the name of the worker or head pod for now - taskID := pluginContext.TaskExecutionMetadata().GetTaskExecutionID().GetID() - logOutput, err := logPlugin.GetTaskLogs(tasklog.Input{ - Namespace: rayJob.Namespace, - TaskExecutionIdentifier: &taskID, - }) + logOutput, err := logPlugin.GetTaskLogs(input) if err != nil { return nil, fmt.Errorf("failed to generate task logs. Error: %w", err) } diff --git a/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go b/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go index fec485d40e..d9df1f3131 100644 --- a/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go +++ b/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go @@ -653,16 +653,17 @@ func TestGetTaskPhase(t *testing.T) { rayClusterPhase rayv1alpha1.JobDeploymentStatus expectedCorePhase pluginsCore.Phase }{ - {"", rayv1alpha1.JobDeploymentStatusInitializing, pluginsCore.PhaseInitializing}, - {rayv1alpha1.JobStatusPending, rayv1alpha1.JobDeploymentStatusFailedToGetOrCreateRayCluster, pluginsCore.PhasePermanentFailure}, - {rayv1alpha1.JobStatusPending, rayv1alpha1.JobDeploymentStatusWaitForDashboard, pluginsCore.PhaseRunning}, - {rayv1alpha1.JobStatusPending, rayv1alpha1.JobDeploymentStatusFailedJobDeploy, pluginsCore.PhasePermanentFailure}, - {rayv1alpha1.JobStatusPending, rayv1alpha1.JobDeploymentStatusRunning, pluginsCore.PhaseRunning}, - {rayv1alpha1.JobStatusPending, rayv1alpha1.JobDeploymentStatusFailedToGetJobStatus, pluginsCore.PhaseRunning}, - {rayv1alpha1.JobStatusRunning, rayv1alpha1.JobDeploymentStatusRunning, pluginsCore.PhaseRunning}, - {rayv1alpha1.JobStatusFailed, rayv1alpha1.JobDeploymentStatusRunning, pluginsCore.PhasePermanentFailure}, - {rayv1alpha1.JobStatusSucceeded, rayv1alpha1.JobDeploymentStatusRunning, pluginsCore.PhaseSuccess}, - {rayv1alpha1.JobStatusSucceeded, rayv1alpha1.JobDeploymentStatusComplete, pluginsCore.PhaseSuccess}, + {"", rayv1alpha1.JobDeploymentStatusInitializing, pluginsCore.PhaseInitializing, false}, + {rayv1alpha1.JobStatusPending, rayv1alpha1.JobDeploymentStatusFailedToGetOrCreateRayCluster, pluginsCore.PhasePermanentFailure, false}, + {rayv1alpha1.JobStatusPending, rayv1alpha1.JobDeploymentStatusWaitForDashboard, pluginsCore.PhaseRunning, false}, + {rayv1alpha1.JobStatusPending, rayv1alpha1.JobDeploymentStatusFailedJobDeploy, pluginsCore.PhasePermanentFailure, false}, + {rayv1alpha1.JobStatusPending, rayv1alpha1.JobDeploymentStatusRunning, pluginsCore.PhaseRunning, false}, + {rayv1alpha1.JobStatusPending, rayv1alpha1.JobDeploymentStatusFailedToGetJobStatus, pluginsCore.PhaseRunning, false}, + {rayv1alpha1.JobStatusRunning, rayv1alpha1.JobDeploymentStatusRunning, pluginsCore.PhaseRunning, false}, + {rayv1alpha1.JobStatusFailed, rayv1alpha1.JobDeploymentStatusRunning, pluginsCore.PhasePermanentFailure, false}, + {rayv1alpha1.JobStatusSucceeded, rayv1alpha1.JobDeploymentStatusRunning, pluginsCore.PhaseSuccess, false}, + {rayv1alpha1.JobStatusSucceeded, rayv1alpha1.JobDeploymentStatusComplete, pluginsCore.PhaseSuccess, false}, + {rayv1alpha1.JobStatusStopped, rayv1alpha1.JobDeploymentStatusComplete, pluginsCore.PhaseUndefined, true}, } for _, tc := range testCases { From 30e21a310467dd7c2ec808ae0344e9c6c9fc862f Mon Sep 17 00:00:00 2001 From: Yicheng-Lu-llll Date: Fri, 22 Dec 2023 06:31:32 +0000 Subject: [PATCH 10/13] rebasing Signed-off-by: Yicheng-Lu-llll --- flyteplugins/go/tasks/plugins/k8s/ray/ray.go | 1 - 1 file changed, 1 deletion(-) diff --git a/flyteplugins/go/tasks/plugins/k8s/ray/ray.go b/flyteplugins/go/tasks/plugins/k8s/ray/ray.go index ecddc57c8f..a3261329dc 100644 --- a/flyteplugins/go/tasks/plugins/k8s/ray/ray.go +++ b/flyteplugins/go/tasks/plugins/k8s/ray/ray.go @@ -449,7 +449,6 @@ func getEventInfoForRayJob(logConfig logs.LogConfig, pluginContext k8s.PluginCon // TODO: Retrieve the name of head pod from rayJob.status, and add it to task logs // RayJob CRD does not include the name of the worker or head pod for now - logOutput, err := logPlugin.GetTaskLogs(input) if err != nil { return nil, fmt.Errorf("failed to generate task logs. Error: %w", err) From 695b3bc11df7c41fa6cc71cc617ebfba4f255b0a Mon Sep 17 00:00:00 2001 From: Yicheng-Lu-llll Date: Fri, 22 Dec 2023 21:18:54 +0000 Subject: [PATCH 11/13] enforce minreplica < replica < maxreplica Signed-off-by: Yicheng-Lu-llll --- flyteplugins/go/tasks/plugins/k8s/ray/ray.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/flyteplugins/go/tasks/plugins/k8s/ray/ray.go b/flyteplugins/go/tasks/plugins/k8s/ray/ray.go index 12f709d7cd..f6abb58c93 100644 --- a/flyteplugins/go/tasks/plugins/k8s/ray/ray.go +++ b/flyteplugins/go/tasks/plugins/k8s/ray/ray.go @@ -46,8 +46,7 @@ var logTemplateRegexes = struct { tasklog.MustCreateRegex("rayJobID"), } -type rayJobResourceHandler struct { -} +type rayJobResourceHandler struct{} func (rayJobResourceHandler) GetProperties() k8s.PluginProperties { return k8s.PluginProperties{} @@ -156,10 +155,19 @@ func (rayJobResourceHandler) BuildResource(ctx context.Context, taskCtx pluginsC workerNodeRayStartParams[DisableUsageStatsStartParameter] = "true" } + minReplicas := spec.MinReplicas + if minReplicas > spec.Replicas { + minReplicas = spec.Replicas + } + maxReplicas := spec.MaxReplicas + if maxReplicas < spec.Replicas { + maxReplicas = spec.Replicas + } + workerNodeSpec := rayv1alpha1.WorkerGroupSpec{ GroupName: spec.GroupName, - MinReplicas: &spec.MinReplicas, - MaxReplicas: &spec.MaxReplicas, + MinReplicas: &minReplicas, + MaxReplicas: &maxReplicas, Replicas: &spec.Replicas, RayStartParams: workerNodeRayStartParams, Template: workerPodTemplate, From 76e422d45a7b45733724ae5630d32f503c68b728 Mon Sep 17 00:00:00 2001 From: Yicheng-Lu-llll Date: Fri, 22 Dec 2023 21:41:26 +0000 Subject: [PATCH 12/13] add test for ShutdownAfterJobFinishes and TTLSecondsAfterFinished Signed-off-by: Yicheng-Lu-llll --- .../go/tasks/plugins/k8s/ray/ray_test.go | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go b/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go index 111c84f801..0d71abe970 100644 --- a/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go +++ b/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go @@ -81,9 +81,11 @@ func transformPodSpecToTaskTemplateTarget(podSpec *corev1.PodSpec) *core.TaskTem func dummyRayCustomObj() *plugins.RayJob { return &plugins.RayJob{ RayCluster: &plugins.RayCluster{ - HeadGroupSpec: &plugins.HeadGroupSpec{RayStartParams: map[string]string{"num-cpus": "1"}}, - WorkerGroupSpec: []*plugins.WorkerGroupSpec{{GroupName: workerGroupName, Replicas: 3, MinReplicas: 3, MaxReplicas: 3}}, - EnableAutoscaling: false, + HeadGroupSpec: &plugins.HeadGroupSpec{RayStartParams: map[string]string{"num-cpus": "1"}}, + WorkerGroupSpec: []*plugins.WorkerGroupSpec{{GroupName: workerGroupName, Replicas: 3, MinReplicas: 3, MaxReplicas: 3}}, + EnableAutoscaling: true, + ShutdownAfterJobFinishes: true, + TtlSecondsAfterFinished: 120, }, } } @@ -179,7 +181,9 @@ func TestBuildResourceRay(t *testing.T) { ray, ok := RayResource.(*rayv1alpha1.RayJob) assert.True(t, ok) - assert.Equal(t, *ray.Spec.RayClusterSpec.EnableInTreeAutoscaling, false) + assert.Equal(t, *ray.Spec.RayClusterSpec.EnableInTreeAutoscaling, true) + assert.Equal(t, *ray.Spec.RayClusterSpec.ShutdownAfterJobFinishes, true) + assert.Equal(t, *ray.Spec.RayClusterSpec.TTLSecondsAfterFinished, int32(120)) headReplica := int32(1) assert.Equal(t, *ray.Spec.RayClusterSpec.HeadGroupSpec.Replicas, headReplica) @@ -351,9 +355,11 @@ func TestDefaultStartParameters(t *testing.T) { rayJobResourceHandler := rayJobResourceHandler{} rayJob := &plugins.RayJob{ RayCluster: &plugins.RayCluster{ - HeadGroupSpec: &plugins.HeadGroupSpec{}, - WorkerGroupSpec: []*plugins.WorkerGroupSpec{{GroupName: workerGroupName, Replicas: 3, MinReplicas: 3, MaxReplicas: 3}}, - EnableAutoscaling: false, + HeadGroupSpec: &plugins.HeadGroupSpec{}, + WorkerGroupSpec: []*plugins.WorkerGroupSpec{{GroupName: workerGroupName, Replicas: 3, MinReplicas: 3, MaxReplicas: 3}}, + EnableAutoscaling: true, + ShutdownAfterJobFinishes: true, + TtlSecondsAfterFinished: 120, }, } @@ -374,7 +380,9 @@ func TestDefaultStartParameters(t *testing.T) { ray, ok := RayResource.(*rayv1alpha1.RayJob) assert.True(t, ok) - assert.Equal(t, *ray.Spec.RayClusterSpec.EnableInTreeAutoscaling, false) + assert.Equal(t, *ray.Spec.RayClusterSpec.EnableInTreeAutoscaling, true) + assert.Equal(t, *ray.Spec.RayClusterSpec.ShutdownAfterJobFinishes, true) + assert.Equal(t, *ray.Spec.RayClusterSpec.TTLSecondsAfterFinished, int32(120)) headReplica := int32(1) assert.Equal(t, *ray.Spec.RayClusterSpec.HeadGroupSpec.Replicas, headReplica) From f4f50f499b2c042bb2338ebe20d2d68323f4698c Mon Sep 17 00:00:00 2001 From: Yicheng-Lu-llll Date: Fri, 22 Dec 2023 22:05:04 +0000 Subject: [PATCH 13/13] fix ray test error Signed-off-by: Yicheng-Lu-llll --- .../go/tasks/plugins/k8s/ray/ray_test.go | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go b/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go index 0d71abe970..b171ae9aa8 100644 --- a/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go +++ b/flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go @@ -81,12 +81,12 @@ func transformPodSpecToTaskTemplateTarget(podSpec *corev1.PodSpec) *core.TaskTem func dummyRayCustomObj() *plugins.RayJob { return &plugins.RayJob{ RayCluster: &plugins.RayCluster{ - HeadGroupSpec: &plugins.HeadGroupSpec{RayStartParams: map[string]string{"num-cpus": "1"}}, - WorkerGroupSpec: []*plugins.WorkerGroupSpec{{GroupName: workerGroupName, Replicas: 3, MinReplicas: 3, MaxReplicas: 3}}, - EnableAutoscaling: true, - ShutdownAfterJobFinishes: true, - TtlSecondsAfterFinished: 120, + HeadGroupSpec: &plugins.HeadGroupSpec{RayStartParams: map[string]string{"num-cpus": "1"}}, + WorkerGroupSpec: []*plugins.WorkerGroupSpec{{GroupName: workerGroupName, Replicas: 3, MinReplicas: 3, MaxReplicas: 3}}, + EnableAutoscaling: true, }, + ShutdownAfterJobFinishes: true, + TtlSecondsAfterFinished: 120, } } @@ -182,8 +182,8 @@ func TestBuildResourceRay(t *testing.T) { assert.True(t, ok) assert.Equal(t, *ray.Spec.RayClusterSpec.EnableInTreeAutoscaling, true) - assert.Equal(t, *ray.Spec.RayClusterSpec.ShutdownAfterJobFinishes, true) - assert.Equal(t, *ray.Spec.RayClusterSpec.TTLSecondsAfterFinished, int32(120)) + assert.Equal(t, ray.Spec.ShutdownAfterJobFinishes, true) + assert.Equal(t, *ray.Spec.TTLSecondsAfterFinished, int32(120)) headReplica := int32(1) assert.Equal(t, *ray.Spec.RayClusterSpec.HeadGroupSpec.Replicas, headReplica) @@ -355,12 +355,12 @@ func TestDefaultStartParameters(t *testing.T) { rayJobResourceHandler := rayJobResourceHandler{} rayJob := &plugins.RayJob{ RayCluster: &plugins.RayCluster{ - HeadGroupSpec: &plugins.HeadGroupSpec{}, - WorkerGroupSpec: []*plugins.WorkerGroupSpec{{GroupName: workerGroupName, Replicas: 3, MinReplicas: 3, MaxReplicas: 3}}, - EnableAutoscaling: true, - ShutdownAfterJobFinishes: true, - TtlSecondsAfterFinished: 120, + HeadGroupSpec: &plugins.HeadGroupSpec{}, + WorkerGroupSpec: []*plugins.WorkerGroupSpec{{GroupName: workerGroupName, Replicas: 3, MinReplicas: 3, MaxReplicas: 3}}, + EnableAutoscaling: true, }, + ShutdownAfterJobFinishes: true, + TtlSecondsAfterFinished: 120, } taskTemplate := dummyRayTaskTemplate("ray-id", rayJob) @@ -381,8 +381,8 @@ func TestDefaultStartParameters(t *testing.T) { assert.True(t, ok) assert.Equal(t, *ray.Spec.RayClusterSpec.EnableInTreeAutoscaling, true) - assert.Equal(t, *ray.Spec.RayClusterSpec.ShutdownAfterJobFinishes, true) - assert.Equal(t, *ray.Spec.RayClusterSpec.TTLSecondsAfterFinished, int32(120)) + assert.Equal(t, ray.Spec.ShutdownAfterJobFinishes, true) + assert.Equal(t, *ray.Spec.TTLSecondsAfterFinished, int32(120)) headReplica := int32(1) assert.Equal(t, *ray.Spec.RayClusterSpec.HeadGroupSpec.Replicas, headReplica)