Skip to content

Commit

Permalink
setting jobs to pending after ray job submission
Browse files Browse the repository at this point in the history
  • Loading branch information
supraja-968 committed Aug 7, 2024
1 parent d1b83e8 commit 28c8ee9
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions gateway/utils/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,17 @@ func processRayJob(jobID uint, db *gorm.DB) error {
rayJobID := uuid.New().String()
log.Printf("Here is the UUID for the job: %v\n", rayJobID)
job.RayJobID = rayJobID
job.JobStatus = models.JobStatePending
if err := db.Save(&job).Error; err != nil {
return err
}
createInferenceEvent(job.ID, models.JobStatePending, job.RayJobID, 0, db)
if err := submitRayJobAndUpdateID(&job, db); err != nil {
return err
}
job.JobStatus = models.JobStatePending
if err := db.Save(&job).Error; err != nil {
return err
}
createInferenceEvent(job.ID, models.JobStatePending, job.RayJobID, 0, db)
}

return nil
Expand Down Expand Up @@ -504,7 +507,11 @@ func submitRayJobAndUpdateID(job *models.Job, db *gorm.DB) error {

}
fmt.Printf("Job had id %v\n", job.ID)
fmt.Printf("Finished Job with Ray id %v and status %v\n", job.RayJobID, job.JobStatus)
if job.JobType == models.JobTypeJob {
fmt.Printf("Submitted Job with Ray id %v and status %v\n", job.RayJobID, job.JobStatus)
} else {
fmt.Printf("Finished Job with Ray id %v and status %v\n", job.RayJobID, job.JobStatus)
}
err = db.Save(&job).Error
if err != nil {
return err
Expand All @@ -514,6 +521,7 @@ func submitRayJobAndUpdateID(job *models.Job, db *gorm.DB) error {

func setRayJobID(job *models.Job, rayJobID string, db *gorm.DB) error {
job.RayJobID = rayJobID
job.StartedAt = time.Now().UTC()
err := db.Save(&job).Error
if err != nil {
return err
Expand Down

0 comments on commit 28c8ee9

Please sign in to comment.