Simplify verification for create job

This commit is contained in:
Renán Del Valle 2021-05-03 14:18:28 -07:00
parent e3518ec407
commit c0f09ffd06
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9

View file

@ -678,23 +678,19 @@ func (r *realisClient) CreateJob(auroraJob Job) error {
func() (*aurora.Response, error) { func() (*aurora.Response, error) {
return r.client.CreateJob(context.TODO(), auroraJob.JobConfig()) return r.client.CreateJob(context.TODO(), auroraJob.JobConfig())
}, },
// Verify by checking the number of tasks in an active state // On a client timeout, attempt to verify that payload made to the Scheduler by
// match the number of instances in the original job // trying to get the config summary for the job key
func() (*aurora.Response, bool) { func() (*aurora.Response, bool) {
getTaskResp, err := r.client.GetTasksStatus( configResp, err := r.client.GetConfigSummary(context.TODO(), auroraJob.JobKey())
context.TODO(),
&aurora.TaskQuery{
JobKeys: []*aurora.JobKey{auroraJob.JobKey()},
Statuses: aurora.ACTIVE_STATES,
},
)
if err != nil { if err != nil {
return nil, false return nil, false
} }
tasks := response.ScheduleStatusResult(getTaskResp).GetTasks() if configResp == nil ||
if len(tasks) != int(auroraJob.GetInstanceCount()) { configResp.GetResult_() == nil ||
configResp.GetResult_().GetConfigSummaryResult_() == nil ||
configResp.GetResult_().GetConfigSummaryResult_().GetSummary() == nil ||
configResp.GetResponseCode() != aurora.ResponseCode_OK {
return nil, false return nil, false
} }