-
Notifications
You must be signed in to change notification settings - Fork 66
/
processor-root.go
52 lines (42 loc) · 1.26 KB
/
processor-root.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package agentExec
import (
"github.com/aaronchen2k/deeptest/internal/agent/exec/domain"
"github.com/aaronchen2k/deeptest/internal/agent/exec/utils/exec"
"github.com/aaronchen2k/deeptest/internal/pkg/consts"
logUtils "github.com/aaronchen2k/deeptest/pkg/lib/log"
uuid "github.com/satori/go.uuid"
"time"
)
type ProcessorRoot struct {
ID uint `json:"id" yaml:"id"`
ProcessorEntityBase
}
func (entity ProcessorRoot) Run(processor *Processor, session *Session) (err error) {
logUtils.Infof("root entity")
startTime := time.Now()
processor.Result = &agentDomain.ScenarioExecResult{
ID: int(entity.ProcessorID),
Name: session.Name,
ProcessorCategory: entity.ProcessorCategory,
ProcessorType: entity.ProcessorType,
StartTime: &startTime,
ParentId: int(entity.ParentID),
ScenarioId: processor.ScenarioId,
ProcessorId: processor.ID,
LogId: uuid.NewV4(),
//ParentLogId: ,
}
execUtils.SendExecMsg(*processor.Result, consts.Processor, session.WsMsg)
for _, child := range processor.Children {
if GetForceStopExec(session.ExecUuid) {
break
}
if child.Disable {
continue
}
child.Run(session)
}
endTime := time.Now()
processor.Result.EndTime = &endTime
return
}