Simplify verification for create job
This commit is contained in:
parent
e3518ec407
commit
c0f09ffd06
1 changed files with 8 additions and 12 deletions
20
realis.go
20
realis.go
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue