merge retry mechanism change from gorealis v1 to gorealis v2 (#21)
This commit is contained in:
parent
8db625730f
commit
d2fd7b9ba9
10 changed files with 449 additions and 206 deletions
23
helpers.go
Normal file
23
helpers.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package realis
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/aurora-scheduler/gorealis/v2/gen-go/apache/aurora"
|
||||
)
|
||||
|
||||
func (r *Client) JobExists(key aurora.JobKey) (bool, error) {
|
||||
resp, err := r.client.GetConfigSummary(context.TODO(), &key)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return resp != nil &&
|
||||
resp.GetResult_() != nil &&
|
||||
resp.GetResult_().GetConfigSummaryResult_() != nil &&
|
||||
resp.GetResult_().GetConfigSummaryResult_().GetSummary() != nil &&
|
||||
resp.GetResult_().GetConfigSummaryResult_().GetSummary().GetGroups() != nil &&
|
||||
len(resp.GetResult_().GetConfigSummaryResult_().GetSummary().GetGroups()) > 0 &&
|
||||
resp.GetResponseCode() == aurora.ResponseCode_OK,
|
||||
nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue