1 Star 0 Fork 7

kyle / gobatch

forked from chararch / gobatch 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
execution.go 2.18 KB
一键复制 编辑 原始数据 按行查看 历史
chararch 提交于 2022-03-24 00:21 . format code & add comment
package gobatch
import (
"github.com/chararch/gobatch/status"
"time"
)
//JobExecution represents context of a job execution
type JobExecution struct {
JobExecutionId int64
JobInstanceId int64
JobName string
JobParams map[string]interface{}
JobStatus status.BatchStatus
StepExecutions []*StepExecution
JobContext *BatchContext
CreateTime time.Time
StartTime time.Time
EndTime time.Time
FailError BatchError
Version int64
}
//AddStepExecution add a step execution in this job
func (e *JobExecution) AddStepExecution(execution *StepExecution) {
e.StepExecutions = append(e.StepExecutions, execution)
}
//StepExecution represents context of a step execution
type StepExecution struct {
StepExecutionId int64
StepName string
StepStatus status.BatchStatus
StepContext *BatchContext
StepContextId int64
StepExecutionContext *BatchContext
JobExecution *JobExecution
CreateTime time.Time
StartTime time.Time
EndTime time.Time
ReadCount int64
WriteCount int64
CommitCount int64
FilterCount int64
ReadSkipCount int64
WriteSkipCount int64
ProcessSkipCount int64
RollbackCount int64
FailError BatchError
LastUpdated time.Time
Version int64
}
func (execution *StepExecution) finish(err BatchError) {
if err != nil {
execution.StepStatus = status.FAILED
execution.FailError = err
execution.EndTime = time.Now()
} else {
execution.StepStatus = status.COMPLETED
execution.EndTime = time.Now()
}
}
func (execution *StepExecution) start() {
execution.StartTime = time.Now()
execution.StepStatus = status.STARTED
}
func (execution *StepExecution) deepCopy() *StepExecution {
result := &StepExecution{
StepName: execution.StepName,
StepStatus: status.STARTING,
StepContext: execution.StepContext.DeepCopy(),
StepContextId: execution.StepContextId,
StepExecutionContext: execution.StepExecutionContext.DeepCopy(),
JobExecution: execution.JobExecution,
CreateTime: time.Now(),
}
return result
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/workface/gobatch.git
git@gitee.com:workface/gobatch.git
workface
gobatch
gobatch
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891