Skip to content

Commit

Permalink
[Feature][kubectl-plugin] Quick fix for Job Submission ID (#2469)
Browse files Browse the repository at this point in the history
  • Loading branch information
chiayi authored Oct 24, 2024
1 parent 2b8693e commit c86b03b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions kubectl-plugin/pkg/cmd/job/job_submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,14 +417,11 @@ func (options *SubmitJobOptions) Run(ctx context.Context, factory cmdutil.Factor
return fmt.Errorf("Failed to get latest version of Ray Job")
}

rayJobAnnotations := options.RayJob.GetAnnotations()
if rayJobAnnotations == nil {
rayJobAnnotations = make(map[string]string)
err = unstructured.SetNestedField(options.RayJob.Object, rayJobID, "spec", "jobId")
if err != nil {
return fmt.Errorf("Error occurred while trying to set RayJob ID in RayJob Spec: %w", err)
}

rayJobAnnotations["ray.io/ray-job-submission-id"] = rayJobID
options.RayJob.SetAnnotations(rayJobAnnotations)

_, err = k8sClients.DynamicClient().Resource(util.RayJobGVR).Namespace(*options.configFlags.Namespace).Update(ctx, options.RayJob, v1.UpdateOptions{})
if err != nil {
return fmt.Errorf("Error occurred when trying to add job ID to rayJob: %w", err)
Expand Down

0 comments on commit c86b03b

Please sign in to comment.