feat: remove buntdb dep
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package managed_job
|
||||
|
||||
import (
|
||||
"flink-kube-operator/internal/crd/v1alpha1"
|
||||
"strings"
|
||||
|
||||
"gitea.com/logicamp/lc"
|
||||
@@ -8,22 +9,36 @@ import (
|
||||
)
|
||||
|
||||
func (job *ManagedJob) checkStatus() error {
|
||||
if job.state.JobId == nil {
|
||||
if job.def.Status.JobId == nil {
|
||||
lc.Logger.Debug("[managed-job] [status] no job id")
|
||||
return ErrNoJobId
|
||||
return v1alpha1.ErrNoJobId
|
||||
}
|
||||
statusResp, err := job.client.Job(*job.state.JobId)
|
||||
statusResp, err := job.client.Job(*job.def.Status.JobId)
|
||||
if err != nil {
|
||||
lc.Logger.Debug("[managed-job] [status] cannot fetch status", zap.Error(err))
|
||||
if strings.IndexAny(err.Error(), "http status not 2xx: 404") == 0 {
|
||||
job.updateState(jobState{
|
||||
JobId: job.state.JobId,
|
||||
Status: JobStatusNotFound,
|
||||
// job.updateState(jobState{
|
||||
// JobId: job.state.JobId,
|
||||
// Status: v1alpha1.JobStatusNotFound,
|
||||
// })
|
||||
job.crd.Patch(job.def.UID, map[string]interface{}{
|
||||
"status": map[string]interface{}{
|
||||
"jobId": &job.def.Status.JobId,
|
||||
"jobStatus": "",
|
||||
"lifeCycleStatus": v1alpha1.LifeCycleStatusFailed,
|
||||
"error": "Job not found",
|
||||
},
|
||||
})
|
||||
}
|
||||
return err
|
||||
}
|
||||
//lc.Logger.Debug("[managed-job] [status]", zap.Any("status-resp", statusResp))
|
||||
job.SetStatus(JobStatus(statusResp.State))
|
||||
job.crd.Patch(job.def.UID, map[string]interface{}{
|
||||
"status": map[string]interface{}{
|
||||
"jobId": &job.def.Status.JobId,
|
||||
"jobStatus": statusResp.State,
|
||||
"lifeCycleStatus": v1alpha1.LifeCycleStatusFailed,
|
||||
"error": "Job not found",
|
||||
},
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user