Skip to content

Commit

Permalink
Update RayService CR to integrate with Ray Nightly (#322)
Browse files Browse the repository at this point in the history
* draft for ha

* import fmt

* debug ingress

* Draft service

* update

* fix

* Update service logic

* update

* update

* Logs

* update

* debug

* Update

* Update

* Update

* update

* Fix cluster start flaky issue

* update

* Update service and ingress

* update rbac

* Draft v1

* Update

* address comments

* Address comments and refactor codes

* update

* Fix lint issue

* update

* Fix unit tests

* goImport

* Update unit tests

* Implement unit tests

* Change preparing to pending

* goimports

* update

* Improve the pr to show both statuses

* Improve the pr to show both statuses

* update to align with latest serve status

* update

* Fix ut and imports

* update

* update

* address comments

* update

* update delete ray cluster logic

* update delete ray cluster logic

* update

* Apply new spec schema for serve deployment

* use new schema

* auto generate

* auto generate

* goimports

* Update cpu number

* update ut

* update ut

* update

* update

* update

* update

* address comments
  • Loading branch information
brucez-anyscale authored Jul 5, 2022
1 parent 6a85afc commit 2d798aa
Show file tree
Hide file tree
Showing 9 changed files with 323 additions and 339 deletions.
31 changes: 17 additions & 14 deletions ray-operator/apis/ray/v1alpha1/rayservice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,25 @@ const (
// RayServiceSpec defines the desired state of RayService
type RayServiceSpec struct {
// Important: Run "make" to regenerate code after modifying this file
ServeDeploymentGraphSpec ServeDeploymentGraphSpec `json:"serveDeploymentGraphConfig,omitempty"`
RayClusterSpec RayClusterSpec `json:"rayClusterConfig,omitempty"`
}

type ServeDeploymentGraphSpec struct {
ImportPath string `json:"importPath"`
RuntimeEnv string `json:"runtimeEnv,omitempty"`
ServeConfigSpecs []ServeConfigSpec `json:"serveConfigs,omitempty"`
RayClusterSpec RayClusterSpec `json:"rayClusterConfig,omitempty"`
}

// ServeConfigSpec defines the desired state of RayService
// Reference to https://docs.ray.io/en/latest/ray-core/package-ref.html#ray-remote.
// Reference to http://rayserve.org
type ServeConfigSpec struct {
Name string `json:"name"`
ImportPath string `json:"importPath"`
InitArgs []string `json:"initArgs,omitempty"`
InitKwargs map[string]string `json:"initKwargs,omitempty"`
NumReplicas *int32 `json:"numReplicas,omitempty"`
RoutePrefix string `json:"routePrefix,omitempty"`
MaxConcurrentQueries *int32 `json:"maxConcurrentQueries,omitempty"`
UserConfig map[string]string `json:"userConfig,omitempty"`
AutoscalingConfig map[string]string `json:"autoscalingConfig,omitempty"`
UserConfig string `json:"userConfig,omitempty"`
AutoscalingConfig string `json:"autoscalingConfig,omitempty"`
GracefulShutdownWaitLoopS *int32 `json:"gracefulShutdownWaitLoopS,omitempty"`
GracefulShutdownTimeoutS *int32 `json:"gracefulShutdownTimeoutS,omitempty"`
HealthCheckPeriodS *int32 `json:"healthCheckPeriodS,omitempty"`
Expand All @@ -48,13 +51,13 @@ type ServeConfigSpec struct {

// RayActorOptionSpec defines the desired state of RayActor
type RayActorOptionSpec struct {
RuntimeEnv map[string][]string `json:"runtimeEnv,omitempty"`
NumCpus *float64 `json:"numCpus,omitempty"`
NumGpus *float64 `json:"numGpus,omitempty"`
Memory *int32 `json:"memory,omitempty"`
ObjectStoreMemory *int32 `json:"objectStoreMemory,omitempty"`
Resources map[string]string `json:"resources,omitempty"`
AcceleratorType string `json:"acceleratorType,omitempty"`
RuntimeEnv string `json:"runtimeEnv,omitempty"`
NumCpus *float64 `json:"numCpus,omitempty"`
NumGpus *float64 `json:"numGpus,omitempty"`
Memory *int32 `json:"memory,omitempty"`
ObjectStoreMemory *int32 `json:"objectStoreMemory,omitempty"`
Resources string `json:"resources,omitempty"`
AcceleratorType string `json:"acceleratorType,omitempty"`
}

// RayServiceStatuses defines the observed state of RayService
Expand Down
165 changes: 82 additions & 83 deletions ray-operator/apis/ray/v1alpha1/rayservice_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,55 +14,55 @@ import (

var numReplicas int32 = 1
var numCpus = 0.1
var runtimeEnvStr = "working_dir:\n - \"https://github.com/ray-project/test_dag/archive/c620251044717ace0a4c19d766d43c5099af8a77.zip\""

var myRayService = &RayService{
ObjectMeta: metav1.ObjectMeta{
Name: "rayservice-sample",
Namespace: "default",
},
Spec: RayServiceSpec{
ServeConfigSpecs: []ServeConfigSpec{
{
Name: "shallow",
ImportPath: "test_env.shallow_import.ShallowClass",
NumReplicas: &numReplicas,
RoutePrefix: "/shallow",
RayActorOptions: RayActorOptionSpec{
NumCpus: &numCpus,
RuntimeEnv: map[string][]string{
"py_modules": {
"https://github.com/ray-project/test_deploy_group/archive/67971777e225600720f91f618cdfe71fc47f60ee.zip",
"https://github.com/ray-project/test_module/archive/aa6f366f7daa78c98408c27d917a983caa9f888b.zip",
},
ServeDeploymentGraphSpec: ServeDeploymentGraphSpec{
ImportPath: "fruit.deployment_graph",
RuntimeEnv: runtimeEnvStr,
ServeConfigSpecs: []ServeConfigSpec{
{
Name: "MangoStand",
NumReplicas: &numReplicas,
UserConfig: "price: 3",
RayActorOptions: RayActorOptionSpec{
NumCpus: &numCpus,
},
},
},
{
Name: "deep",
ImportPath: "test_env.subdir1.subdir2.deep_import.DeepClass",
NumReplicas: &numReplicas,
RoutePrefix: "/deep",
RayActorOptions: RayActorOptionSpec{
NumCpus: &numCpus,
RuntimeEnv: map[string][]string{
"py_modules": {
"https://github.com/ray-project/test_deploy_group/archive/67971777e225600720f91f618cdfe71fc47f60ee.zip",
"https://github.com/ray-project/test_module/archive/aa6f366f7daa78c98408c27d917a983caa9f888b.zip",
},
{
Name: "OrangeStand",
NumReplicas: &numReplicas,
UserConfig: "price: 2",
RayActorOptions: RayActorOptionSpec{
NumCpus: &numCpus,
},
},
},
{
Name: "one",
ImportPath: "test_module.test.one",
NumReplicas: &numReplicas,
RayActorOptions: RayActorOptionSpec{
NumCpus: &numCpus,
RuntimeEnv: map[string][]string{
"py_modules": {
"https://github.com/ray-project/test_deploy_group/archive/67971777e225600720f91f618cdfe71fc47f60ee.zip",
"https://github.com/ray-project/test_module/archive/aa6f366f7daa78c98408c27d917a983caa9f888b.zip",
},
{
Name: "PearStand",
NumReplicas: &numReplicas,
UserConfig: "price: 1",
RayActorOptions: RayActorOptionSpec{
NumCpus: &numCpus,
},
},
{
Name: "FruitMarket",
NumReplicas: &numReplicas,
RayActorOptions: RayActorOptionSpec{
NumCpus: &numCpus,
},
},
{
Name: "DAGDriver",
NumReplicas: &numReplicas,
RoutePrefix: "/",
RayActorOptions: RayActorOptionSpec{
NumCpus: &numCpus,
},
},
},
Expand Down Expand Up @@ -187,52 +187,51 @@ var expected = `{
"creationTimestamp":null
},
"spec":{
"serveConfigs":[
{
"name":"shallow",
"importPath":"test_env.shallow_import.ShallowClass",
"numReplicas":1,
"routePrefix":"/shallow",
"rayActorOptions":{
"runtimeEnv":{
"py_modules":[
"https://github.com/ray-project/test_deploy_group/archive/67971777e225600720f91f618cdfe71fc47f60ee.zip",
"https://github.com/ray-project/test_module/archive/aa6f366f7daa78c98408c27d917a983caa9f888b.zip"
]
},
"numCpus":0.1
}
},
{
"name":"deep",
"importPath":"test_env.subdir1.subdir2.deep_import.DeepClass",
"numReplicas":1,
"routePrefix":"/deep",
"rayActorOptions":{
"runtimeEnv":{
"py_modules":[
"https://github.com/ray-project/test_deploy_group/archive/67971777e225600720f91f618cdfe71fc47f60ee.zip",
"https://github.com/ray-project/test_module/archive/aa6f366f7daa78c98408c27d917a983caa9f888b.zip"
]
},
"numCpus":0.1
}
},
{
"name":"one",
"importPath":"test_module.test.one",
"numReplicas":1,
"rayActorOptions":{
"runtimeEnv":{
"py_modules":[
"https://github.com/ray-project/test_deploy_group/archive/67971777e225600720f91f618cdfe71fc47f60ee.zip",
"https://github.com/ray-project/test_module/archive/aa6f366f7daa78c98408c27d917a983caa9f888b.zip"
]
},
"numCpus":0.1
"serveDeploymentGraphConfig":{
"importPath":"fruit.deployment_graph",
"runtimeEnv":"working_dir:\n - \"https://github.com/ray-project/test_dag/archive/c620251044717ace0a4c19d766d43c5099af8a77.zip\"",
"serveConfigs":[
{
"name":"MangoStand",
"numReplicas":1,
"userConfig":"price: 3",
"rayActorOptions":{
"numCpus":0.1
}
},
{
"name":"OrangeStand",
"numReplicas":1,
"userConfig":"price: 2",
"rayActorOptions":{
"numCpus":0.1
}
},
{
"name":"PearStand",
"numReplicas":1,
"userConfig":"price: 1",
"rayActorOptions":{
"numCpus":0.1
}
},
{
"name":"FruitMarket",
"numReplicas":1,
"rayActorOptions":{
"numCpus":0.1
}
},
{
"name":"DAGDriver",
"numReplicas":1,
"routePrefix":"/",
"rayActorOptions":{
"numCpus":0.1
}
}
}
],
]
},
"rayClusterConfig":{
"headGroupSpec":{
"serviceType":"ClusterIP",
Expand Down
78 changes: 23 additions & 55 deletions ray-operator/apis/ray/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2d798aa

Please sign in to comment.