Skip to content

Commit

Permalink
Fixed PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mcariatm committed May 4, 2023
1 parent 58c54e8 commit 3371dee
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion helm-chart/kuberay-operator/crds/ray.io_rayjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11745,7 +11745,7 @@ spec:
type: boolean
suspend:
description: suspend specifies whether the RayJob controller should
create a RayCluster instance
create a RayCluster instance If a job is appl
type: boolean
ttlSecondsAfterFinished:
description: TTLSecondsAfterFinished is the TTL to clean up RayCluster.
Expand Down
2 changes: 1 addition & 1 deletion ray-operator/config/crd/bases/ray.io_rayjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11745,7 +11745,7 @@ spec:
type: boolean
suspend:
description: suspend specifies whether the RayJob controller should
create a RayCluster instance
create a RayCluster instance If a job is appl
type: boolean
ttlSecondsAfterFinished:
description: TTLSecondsAfterFinished is the TTL to clean up RayCluster.
Expand Down
6 changes: 3 additions & 3 deletions ray-operator/controllers/ray/rayjob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,10 @@ func (r *RayJobReconciler) Reconcile(ctx context.Context, request ctrl.Request)
return ctrl.Result{RequeueAfter: RayJobDefaultRequeueDuration}, err
}
}
err = r.updateState(ctx, rayJobInstance, jobInfo, rayv1alpha1.JobStatusStopped, rayJobInstance.Status.JobDeploymentStatus, nil)
if err != nil {
return ctrl.Result{RequeueAfter: RayJobDefaultRequeueDuration}, err
if info.JobStatus != rayv1alpha1.JobStatusStopped {
return ctrl.Result{RequeueAfter: RayJobDefaultRequeueDuration}, nil
}

_, err = r.deleteCluster(ctx, rayJobInstance)
if err != nil && !errors.IsNotFound(err) {
return ctrl.Result{RequeueAfter: RayJobDefaultRequeueDuration}, nil
Expand Down
10 changes: 7 additions & 3 deletions ray-operator/controllers/ray/rayjob_controller_suspended_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
"time"

"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"

"github.com/ray-project/kuberay/ray-operator/controllers/ray/common"
Expand Down Expand Up @@ -51,7 +52,7 @@ var _ = Context("Inside the default namespace", func() {
Suspend: true,
Entrypoint: "sleep 999",
RayClusterSpec: &rayiov1alpha1.RayClusterSpec{
RayVersion: "1.12.1",
RayVersion: "2.4.0",
HeadGroupSpec: rayiov1alpha1.HeadGroupSpec{
ServiceType: corev1.ServiceTypeClusterIP,
Replicas: pointer.Int32(1),
Expand Down Expand Up @@ -204,8 +205,11 @@ var _ = Context("Inside the default namespace", func() {
// However the actual cluster instance and underlying resources should not be created while suspend == true
Eventually(
// k8sClient client throws error if resource not found
getResourceFunc(ctx, client.ObjectKey{Name: mySuspendedRayJob.Status.RayClusterName, Namespace: "default"}, mySuspendedRayCluster),
time.Second*10, time.Millisecond*500).Should(Not(BeNil()))
func() bool {
err := getResourceFunc(ctx, client.ObjectKey{Name: mySuspendedRayJob.Status.RayClusterName, Namespace: "default"}, mySuspendedRayCluster)()
return errors.IsNotFound(err)
},
time.Second*10, time.Millisecond*500).Should(BeTrue())
})

It("should unsuspend a rayjob object", func() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var _ = Describe("RayFrameworkGenerator", func() {
Expect(rayJobInfo.Entrypoint).To(Equal(rayJob.Spec.Entrypoint))
Expect(rayJobInfo.JobStatus).To(Equal(rayv1alpha1.JobStatusRunning))

_, err = rayDashboardClient.GetJobInfo(errorJobId)
_, err = rayDashboardClient.GetJobInfo(context.TODO(), errorJobId)
Expect(err).NotTo(BeNil())
Expect(err.Error()).To(ContainSubstring("GetJobInfo fail"))
Expect(err.Error()).To(ContainSubstring("Ray misbehaved"))
Expand Down
14 changes: 7 additions & 7 deletions ray-operator/pkg/client/clientset/versioned/fake/register.go

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

14 changes: 7 additions & 7 deletions ray-operator/pkg/client/clientset/versioned/scheme/register.go

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

0 comments on commit 3371dee

Please sign in to comment.