feat(managed-job): add update job method
This commit is contained in:
@@ -58,7 +58,8 @@ func (job *ManagedJob) cycle() {
|
||||
if errors.Is(err, ErrNoJobId) {
|
||||
job.state = nil
|
||||
}
|
||||
if job.state.LastSavepointDate == nil || time.Now().Add(-job.def.Spec.SavepointInterval.Duration).After(*job.state.LastSavepointDate) {
|
||||
lc.Logger.Debug("savepoint interval", zap.Any("savepoint duration", job.def.Spec.SavepointInterval))
|
||||
if (job.def.Spec.SavepointInterval.Duration != 0) && ((job.state.LastSavepointDate == nil) || time.Now().Add(-job.def.Spec.SavepointInterval.Duration).After(*job.state.LastSavepointDate)) {
|
||||
if job.state.SavepointTriggerId == nil {
|
||||
job.createSavepoint()
|
||||
} else {
|
||||
|
||||
@@ -24,3 +24,7 @@ func NewManagedJob(client *api.Client, db *buntdb.DB, def v1alpha1.FlinkJob) *Ma
|
||||
job.startCycle()
|
||||
return job
|
||||
}
|
||||
|
||||
func (job *ManagedJob) Update(def v1alpha1.FlinkJob) {
|
||||
job.def = def
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ func (job ManagedJob) createSavepoint() error {
|
||||
lc.Logger.Debug("[managed-job] [savepoint] no job id")
|
||||
return ErrNoJobId
|
||||
}
|
||||
lc.Logger.Info("[managed-job] [savepoint] creating savepoint", zap.String("interval", job.def.Spec.SavepointInterval.String()))
|
||||
resp, err := job.client.SavePoints(*job.state.JobId, "/flink-data/savepoints-2/", false)
|
||||
if err != nil {
|
||||
lc.Logger.Error("[managed-job] [savepoint] error in creating savepoint", zap.Error(err))
|
||||
|
||||
Reference in New Issue
Block a user