Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RayJob][Status][5/n] Refactor getOrCreateK8sJob #1750

Merged
merged 4 commits into from
Dec 15, 2023

Conversation

kevin85421
Copy link
Member

Why are these changes needed?

Related issue number

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(


// Check the status of the k8s job and update the RayJobInstance status accordingly.
// Get the k8s job
k8sJob := &batchv1.Job{}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to Get the K8s Job again because getOrCreateK8sJob has already performed this check.

return ctrl.Result{RequeueAfter: RayJobDefaultRequeueDuration}, err
}

if wasJobCreated {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Print the messages immediately after the job is created instead.

@@ -262,17 +241,16 @@ func (r *RayJobReconciler) Reconcile(ctx context.Context, request ctrl.Request)
// the RayJob is submitted against the RayCluster created by THIS job, then
// try to gracefully stop the Ray job and delete (suspend) the cluster
if rayJobInstance.Spec.Suspend && len(rayJobInstance.Spec.ClusterSelector) == 0 {
info, err := rayDashboardClient.GetJobInfo(ctx, rayJobInstance.Status.JobId)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to have an additional GetJobInfo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

Copy link
Contributor

@architkulkarni architkulkarni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

ray-operator/controllers/ray/rayjob_controller.go Outdated Show resolved Hide resolved
Co-authored-by: Archit Kulkarni <architkulkarni@users.noreply.github.com>
Signed-off-by: Kai-Hsun Chen <kaihsun@apache.org>
@kevin85421 kevin85421 merged commit 1594e88 into ray-project:master Dec 15, 2023
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants