perf: remove lc dependency

This commit is contained in:
2024-12-12 23:13:54 +03:30
parent 3912ecef44
commit d3fd04b20c
19 changed files with 182 additions and 500 deletions

View File

@@ -6,7 +6,8 @@ import (
"strings"
"time"
"gitea.com/logicamp/lc"
"flink-kube-operator/pkg"
api "github.com/logi-camp/go-flink-client"
"go.uber.org/zap"
)
@@ -14,15 +15,15 @@ import (
// restore the job from savepoint and jarId in managedJob
func (job *ManagedJob) restore() error {
if job.def.Status.LastSavepointPath == nil {
lc.Logger.Error("[managed-job] [restore]", zap.Error(v1alpha1.ErrNoSavepointPath))
pkg.Logger.Error("[managed-job] [restore]", zap.Error(v1alpha1.ErrNoSavepointPath))
return v1alpha1.ErrNoSavepointPath
}
if job.def.Status.JarId == nil {
err := errors.New("missing jar id")
lc.Logger.Error("[managed-job] [restore]", zap.Error(err))
pkg.Logger.Error("[managed-job] [restore]", zap.Error(err))
return err
}
lc.Logger.Info("[managed-job] [restore] restoring job", zap.String("name", job.def.GetName()), zap.String("savepointPath", *job.def.Status.LastSavepointPath))
pkg.Logger.Info("[managed-job] [restore] restoring job", zap.String("name", job.def.GetName()), zap.String("savepointPath", *job.def.Status.LastSavepointPath))
var jobId *string
for {
runJarResp, err := job.client.RunJar(api.RunOpts{
@@ -44,11 +45,11 @@ func (job *ManagedJob) restore() error {
}
continue
}
lc.Logger.Error("[managed-job] [restore]", zap.Error(err))
pkg.Logger.Error("[managed-job] [restore]", zap.Error(err))
return err
}
jobId = &runJarResp.JobId
lc.Logger.Debug("[main] after run jar", zap.Any("run-jar-resp", runJarResp))
pkg.Logger.Debug("[main] after run jar", zap.Any("run-jar-resp", runJarResp))
break
}