feat: remove buntdb dep
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package managed_job
|
||||
|
||||
import (
|
||||
"flink-kube-operator/internal/crd/v1alpha1"
|
||||
|
||||
"gitea.com/logicamp/lc"
|
||||
api "github.com/logi-camp/go-flink-client"
|
||||
"go.uber.org/zap"
|
||||
@@ -8,16 +10,16 @@ import (
|
||||
|
||||
// restore the job from savepoint and jarId in managedJob
|
||||
func (job *ManagedJob) restore() error {
|
||||
if job.state.LastSavepointPath == nil {
|
||||
lc.Logger.Error("[managed-job] [restore]", zap.Error(ErrNoSavepointPath))
|
||||
return ErrNoSavepointPath
|
||||
if job.def.Status.LastSavepointPath == nil {
|
||||
lc.Logger.Error("[managed-job] [restore]", zap.Error(v1alpha1.ErrNoSavepointPath))
|
||||
return v1alpha1.ErrNoSavepointPath
|
||||
}
|
||||
lc.Logger.Debug("[managed-job] [restore] restoring", zap.String("savepointPath", *job.state.LastSavepointPath))
|
||||
lc.Logger.Debug("[managed-job] [restore] restoring", zap.String("savepointPath", *job.def.Status.LastSavepointPath))
|
||||
runJarResp, err := job.client.RunJar(api.RunOpts{
|
||||
JarID: job.jarId,
|
||||
AllowNonRestoredState: true,
|
||||
EntryClass: job.def.Spec.EntryClass,
|
||||
SavepointPath: *job.state.LastSavepointPath,
|
||||
SavepointPath: *job.def.Status.LastSavepointPath,
|
||||
})
|
||||
if err != nil {
|
||||
lc.Logger.Error("[managed-job] [run]", zap.Error(err))
|
||||
@@ -25,10 +27,17 @@ func (job *ManagedJob) restore() error {
|
||||
}
|
||||
lc.Logger.Debug("[main] after run jar", zap.Any("run-jar-resp", runJarResp))
|
||||
|
||||
job.state.JobId = &runJarResp.JobId
|
||||
job.state.Status = JobStatusCreating
|
||||
job.state.Error = nil
|
||||
job.updateState(*job.state)
|
||||
// job.def.Status.JobId = &runJarResp.JobId
|
||||
// job.def.Status.JobStatus = v1alpha1.JobStatusCreating
|
||||
// job.def.Status.Error = nil
|
||||
job.crd.Patch(job.def.UID, map[string]interface{}{
|
||||
"status": map[string]interface{}{
|
||||
"jobId": &runJarResp.JobId,
|
||||
"jobStatus": v1alpha1.JobStatusCreating,
|
||||
"lifeCycleStatus": v1alpha1.LifeCycleStatusRestoring,
|
||||
"error": nil,
|
||||
},
|
||||
})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user