blob: 9a7116ff46fd564da6753ba543448b7a00d0e5f0 (
plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
package events
import (
"time"
)
const (
// EventPushOK thrown when new job has been added. JobEvent is passed as context.
EventPushOK = iota + 12000
// EventPushError caused when job can not be registered.
EventPushError
// EventJobStart thrown when new job received.
EventJobStart
// EventJobOK thrown when job execution is successfully completed. JobEvent is passed as context.
EventJobOK
// EventJobError thrown on all job related errors. See JobError as context.
EventJobError
// EventPipeRun when pipeline pipelines has been requested.
EventPipeRun
EventInitialized
// EventPipeActive when pipeline has started.
EventPipeActive
// EventPipeStopped when pipeline has been stopped.
EventPipeStopped
// EventPipeError when pipeline specific error happen.
EventPipeError
// EventDriverReady thrown when broken is ready to accept/serve tasks.
EventDriverReady
)
type J int64
func (ev J) String() string {
switch ev {
case EventPushOK:
return "EventPushOK"
case EventPushError:
return "EventPushError"
case EventJobStart:
return "EventJobStart"
case EventJobOK:
return "EventJobOK"
case EventJobError:
return "EventJobError"
case EventPipeRun:
return "EventPipeRun"
case EventInitialized:
return "EventInitialized"
case EventPipeActive:
return "EventPipeActive"
case EventPipeStopped:
return "EventPipeStopped"
case EventPipeError:
return "EventPipeError"
case EventDriverReady:
return "EventDriverReady"
}
return UnknownEventType
}
// JobEvent represent job event.
type JobEvent struct {
Event J
// String is job id.
ID string
// Pipeline name
Pipeline string
// Associated driver name (amqp, ephemeral, etc)
Driver string
// Error for the jobs/pipes errors
Error error
// event timings
Start time.Time
Elapsed time.Duration
}
|