tengine_job 0.6.9 → 0.6.10
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +6 -5
- data/VERSION +1 -1
- data/lib/tengine/job/drivers/job_control_driver.rb +122 -9
- data/lib/tengine/job/drivers/job_execution_driver.rb +33 -2
- data/lib/tengine/job/drivers/jobnet_control_driver.rb +135 -3
- data/lib/tengine/job/drivers/schedule_driver.rb +54 -4
- data/lib/tengine/job/end.rb +1 -1
- data/lib/tengine/job/jobnet.rb +1 -0
- data/lib/tengine/job/root_jobnet_actual.rb +1 -1
- data/lib/tengine/job/root_jobnet_template.rb +6 -4
- data/spec/spec_helper.rb +2 -0
- data/spec/tengine/job/drivers/job_controll_driver_spec.rb +117 -0
- data/spec/tengine/job/drivers/job_execution_driver_spec.rb +51 -1
- data/spec/tengine/job/drivers/jobnet_control_driver_spec.rb +162 -0
- data/spec/tengine/job/drivers/schedule_driver_spec.rb +39 -0
- data/tengine_job.gemspec +3 -3
- metadata +24 -26
data/Gemfile.lock
CHANGED
@@ -61,7 +61,7 @@ GEM
|
|
61
61
|
simplecov-html (~> 0.5.3)
|
62
62
|
simplecov-html (0.5.3)
|
63
63
|
systemu (2.4.2)
|
64
|
-
tengine_core (0.5.
|
64
|
+
tengine_core (0.5.30)
|
65
65
|
activemodel (~> 3.1.0)
|
66
66
|
activesupport (~> 3.1.0)
|
67
67
|
bson (~> 1.5.2)
|
@@ -72,7 +72,7 @@ GEM
|
|
72
72
|
selectable_attr (~> 0.3.15)
|
73
73
|
tengine_event (~> 0.4.0)
|
74
74
|
tengine_support (~> 0.3.12)
|
75
|
-
tengine_event (0.4.
|
75
|
+
tengine_event (0.4.7)
|
76
76
|
activesupport (>= 3.0.0)
|
77
77
|
amqp (~> 0.8.0)
|
78
78
|
tengine_support (>= 0.3.24)
|
@@ -83,14 +83,15 @@ GEM
|
|
83
83
|
tengine_core (~> 0.5.23)
|
84
84
|
tengine_support (~> 0.3.24)
|
85
85
|
wakame-adapters-tengine (~> 0.0.0)
|
86
|
-
tengine_support (0.3.
|
86
|
+
tengine_support (0.3.25)
|
87
87
|
activesupport (>= 3.0.0)
|
88
88
|
tzinfo (0.3.31)
|
89
89
|
uuid (2.3.5)
|
90
90
|
macaddr (~> 1.0)
|
91
|
-
wakame-adapters-tengine (0.0.
|
91
|
+
wakame-adapters-tengine (0.0.1)
|
92
92
|
json
|
93
|
-
right_aws (
|
93
|
+
right_aws (= 2.1.0)
|
94
|
+
rspec
|
94
95
|
yard (0.7.5)
|
95
96
|
|
96
97
|
PLATFORMS
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.10
|
@@ -1,5 +1,16 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
|
+
[
|
4
|
+
:'start.job.job.tengine',
|
5
|
+
:'stop.job.job.tengine',
|
6
|
+
:'finished.process.job.tengine',
|
7
|
+
:'expired.job.heartbeat.tengine',
|
8
|
+
:'restart.job.job.tengine',
|
9
|
+
].each do |i|
|
10
|
+
ack_policy :after_all_handler_submit, i
|
11
|
+
end
|
12
|
+
|
13
|
+
|
3
14
|
# ジョブ制御ドライバ
|
4
15
|
driver :job_control_driver do
|
5
16
|
|
@@ -25,6 +36,26 @@ driver :job_control_driver do
|
|
25
36
|
root_jobnet.update_with_lock(&signal.callback)
|
26
37
|
end
|
27
38
|
signal.reservations.each{|r| fire(*r.fire_args)}
|
39
|
+
submit
|
40
|
+
end
|
41
|
+
|
42
|
+
on :'start.job.job.tengine.failed.tengined' do
|
43
|
+
# このイベントは壊れていたからfailedなのかもしれない。多重送信によ
|
44
|
+
# りfailedなのかもしれない。あまりへんな仮定を置かない方が良い。
|
45
|
+
e = event
|
46
|
+
f = e.properties or next
|
47
|
+
g = f["original_event"] or next
|
48
|
+
h = g["properties"] or next
|
49
|
+
i = h["root_jobnet_id"] or next
|
50
|
+
j = h["target_jobnet_id"] or next
|
51
|
+
k = h["target_job_id"] or next
|
52
|
+
l = Tengine::Job::RootJobnetActual.find(i) or next
|
53
|
+
|
54
|
+
l.update_with_lock do
|
55
|
+
m = l.find_descendant(j) || l
|
56
|
+
n = m.find_descendant(k)
|
57
|
+
n.phase_key = :stuck
|
58
|
+
end
|
28
59
|
end
|
29
60
|
|
30
61
|
on :'stop.job.job.tengine' do
|
@@ -43,6 +74,26 @@ driver :job_control_driver do
|
|
43
74
|
signal.callback.call
|
44
75
|
end
|
45
76
|
signal.reservations.each{|r| fire(*r.fire_args)}
|
77
|
+
submit
|
78
|
+
end
|
79
|
+
|
80
|
+
on :'stop.job.job.tengine.failed.tengined' do
|
81
|
+
# このイベントは壊れていたからfailedなのかもしれない。多重送信によ
|
82
|
+
# りfailedなのかもしれない。あまりへんな仮定を置かない方が良い。
|
83
|
+
e = event
|
84
|
+
f = e.properties or next
|
85
|
+
g = f["original_event"] or next
|
86
|
+
h = g["properties"] or next
|
87
|
+
i = h["root_jobnet_id"] or next
|
88
|
+
j = h["target_jobnet_id"] or next
|
89
|
+
k = h["target_job_id"] or next
|
90
|
+
l = Tengine::Job::RootJobnetActual.find(i) or next
|
91
|
+
|
92
|
+
l.update_with_lock do
|
93
|
+
m = l.find_descendant(j) || l
|
94
|
+
n = m.find_descendant(k)
|
95
|
+
n.phase_key = :stuck
|
96
|
+
end
|
46
97
|
end
|
47
98
|
|
48
99
|
on :'finished.process.job.tengine' do
|
@@ -52,9 +103,29 @@ driver :job_control_driver do
|
|
52
103
|
root_jobnet.update_with_lock do
|
53
104
|
signal.reset
|
54
105
|
job = root_jobnet.find_descendant(event[:target_job_id])
|
55
|
-
job.finish(signal)
|
106
|
+
job.finish(signal) unless job.phase_key == :stuck
|
56
107
|
end
|
57
108
|
signal.reservations.each{|r| fire(*r.fire_args)}
|
109
|
+
submit
|
110
|
+
end
|
111
|
+
|
112
|
+
on :'finished.process.job.tengine.failed.tengined' do
|
113
|
+
# このイベントは壊れていたからfailedなのかもしれない。多重送信によ
|
114
|
+
# りfailedなのかもしれない。あまりへんな仮定を置かない方が良い。
|
115
|
+
e = event
|
116
|
+
f = e.properties or next
|
117
|
+
g = f["original_event"] or next
|
118
|
+
h = g["properties"] or next
|
119
|
+
i = h["root_jobnet_id"] or next
|
120
|
+
j = h["target_jobnet_id"] or next
|
121
|
+
k = h["target_job_id"] or next
|
122
|
+
l = Tengine::Job::RootJobnetActual.find(i) or next
|
123
|
+
|
124
|
+
l.update_with_lock do
|
125
|
+
m = l.find_descendant(j) || l
|
126
|
+
n = m.find_descendant(k)
|
127
|
+
n.phase_key = :stuck
|
128
|
+
end
|
58
129
|
end
|
59
130
|
|
60
131
|
on :'expired.job.heartbeat.tengine' do
|
@@ -65,18 +136,60 @@ driver :job_control_driver do
|
|
65
136
|
end
|
66
137
|
end
|
67
138
|
end
|
139
|
+
submit
|
140
|
+
end
|
141
|
+
|
142
|
+
on :'expired.job.heartbeat.tengine.failed.tengined' do
|
143
|
+
# このイベントは壊れていたからfailedなのかもしれない。多重送信によ
|
144
|
+
# りfailedなのかもしれない。あまりへんな仮定を置かない方が良い。
|
145
|
+
e = event
|
146
|
+
f = e.properties or next
|
147
|
+
g = f["original_event"] or next
|
148
|
+
h = g["properties"] or next
|
149
|
+
i = h["root_jobnet_id"] or next
|
150
|
+
j = h["target_jobnet_id"] or next
|
151
|
+
k = h["target_job_id"] or next
|
152
|
+
l = Tengine::Job::RootJobnetActual.find(i) or next
|
153
|
+
|
154
|
+
l.update_with_lock do
|
155
|
+
m = l.find_descendant(j) || l
|
156
|
+
n = m.find_descendant(k)
|
157
|
+
n.phase_key = :stuck
|
158
|
+
end
|
68
159
|
end
|
69
160
|
|
70
161
|
on :'restart.job.job.tengine' do
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
162
|
+
begin
|
163
|
+
signal = Tengine::Job::Signal.new(event)
|
164
|
+
root_jobnet = Tengine::Job::RootJobnetActual.find(event[:root_jobnet_id])
|
165
|
+
root_jobnet.update_with_lock do
|
166
|
+
signal.reset
|
167
|
+
job = root_jobnet.find_descendant(event[:target_job_id])
|
168
|
+
job.reset(signal)
|
169
|
+
job.transmit(signal)
|
170
|
+
end
|
171
|
+
signal.reservations.each{|r| fire(*r.fire_args)}
|
172
|
+
ensure
|
173
|
+
submit
|
78
174
|
end
|
79
|
-
signal.reservations.each{|r| fire(*r.fire_args)}
|
80
175
|
end
|
81
176
|
|
177
|
+
on :'restart.job.job.tengine.failed.tengined' do
|
178
|
+
# このイベントは壊れていたからfailedなのかもしれない。多重送信によ
|
179
|
+
# りfailedなのかもしれない。あまりへんな仮定を置かない方が良い。
|
180
|
+
e = event
|
181
|
+
f = e.properties or next
|
182
|
+
g = f["original_event"] or next
|
183
|
+
h = g["properties"] or next
|
184
|
+
i = h["root_jobnet_id"] or next
|
185
|
+
j = h["target_jobnet_id"] or next
|
186
|
+
k = h["target_job_id"] or next
|
187
|
+
l = Tengine::Job::RootJobnetActual.find(i) or next
|
188
|
+
|
189
|
+
l.update_with_lock do
|
190
|
+
m = l.find_descendant(j) || l
|
191
|
+
n = m.find_descendant(k)
|
192
|
+
n.phase_key = :stuck
|
193
|
+
end
|
194
|
+
end
|
82
195
|
end
|
@@ -1,4 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
+
include Tengine::Core::SafeUpdatable
|
3
|
+
|
4
|
+
ack_policy :after_all_handler_submit, :'start.execution.job.tengine'
|
5
|
+
ack_policy :after_all_handler_submit, :'stop.execution.job.tengine'
|
2
6
|
|
3
7
|
# ジョブ起動ドライバ
|
4
8
|
driver :job_execution_driver do
|
@@ -11,8 +15,22 @@ driver :job_execution_driver do
|
|
11
15
|
signal.reset
|
12
16
|
execution.transmit(signal)
|
13
17
|
end
|
14
|
-
execution.save!
|
18
|
+
execution.safely(safemode(Tengine::Job::Execution.collection)).save!
|
15
19
|
signal.reservations.each{|r| fire(*r.fire_args)}
|
20
|
+
submit
|
21
|
+
end
|
22
|
+
|
23
|
+
on :'start.execution.job.tengine.failed.tengined' do
|
24
|
+
# このイベントは壊れていたからfailedなのかもしれない。多重送信によ
|
25
|
+
# りfailedなのかもしれない。あまりへんな仮定を置かない方が良い。
|
26
|
+
e = event
|
27
|
+
f = e.properties or next
|
28
|
+
g = f["original_event"] or next
|
29
|
+
h = g["properties"] or next
|
30
|
+
i = h["execution_id"] or next
|
31
|
+
j = Tengine::Job::Execution.find(i) or next
|
32
|
+
|
33
|
+
j.update_attributes :phase_key => :stuck
|
16
34
|
end
|
17
35
|
|
18
36
|
on :'stop.execution.job.tengine' do
|
@@ -23,8 +41,21 @@ driver :job_execution_driver do
|
|
23
41
|
signal.reset
|
24
42
|
execution.stop(signal)
|
25
43
|
end
|
26
|
-
execution.save!
|
44
|
+
execution.safely(safemode(Tengine::Job::Execution.collection)).save!
|
27
45
|
signal.reservations.each{|r| fire(*r.fire_args)}
|
46
|
+
submit
|
28
47
|
end
|
29
48
|
|
49
|
+
on :'stop.execution.job.tengine.failed.tengined' do
|
50
|
+
# このイベントは壊れていたからfailedなのかもしれない。多重送信によ
|
51
|
+
# りfailedなのかもしれない。あまりへんな仮定を置かない方が良い。
|
52
|
+
e = event
|
53
|
+
f = e.properties or next
|
54
|
+
g = f["original_event"] or next
|
55
|
+
h = g["properties"] or next
|
56
|
+
i = h["execution_id"] or next
|
57
|
+
j = Tengine::Job::Execution.find(i) or next
|
58
|
+
|
59
|
+
j.update_attributes :phase_key => :stuck
|
60
|
+
end
|
30
61
|
end
|
@@ -1,4 +1,17 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
+
include Tengine::Core::SafeUpdatable
|
3
|
+
|
4
|
+
[
|
5
|
+
:'start.jobnet.job.tengine',
|
6
|
+
:'success.job.job.tengine',
|
7
|
+
:'error.job.job.tengine',
|
8
|
+
:'success.jobnet.job.tengine',
|
9
|
+
:'error.jobnet.job.tengine',
|
10
|
+
:'stop.jobnet.job.tengine',
|
11
|
+
].each do |i|
|
12
|
+
ack_policy :after_all_handler_submit, i
|
13
|
+
end
|
14
|
+
|
2
15
|
|
3
16
|
# ジョブネット制御ドライバ
|
4
17
|
driver :jobnet_control_driver do
|
@@ -13,8 +26,26 @@ driver :jobnet_control_driver do
|
|
13
26
|
target_jobnet.activate(signal)
|
14
27
|
end
|
15
28
|
end
|
16
|
-
signal.execution.save! if event[:root_jobnet_id] == event[:target_jobnet_id]
|
29
|
+
signal.execution.safely(safemode(Tengine::Job::Execution.collection)).save! if event[:root_jobnet_id] == event[:target_jobnet_id]
|
17
30
|
signal.reservations.each{|r| fire(*r.fire_args)}
|
31
|
+
submit
|
32
|
+
end
|
33
|
+
|
34
|
+
on :'start.jobnet.job.tengine.failed.tengined' do
|
35
|
+
# このイベントは壊れていたからfailedなのかもしれない。多重送信によ
|
36
|
+
# りfailedなのかもしれない。あまりへんな仮定を置かない方が良い。
|
37
|
+
e = event
|
38
|
+
f = e.properties or next
|
39
|
+
g = f["original_event"] or next
|
40
|
+
h = g["properties"] or next
|
41
|
+
i = h["root_jobnet_id"] or next
|
42
|
+
j = h["target_jobnet_id"] or next
|
43
|
+
k = Tengine::Job::RootJobnetActual.find(i) or next
|
44
|
+
|
45
|
+
k.update_with_lock do
|
46
|
+
l = k.find_descendant(j) || k
|
47
|
+
l.phase_key = :stuck
|
48
|
+
end
|
18
49
|
end
|
19
50
|
|
20
51
|
on :'success.job.job.tengine' do
|
@@ -28,7 +59,33 @@ driver :jobnet_control_driver do
|
|
28
59
|
edge.transmit(signal)
|
29
60
|
end
|
30
61
|
end
|
62
|
+
# (*1)
|
31
63
|
signal.reservations.each{|r| fire(*r.fire_args)}
|
64
|
+
submit
|
65
|
+
end
|
66
|
+
|
67
|
+
on :'success.job.job.tengine.failed.tengined' do
|
68
|
+
# このイベントは壊れていたからfailedなのかもしれない。多重送信によ
|
69
|
+
# りfailedなのかもしれない。あまりへんな仮定を置かない方が良い。
|
70
|
+
e = event
|
71
|
+
f = e.properties or next
|
72
|
+
g = f["original_event"] or next
|
73
|
+
h = g["properties"] or next
|
74
|
+
i = h["root_jobnet_id"] or next
|
75
|
+
j = h["target_jobnet_id"] or next
|
76
|
+
k = h["target_job_id"] or next
|
77
|
+
l = Tengine::Job::RootJobnetActual.find(i) or next
|
78
|
+
|
79
|
+
# 上記(*1)のポイントでtenginedが落ちた時のことを考えると、後続のエッ
|
80
|
+
# ジはもうtransmitしているが送信すべきイベントが欠けている状態であ
|
81
|
+
# るので、この場合このジョブがおかしくなっているというよりむしろジョ
|
82
|
+
# ブネット全体がおかしくなっているというべきである。
|
83
|
+
l.update_with_lock do
|
84
|
+
m = l.find_descendant(j) || l
|
85
|
+
n = m.find_descendant(k)
|
86
|
+
o = n.parent || n
|
87
|
+
o.phase_key = :stuck
|
88
|
+
end
|
32
89
|
end
|
33
90
|
|
34
91
|
on :'error.job.job.tengine' do
|
@@ -46,6 +103,29 @@ driver :jobnet_control_driver do
|
|
46
103
|
# target_jobnet.jobnet_fail(signal)
|
47
104
|
end
|
48
105
|
signal.reservations.each{|r| fire(*r.fire_args)}
|
106
|
+
submit
|
107
|
+
end
|
108
|
+
|
109
|
+
on :'error.job.job.tengine.failed.tengined' do
|
110
|
+
# このイベントは壊れていたからfailedなのかもしれない。多重送信によ
|
111
|
+
# りfailedなのかもしれない。あまりへんな仮定を置かない方が良い。
|
112
|
+
e = event
|
113
|
+
f = e.properties or next
|
114
|
+
g = f["original_event"] or next
|
115
|
+
h = g["properties"] or next
|
116
|
+
i = h["root_jobnet_id"] or next
|
117
|
+
j = h["target_jobnet_id"] or next
|
118
|
+
k = h["target_job_id"] or next
|
119
|
+
l = Tengine::Job::RootJobnetActual.find(i) or next
|
120
|
+
|
121
|
+
# 同上で、この場合このジョブがおかしくなっているというよりむしろジョ
|
122
|
+
# ブネット全体がおかしくなっているというべきである。
|
123
|
+
l.update_with_lock do
|
124
|
+
m = l.find_descendant(j) || l
|
125
|
+
n = m.find_descendant(k)
|
126
|
+
o = n.parent || n
|
127
|
+
o.phase_key = :stuck
|
128
|
+
end
|
49
129
|
end
|
50
130
|
|
51
131
|
on :'success.jobnet.job.tengine' do
|
@@ -71,8 +151,26 @@ driver :jobnet_control_driver do
|
|
71
151
|
end
|
72
152
|
end
|
73
153
|
end
|
74
|
-
signal.execution.save! if event[:root_jobnet_id] == event[:target_jobnet_id]
|
154
|
+
signal.execution.safely(safemode(Tengine::Job::Execution.collection)).save! if event[:root_jobnet_id] == event[:target_jobnet_id]
|
75
155
|
signal.reservations.each{|r| fire(*r.fire_args)}
|
156
|
+
submit
|
157
|
+
end
|
158
|
+
|
159
|
+
on :'success.jobnet.job.tengine.failed.tengined' do
|
160
|
+
# このイベントは壊れていたからfailedなのかもしれない。多重送信によ
|
161
|
+
# りfailedなのかもしれない。あまりへんな仮定を置かない方が良い。
|
162
|
+
e = event
|
163
|
+
f = e.properties or next
|
164
|
+
g = f["original_event"] or next
|
165
|
+
h = g["properties"] or next
|
166
|
+
i = h["root_jobnet_id"] or next
|
167
|
+
j = h["target_jobnet_id"] or next
|
168
|
+
k = Tengine::Job::RootJobnetActual.find(i) or next
|
169
|
+
|
170
|
+
k.update_with_lock do
|
171
|
+
l = k.find_descendant(j) || k
|
172
|
+
l.phase_key = :stuck
|
173
|
+
end
|
76
174
|
end
|
77
175
|
|
78
176
|
on :'error.jobnet.job.tengine' do
|
@@ -98,10 +196,27 @@ driver :jobnet_control_driver do
|
|
98
196
|
# target_parent.end_vertex.transmit(signal)
|
99
197
|
# end
|
100
198
|
end
|
101
|
-
signal.execution.save! if event[:root_jobnet_id] == event[:target_jobnet_id]
|
199
|
+
signal.execution.safely(safemode(Tengine::Job::Execution.collection)).save! if event[:root_jobnet_id] == event[:target_jobnet_id]
|
102
200
|
signal.reservations.each{|r| fire(*r.fire_args)}
|
201
|
+
submit
|
103
202
|
end
|
104
203
|
|
204
|
+
on :'error.jobnet.job.tengine.failed.tengined' do
|
205
|
+
# このイベントは壊れていたからfailedなのかもしれない。多重送信によ
|
206
|
+
# りfailedなのかもしれない。あまりへんな仮定を置かない方が良い。
|
207
|
+
e = event
|
208
|
+
f = e.properties or next
|
209
|
+
g = f["original_event"] or next
|
210
|
+
h = g["properties"] or next
|
211
|
+
i = h["root_jobnet_id"] or next
|
212
|
+
j = h["target_jobnet_id"] or next
|
213
|
+
k = Tengine::Job::RootJobnetActual.find(i) or next
|
214
|
+
|
215
|
+
k.update_with_lock do
|
216
|
+
l = k.find_descendant(j) || k
|
217
|
+
l.phase_key = :stuck
|
218
|
+
end
|
219
|
+
end
|
105
220
|
|
106
221
|
on :'stop.jobnet.job.tengine' do
|
107
222
|
signal = Tengine::Job::Signal.new(event)
|
@@ -112,6 +227,23 @@ driver :jobnet_control_driver do
|
|
112
227
|
target_jobnet.stop(signal)
|
113
228
|
end
|
114
229
|
signal.reservations.each{|r| fire(*r.fire_args) }
|
230
|
+
submit
|
115
231
|
end
|
116
232
|
|
233
|
+
on :'stop.jobnet.job.tengine.failed.tengined' do
|
234
|
+
# このイベントは壊れていたからfailedなのかもしれない。多重送信によ
|
235
|
+
# りfailedなのかもしれない。あまりへんな仮定を置かない方が良い。
|
236
|
+
e = event
|
237
|
+
f = e.properties or next
|
238
|
+
g = f["original_event"] or next
|
239
|
+
h = g["properties"] or next
|
240
|
+
i = h["root_jobnet_id"] or next
|
241
|
+
j = h["target_jobnet_id"] or next
|
242
|
+
k = Tengine::Job::RootJobnetActual.find(i) or next
|
243
|
+
|
244
|
+
k.update_with_lock do
|
245
|
+
l = k.find_descendant(j) || k
|
246
|
+
l.phase_key = :stuck
|
247
|
+
end
|
248
|
+
end
|
117
249
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
+
include Tengine::Core::SafeUpdatable
|
2
3
|
|
3
4
|
# スケジュール管理ドライバ
|
4
5
|
driver :schedule_driver do
|
@@ -9,22 +10,71 @@ driver :schedule_driver do
|
|
9
10
|
status = Tengine::Core::Schedule::SCHEDULED
|
10
11
|
if exec.actual_base_timeout_alert && !exec.actual_base_timeout_alert.zero?
|
11
12
|
t1 = Time.now + (exec.actual_base_timeout_alert * 60.0)
|
12
|
-
Tengine::Core::Schedule.
|
13
|
+
Tengine::Core::Schedule.safely(
|
14
|
+
safemode(Tengine::Core::Schedule.collection)
|
15
|
+
).create(
|
16
|
+
event_type_name: "alert.execution.job.tengine", scheduled_at: t1, source_name: name, status: status , properties: event.properties
|
17
|
+
)
|
13
18
|
end
|
14
19
|
if exec.actual_base_timeout_termination && !exec.actual_base_timeout_termination.zero?
|
15
20
|
t2 = Time.now + (exec.actual_base_timeout_termination * 60.0)
|
16
|
-
Tengine::Core::Schedule.
|
21
|
+
Tengine::Core::Schedule.safely(
|
22
|
+
safemode(Tengine::Core::Schedule.collection)
|
23
|
+
).create(
|
24
|
+
event_type_name: "stop.execution.job.tengine", scheduled_at: t2, source_name: name, status: status, properties: event.properties.merge(stop_reason: 'timeout')
|
25
|
+
)
|
17
26
|
end
|
27
|
+
submit
|
28
|
+
end
|
29
|
+
|
30
|
+
on :'start.execution.job.tengine.failed.tengined' do
|
31
|
+
e = event
|
32
|
+
f = e.properties or next
|
33
|
+
g = f["original_event"] or next
|
34
|
+
h = g["properties"] or next
|
35
|
+
i = h["execution_id"] or next
|
36
|
+
|
37
|
+
orig = Tengine::Core::EventWrapper.new(Tengine::Core::Event.new(g)) # this object shall noe be persisted
|
38
|
+
exec = Tengine::Job::Signal.new(orig).execution
|
39
|
+
name = exec.name_as_resource
|
40
|
+
status = Tengine::Core::Schedule::SCHEDULED
|
41
|
+
if exec.actual_base_timeout_alert && !exec.actual_base_timeout_alert.zero? && Tengine::Core::Schedule.where(event_type_name: "alert.execution.job.tengine", source_name: name).count.zero?
|
42
|
+
t1 = Time.now + (exec.actual_base_timeout_alert * 60.0)
|
43
|
+
Tengine::Core::Schedule.safely(
|
44
|
+
safemode(Tengine::Core::Schedule.collection)
|
45
|
+
).create(
|
46
|
+
event_type_name: "alert.execution.job.tengine", scheduled_at: t1, source_name: name, status: status , properties: orig.properties
|
47
|
+
)
|
48
|
+
end
|
49
|
+
if exec.actual_base_timeout_termination && !exec.actual_base_timeout_termination.zero? && Tengine::Core::Schedule.where(event_type_name: "stop.execution.job.tengine", source_name: name).count.zero?
|
50
|
+
t2 = Time.now + (exec.actual_base_timeout_termination * 60.0)
|
51
|
+
Tengine::Core::Schedule.safely(
|
52
|
+
safemode(Tengine::Core::Schedule.collection)
|
53
|
+
).create(
|
54
|
+
event_type_name: "stop.execution.job.tengine", scheduled_at: t2, source_name: name, status: status, properties: orig.properties.merge(stop_reason: 'timeout')
|
55
|
+
)
|
56
|
+
end
|
57
|
+
submit
|
18
58
|
end
|
19
59
|
|
20
60
|
on :'success.execution.job.tengine' do
|
21
61
|
name = Tengine::Job::Signal.new(event).execution.name_as_resource
|
22
|
-
Tengine::Core::Schedule.
|
62
|
+
Tengine::Core::Schedule.safely(
|
63
|
+
safemode(Tengine::Core::Schedule.collection)
|
64
|
+
).where(
|
65
|
+
source_name: name, status: Tengine::Core::Schedule::SCHEDULED
|
66
|
+
).update_all(status: Tengine::Core::Schedule::INVALID)
|
67
|
+
submit
|
23
68
|
end
|
24
69
|
|
25
70
|
on :'error.execution.job.tengine' do
|
26
71
|
name = Tengine::Job::Signal.new(event).execution.name_as_resource
|
27
|
-
Tengine::Core::Schedule.
|
72
|
+
Tengine::Core::Schedule.safely(
|
73
|
+
safemode(Tengine::Core::Schedule.collection)
|
74
|
+
).where(
|
75
|
+
source_name: name, status: Tengine::Core::Schedule::SCHEDULED
|
76
|
+
).update_all(status: Tengine::Core::Schedule::INVALID)
|
77
|
+
submit
|
28
78
|
end
|
29
79
|
|
30
80
|
end
|
data/lib/tengine/job/end.rb
CHANGED
data/lib/tengine/job/jobnet.rb
CHANGED
@@ -8,6 +8,7 @@ require 'selectable_attr'
|
|
8
8
|
class Tengine::Job::Jobnet < Tengine::Job::Job
|
9
9
|
include Tengine::Core::SelectableAttr
|
10
10
|
include Tengine::Job::ElementSelectorNotation
|
11
|
+
include Tengine::Core::SafeUpdatable
|
11
12
|
|
12
13
|
autoload :Builder, "tengine/job/jobnet/builder"
|
13
14
|
autoload :StateTransition, 'tengine/job/jobnet/state_transition'
|
@@ -18,7 +18,7 @@ class Tengine::Job::RootJobnetActual < Tengine::Job::JobnetActual
|
|
18
18
|
result = Tengine::Job::Execution.new(options)
|
19
19
|
result.target_actual_ids ||= []
|
20
20
|
result.target_actual_ids += args.flatten
|
21
|
-
result.save!
|
21
|
+
result.safely(safemode(Tengine::Job::Execution.collection)).save!
|
22
22
|
sender.wait_for_connection do
|
23
23
|
sender.fire(:'start.execution.job.tengine', :properties => {
|
24
24
|
:execution_id => result.id.to_s
|
@@ -22,10 +22,12 @@ class Tengine::Job::RootJobnetTemplate < Tengine::Job::JobnetTemplate
|
|
22
22
|
def execute(options = {})
|
23
23
|
event_sender = options.delete(:sender) || Tengine::Event.default_sender
|
24
24
|
actual = generate
|
25
|
-
actual.save!
|
26
|
-
result = Tengine::Job::Execution.
|
27
|
-
|
28
|
-
|
25
|
+
actual.safely(safemode(actual.class.collection)).save!
|
26
|
+
result = Tengine::Job::Execution.safely(
|
27
|
+
safemode(Tengine::Job::Execution.collection)
|
28
|
+
).create!(
|
29
|
+
(options || {}).update(:root_jobnet_id => actual.id)
|
30
|
+
)
|
29
31
|
event_sender.fire(:"start.execution.job.tengine", :properties => {
|
30
32
|
:execution_id => result.id,
|
31
33
|
:root_jobnet_id => actual.id,
|
data/spec/spec_helper.rb
CHANGED
@@ -42,6 +42,8 @@ Tengine::Core.stderr_logger = Tengine.logger
|
|
42
42
|
|
43
43
|
Tengine::Core::Kernel.event_exception_reporter = :raise_all
|
44
44
|
|
45
|
+
Tengine::Core::Config::Core::Tengined.default_cache_drivers = true
|
46
|
+
|
45
47
|
RSpec.configure do |config|
|
46
48
|
config.include Factory::Syntax::Methods
|
47
49
|
|
@@ -227,6 +227,27 @@ describe 'job_control_driver' do
|
|
227
227
|
end
|
228
228
|
end
|
229
229
|
|
230
|
+
it "stuckからのfinished.process.job.tengine" do
|
231
|
+
@jobnet.reload
|
232
|
+
j11 = @jobnet.find_descendant_by_name_path("/rjn0001/j11")
|
233
|
+
j11.phase_key = :stuck
|
234
|
+
j11.previous_edges.first.phase_key = :transmitted
|
235
|
+
@ctx[:root].save!
|
236
|
+
tengine.receive(:"finished.process.job.tengine",
|
237
|
+
:properties => {
|
238
|
+
:execution_id => @execution.id.to_s,
|
239
|
+
:root_jobnet_id => @jobnet.id.to_s,
|
240
|
+
:root_jobnet_name_path => @jobnet.name_path,
|
241
|
+
:target_jobnet_id => @jobnet.id.to_s,
|
242
|
+
:target_jobnet_name_path => @jobnet.name_path,
|
243
|
+
:target_job_id => @ctx[:j11].id.to_s,
|
244
|
+
:target_job_name_path => @ctx[:j11].name_path,
|
245
|
+
:exit_status => 0
|
246
|
+
})
|
247
|
+
@jobnet.reload
|
248
|
+
@ctx.vertex(:j11).phase_key.should == :stuck
|
249
|
+
end
|
250
|
+
|
230
251
|
it "強制停止" do
|
231
252
|
@pid = "123"
|
232
253
|
@jobnet.reload
|
@@ -620,4 +641,100 @@ describe 'job_control_driver' do
|
|
620
641
|
end
|
621
642
|
end
|
622
643
|
|
644
|
+
context "start.job.job.tengine.failed.tengined" do
|
645
|
+
it "stuckにする" do
|
646
|
+
Tengine::Core::Schedule.delete_all
|
647
|
+
Tengine::Job::Vertex.delete_all
|
648
|
+
builder = Rjn0001SimpleJobnetBuilder.new
|
649
|
+
@root = builder.create_actual
|
650
|
+
@ctx = builder.context
|
651
|
+
@execution = Tengine::Job::Execution.create!({
|
652
|
+
:root_jobnet_id => @root.id,
|
653
|
+
})
|
654
|
+
@root.phase_key = :initialized
|
655
|
+
@root.save!
|
656
|
+
EM.run_block do
|
657
|
+
tengine.receive("start.job.job.tengine.failed.tengined", :properties => {
|
658
|
+
:original_event => {
|
659
|
+
:event_type_name => "start.job.job.tengine",
|
660
|
+
:properties => {
|
661
|
+
:execution_id => @execution.id.to_s,
|
662
|
+
:root_jobnet_id => @root.id.to_s,
|
663
|
+
:root_jobnet_name_path => @root.name_path,
|
664
|
+
:target_jobnet_id => @root.id.to_s,
|
665
|
+
:target_jobnet_name_path => @root.name_path,
|
666
|
+
:target_job_id => @root.children[1].id.to_s,
|
667
|
+
}}})
|
668
|
+
end
|
669
|
+
@root.reload
|
670
|
+
@root.children[1].phase_key.should == :stuck
|
671
|
+
@root.phase_key.should_not == :stuck # initialized
|
672
|
+
end
|
673
|
+
|
674
|
+
it "broken event" do
|
675
|
+
Tengine::Core::Schedule.delete_all
|
676
|
+
Tengine::Job::Vertex.delete_all
|
677
|
+
builder = Rjn0001SimpleJobnetBuilder.new
|
678
|
+
@root = builder.create_actual
|
679
|
+
@ctx = builder.context
|
680
|
+
@execution = Tengine::Job::Execution.create!({
|
681
|
+
:root_jobnet_id => @root.id,
|
682
|
+
})
|
683
|
+
@root.phase_key = :initialized
|
684
|
+
@root.save!
|
685
|
+
EM.run_block do
|
686
|
+
tengine.receive("start.job.job.tengine.failed.tengined", :properties => {
|
687
|
+
:original_event => {
|
688
|
+
:event_type_name => "start.job.job.tengine",
|
689
|
+
:properties => {
|
690
|
+
:execution_id => @execution.id.to_s,
|
691
|
+
:root_jobnet_id => @root.id.to_s,
|
692
|
+
:root_jobnet_name_path => @root.name_path,
|
693
|
+
:target_jobnet_id => @root.id.to_s,
|
694
|
+
:target_jobnet_name_path => @root.name_path,
|
695
|
+
}}})
|
696
|
+
end
|
697
|
+
@root.reload
|
698
|
+
@root.children[1].phase_key.should == :initialized
|
699
|
+
@root.phase_key.should_not == :stuck # initialized
|
700
|
+
end
|
701
|
+
end
|
702
|
+
|
703
|
+
%w[
|
704
|
+
stop.job.job.tengine.failed.tengined
|
705
|
+
finished.process.job.tengine.failed.tengined
|
706
|
+
expired.job.heartbeat.tengine.failed.tengined
|
707
|
+
restart.job.job.tengine.failed.tengined
|
708
|
+
].each do |i|
|
709
|
+
describe i do
|
710
|
+
it "stuckにする" do
|
711
|
+
Tengine::Core::Schedule.delete_all
|
712
|
+
Tengine::Job::Vertex.delete_all
|
713
|
+
builder = Rjn0001SimpleJobnetBuilder.new
|
714
|
+
@root = builder.create_actual
|
715
|
+
@ctx = builder.context
|
716
|
+
@execution = Tengine::Job::Execution.create!({
|
717
|
+
:root_jobnet_id => @root.id,
|
718
|
+
})
|
719
|
+
@root.phase_key = :running
|
720
|
+
@root.save!
|
721
|
+
EM.run_block do
|
722
|
+
tengine.receive(i, :properties => {
|
723
|
+
:original_event => {
|
724
|
+
:event_type_name => "start.job.job.tengine",
|
725
|
+
:properties => {
|
726
|
+
:execution_id => @execution.id.to_s,
|
727
|
+
:root_jobnet_id => @root.id.to_s,
|
728
|
+
:root_jobnet_name_path => @root.name_path,
|
729
|
+
:target_jobnet_id => @root.id.to_s,
|
730
|
+
:target_jobnet_name_path => @root.name_path,
|
731
|
+
:target_job_id => @root.children[1].id.to_s,
|
732
|
+
}}})
|
733
|
+
end
|
734
|
+
@root.reload
|
735
|
+
@root.children[1].phase_key.should == :stuck
|
736
|
+
@root.phase_key.should_not == :stuck # running
|
737
|
+
end
|
738
|
+
end
|
739
|
+
end
|
623
740
|
end
|
@@ -48,6 +48,38 @@ describe 'job_execution_driver' do
|
|
48
48
|
@root.phase_key.should == :ready
|
49
49
|
end
|
50
50
|
|
51
|
+
it "start.execution.job.tengine.failed.tengined, double save" do
|
52
|
+
@execution.phase_key = :initialized
|
53
|
+
@execution.save!
|
54
|
+
@root.phase_key = :initialized
|
55
|
+
@root.save!
|
56
|
+
tengine.receive("start.execution.job.tengine.failed.tengined", :properties => {
|
57
|
+
:original_event => {
|
58
|
+
:event_type_name => "start.execution.job.tengine",
|
59
|
+
:properties => {
|
60
|
+
:execution_id => @execution.id.to_s,
|
61
|
+
:root_jobnet_id => @root.id.to_s,
|
62
|
+
:root_jobnet_name_path => @root.name_path,
|
63
|
+
:target_jobnet_id => @root.id.to_s,
|
64
|
+
:target_jobnet_name_path => @root.name_path,
|
65
|
+
}}})
|
66
|
+
@execution.reload
|
67
|
+
@execution.phase_key.should == :stuck
|
68
|
+
end
|
69
|
+
|
70
|
+
it "start.execution.job.tengine.failed.tengined, broken event" do
|
71
|
+
@execution.phase_key = :initialized
|
72
|
+
@execution.save!
|
73
|
+
@root.phase_key = :initialized
|
74
|
+
@root.save!
|
75
|
+
tengine.receive("start.execution.job.tengine.failed.tengined", :properties => {
|
76
|
+
:original_event => {
|
77
|
+
:event_type_name => "start.execution.job.tengine",
|
78
|
+
:properties => {}}})
|
79
|
+
@execution.reload
|
80
|
+
@execution.phase_key.should_not == :stuck
|
81
|
+
end
|
82
|
+
|
51
83
|
%w[user_stop timeout].each do |stop_reason|
|
52
84
|
context stop_reason do
|
53
85
|
it "強制停止イベントを受け取ったら" do
|
@@ -83,6 +115,24 @@ describe 'job_execution_driver' do
|
|
83
115
|
end
|
84
116
|
end
|
85
117
|
# jobnet_control_driverでexecution起動後の処理を行っています
|
86
|
-
end
|
87
118
|
|
119
|
+
it "stop.execution.job.tengine.failed.tengined" do
|
120
|
+
@execution.phase_key = :running
|
121
|
+
@execution.save!
|
122
|
+
@root.phase_key = :running
|
123
|
+
@root.save!
|
124
|
+
tengine.receive("stop.execution.job.tengine.failed.tengined", :properties => {
|
125
|
+
:original_event => {
|
126
|
+
:event_type_name => "STOP.execution.job.tengine",
|
127
|
+
:properties => {
|
128
|
+
:execution_id => @execution.id.to_s,
|
129
|
+
:root_jobnet_id => @root.id.to_s,
|
130
|
+
:root_jobnet_name_path => @root.name_path,
|
131
|
+
:target_jobnet_id => @root.id.to_s,
|
132
|
+
:target_jobnet_name_path => @root.name_path,
|
133
|
+
}}})
|
134
|
+
@execution.reload
|
135
|
+
@execution.phase_key.should == :stuck
|
136
|
+
end
|
137
|
+
end
|
88
138
|
end
|
@@ -177,6 +177,16 @@ describe 'job_control_driver' do
|
|
177
177
|
@root.phase_key.should == :error
|
178
178
|
@root.finished_at.utc.iso8601.should == @now.utc.iso8601
|
179
179
|
end
|
180
|
+
|
181
|
+
it "上位のジョブネットがstuckしていた場合" do
|
182
|
+
@root.phase_key = :stuck
|
183
|
+
@root.save!
|
184
|
+
tengine.receive("success.job.job.tengine", :properties => {
|
185
|
+
:target_job_id => @ctx[:j12].id.to_s
|
186
|
+
}.update(@base_props))
|
187
|
+
@root.reload
|
188
|
+
@root.phase_key.should == :stuck
|
189
|
+
end
|
180
190
|
end
|
181
191
|
|
182
192
|
end
|
@@ -443,4 +453,156 @@ describe 'job_control_driver' do
|
|
443
453
|
|
444
454
|
end
|
445
455
|
|
456
|
+
context "start.jobnet.job.tengine.failed.tengined" do
|
457
|
+
it "stuckにする" do
|
458
|
+
Tengine::Core::Schedule.delete_all
|
459
|
+
Tengine::Job::Vertex.delete_all
|
460
|
+
builder = Rjn0001SimpleJobnetBuilder.new
|
461
|
+
@root = builder.create_actual
|
462
|
+
@ctx = builder.context
|
463
|
+
@execution = Tengine::Job::Execution.create!({
|
464
|
+
:root_jobnet_id => @root.id,
|
465
|
+
})
|
466
|
+
@root.phase_key = :initialized
|
467
|
+
@root.save!
|
468
|
+
EM.run_block do
|
469
|
+
tengine.receive("start.jobnet.job.tengine.failed.tengined", :properties => {
|
470
|
+
:original_event => {
|
471
|
+
:event_type_name => "start.jobnet.job.tengine",
|
472
|
+
:properties => {
|
473
|
+
:execution_id => @execution.id.to_s,
|
474
|
+
:root_jobnet_id => @root.id.to_s,
|
475
|
+
:root_jobnet_name_path => @root.name_path,
|
476
|
+
:target_jobnet_id => @root.id.to_s,
|
477
|
+
:target_jobnet_name_path => @root.name_path,
|
478
|
+
}}})
|
479
|
+
end
|
480
|
+
@root.reload
|
481
|
+
@root.phase_key.should == :stuck
|
482
|
+
end
|
483
|
+
|
484
|
+
it "broken event" do
|
485
|
+
Tengine::Core::Schedule.delete_all
|
486
|
+
Tengine::Job::Vertex.delete_all
|
487
|
+
builder = Rjn0001SimpleJobnetBuilder.new
|
488
|
+
@root = builder.create_actual
|
489
|
+
@ctx = builder.context
|
490
|
+
@execution = Tengine::Job::Execution.create!({
|
491
|
+
:root_jobnet_id => @root.id,
|
492
|
+
})
|
493
|
+
@root.phase_key = :initialized
|
494
|
+
@root.save!
|
495
|
+
EM.run_block do
|
496
|
+
tengine.receive("start.jobnet.job.tengine.failed.tengined", :properties => {
|
497
|
+
:original_event => {
|
498
|
+
:event_type_name => "start.jobnet.job.tengine",
|
499
|
+
:properties => {
|
500
|
+
:execution_id => @execution.id.to_s,
|
501
|
+
:root_jobnet_id => @root.id.to_s,
|
502
|
+
:root_jobnet_name_path => @root.name_path,
|
503
|
+
:target_job_id => @root.id.to_s,
|
504
|
+
:target_jobnet_name_path => @root.name_path,
|
505
|
+
}}})
|
506
|
+
end
|
507
|
+
@root.reload
|
508
|
+
@root.children[1].phase_key.should == :initialized
|
509
|
+
@root.phase_key.should_not == :stuck # initialized
|
510
|
+
end
|
511
|
+
end
|
512
|
+
|
513
|
+
context "success.job.job.tengine.failed.tengined" do
|
514
|
+
it "stuckにする(ただし上位のジョブネットを)" do
|
515
|
+
Tengine::Core::Schedule.delete_all
|
516
|
+
Tengine::Job::Vertex.delete_all
|
517
|
+
builder = Rjn0001SimpleJobnetBuilder.new
|
518
|
+
@root = builder.create_actual
|
519
|
+
@ctx = builder.context
|
520
|
+
@execution = Tengine::Job::Execution.create!({
|
521
|
+
:root_jobnet_id => @root.id,
|
522
|
+
})
|
523
|
+
@root.phase_key = :initialized
|
524
|
+
@root.save!
|
525
|
+
EM.run_block do
|
526
|
+
tengine.receive("success.job.job.tengine.failed.tengined", :properties => {
|
527
|
+
:original_event => {
|
528
|
+
:event_type_name => "success.job.job.tengine",
|
529
|
+
:properties => {
|
530
|
+
:execution_id => @execution.id.to_s,
|
531
|
+
:root_jobnet_id => @root.id.to_s,
|
532
|
+
:root_jobnet_name_path => @root.name_path,
|
533
|
+
:target_jobnet_id => @root.id.to_s,
|
534
|
+
:target_jobnet_name_path => @root.name_path,
|
535
|
+
:target_job_id => @root.children[1].id.to_s,
|
536
|
+
}}})
|
537
|
+
end
|
538
|
+
@root.reload
|
539
|
+
@root.phase_key.should == :stuck
|
540
|
+
end
|
541
|
+
end
|
542
|
+
|
543
|
+
context "error.job.job.tengine.failed.tengined" do
|
544
|
+
it "stuckにする(ただし上位のジョブネットを)" do
|
545
|
+
Tengine::Core::Schedule.delete_all
|
546
|
+
Tengine::Job::Vertex.delete_all
|
547
|
+
builder = Rjn0001SimpleJobnetBuilder.new
|
548
|
+
@root = builder.create_actual
|
549
|
+
@ctx = builder.context
|
550
|
+
@execution = Tengine::Job::Execution.create!({
|
551
|
+
:root_jobnet_id => @root.id,
|
552
|
+
})
|
553
|
+
@root.phase_key = :initialized
|
554
|
+
@root.save!
|
555
|
+
EM.run_block do
|
556
|
+
tengine.receive("error.job.job.tengine.failed.tengined", :properties => {
|
557
|
+
:original_event => {
|
558
|
+
:event_type_name => "error.job.job.tengine",
|
559
|
+
:properties => {
|
560
|
+
:execution_id => @execution.id.to_s,
|
561
|
+
:root_jobnet_id => @root.id.to_s,
|
562
|
+
:root_jobnet_name_path => @root.name_path,
|
563
|
+
:target_jobnet_id => @root.id.to_s,
|
564
|
+
:target_jobnet_name_path => @root.name_path,
|
565
|
+
:target_job_id => @root.children[1].id.to_s,
|
566
|
+
}}})
|
567
|
+
end
|
568
|
+
@root.reload
|
569
|
+
@root.phase_key.should == :stuck
|
570
|
+
end
|
571
|
+
end
|
572
|
+
|
573
|
+
|
574
|
+
%w[
|
575
|
+
success.jobnet.job.tengine.failed.tengined
|
576
|
+
error.jobnet.job.tengine.failed.tengined
|
577
|
+
stop.jobnet.job.tengine.failed.tengined
|
578
|
+
].each do |i|
|
579
|
+
describe i do
|
580
|
+
it "stuckにする" do
|
581
|
+
Tengine::Core::Schedule.delete_all
|
582
|
+
Tengine::Job::Vertex.delete_all
|
583
|
+
builder = Rjn0001SimpleJobnetBuilder.new
|
584
|
+
@root = builder.create_actual
|
585
|
+
@ctx = builder.context
|
586
|
+
@execution = Tengine::Job::Execution.create!({
|
587
|
+
:root_jobnet_id => @root.id,
|
588
|
+
})
|
589
|
+
@root.phase_key = :initialized
|
590
|
+
@root.save!
|
591
|
+
EM.run_block do
|
592
|
+
tengine.receive(i, :properties => {
|
593
|
+
:original_event => {
|
594
|
+
:event_type_name => "start.jobnet.job.tengine",
|
595
|
+
:properties => {
|
596
|
+
:execution_id => @execution.id.to_s,
|
597
|
+
:root_jobnet_id => @root.id.to_s,
|
598
|
+
:root_jobnet_name_path => @root.name_path,
|
599
|
+
:target_jobnet_id => @root.id.to_s,
|
600
|
+
:target_jobnet_name_path => @root.name_path,
|
601
|
+
}}})
|
602
|
+
end
|
603
|
+
@root.reload
|
604
|
+
@root.phase_key.should == :stuck
|
605
|
+
end
|
606
|
+
end
|
607
|
+
end
|
446
608
|
end
|
@@ -99,6 +99,45 @@ describe 'schedule_driver' do
|
|
99
99
|
'stop_reason'=>'timeout'
|
100
100
|
}
|
101
101
|
end
|
102
|
+
|
103
|
+
it "tenginedクラッシュからの復帰" do
|
104
|
+
Tengine::Core::Schedule.delete_all
|
105
|
+
@execution.phase_key = :initialized
|
106
|
+
@execution.actual_base_timeout_alert = 32768
|
107
|
+
@execution.actual_base_timeout_termination = 65536
|
108
|
+
@execution.save!
|
109
|
+
@root.phase_key = :initialized
|
110
|
+
@root.save!
|
111
|
+
EM.run_block do
|
112
|
+
tengine.receive("start.execution.job.tengine.failed.tengined", :properties => {
|
113
|
+
:original_event => {
|
114
|
+
:event_type_name => "start.execution.job.tengine",
|
115
|
+
:properties => {
|
116
|
+
:execution_id => @execution.id.to_s,
|
117
|
+
:root_jobnet_id => @root.id.to_s,
|
118
|
+
:target_jobnet_id => @root.id.to_s,
|
119
|
+
}}})
|
120
|
+
end
|
121
|
+
Tengine::Core::Schedule.count(:conditions => {:status => Tengine::Core::Schedule::SCHEDULED}).should == 2
|
122
|
+
s1 = Tengine::Core::Schedule.first(:conditions => {:event_type_name => "alert.execution.job.tengine"})
|
123
|
+
s2 = Tengine::Core::Schedule.first(:conditions => {:event_type_name => "stop.execution.job.tengine"})
|
124
|
+
[s1, s2].each do |i|
|
125
|
+
i.source_name.should == @execution.name_as_resource
|
126
|
+
i.scheduled_at.should >= Time.now
|
127
|
+
end
|
128
|
+
s1.properties.should == {
|
129
|
+
'execution_id' => @execution.id.to_s,
|
130
|
+
'root_jobnet_id' => @root.id.to_s,
|
131
|
+
'target_jobnet_id' => @root.id.to_s,
|
132
|
+
}
|
133
|
+
s2.properties.should == {
|
134
|
+
'execution_id' => @execution.id.to_s,
|
135
|
+
'root_jobnet_id' => @root.id.to_s,
|
136
|
+
'target_jobnet_id' => @root.id.to_s,
|
137
|
+
'stop_reason'=>'timeout'
|
138
|
+
}
|
139
|
+
|
140
|
+
end
|
102
141
|
end
|
103
142
|
|
104
143
|
shared_examples "terminated" do
|
data/tengine_job.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "tengine_job"
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.10"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["taigou", "totty", "g-morita", "shyouhei", "akm", "guemon"]
|
12
|
-
s.date = "2012-02-
|
12
|
+
s.date = "2012-02-15"
|
13
13
|
s.description = "tengine_job provides jobnet management"
|
14
14
|
s.email = "tengine@nautilus-technologies.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -152,7 +152,7 @@ Gem::Specification.new do |s|
|
|
152
152
|
s.homepage = "http://github.com/tengine/tengine_job"
|
153
153
|
s.licenses = ["MPL2.0/LGPLv3"]
|
154
154
|
s.require_paths = ["lib"]
|
155
|
-
s.rubygems_version = "1.8.
|
155
|
+
s.rubygems_version = "1.8.15"
|
156
156
|
s.summary = "tengine_job provides jobnet management"
|
157
157
|
|
158
158
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tengine_job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,11 +14,11 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2012-02-
|
17
|
+
date: 2012-02-15 00:00:00.000000000Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: tengine_support
|
21
|
-
requirement: &
|
21
|
+
requirement: &70277087175160 !ruby/object:Gem::Requirement
|
22
22
|
none: false
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
@@ -26,10 +26,10 @@ dependencies:
|
|
26
26
|
version: 0.3.12
|
27
27
|
type: :runtime
|
28
28
|
prerelease: false
|
29
|
-
version_requirements: *
|
29
|
+
version_requirements: *70277087175160
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: tengine_core
|
32
|
-
requirement: &
|
32
|
+
requirement: &70277087174680 !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
@@ -37,10 +37,10 @@ dependencies:
|
|
37
37
|
version: 0.5.25
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
|
-
version_requirements: *
|
40
|
+
version_requirements: *70277087174680
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: tengine_resource
|
43
|
-
requirement: &
|
43
|
+
requirement: &70277087174200 !ruby/object:Gem::Requirement
|
44
44
|
none: false
|
45
45
|
requirements:
|
46
46
|
- - ~>
|
@@ -48,10 +48,10 @@ dependencies:
|
|
48
48
|
version: 0.5.4
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
|
-
version_requirements: *
|
51
|
+
version_requirements: *70277087174200
|
52
52
|
- !ruby/object:Gem::Dependency
|
53
53
|
name: rspec
|
54
|
-
requirement: &
|
54
|
+
requirement: &70277087173700 !ruby/object:Gem::Requirement
|
55
55
|
none: false
|
56
56
|
requirements:
|
57
57
|
- - ~>
|
@@ -59,10 +59,10 @@ dependencies:
|
|
59
59
|
version: 2.6.0
|
60
60
|
type: :development
|
61
61
|
prerelease: false
|
62
|
-
version_requirements: *
|
62
|
+
version_requirements: *70277087173700
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
64
|
name: factory_girl
|
65
|
-
requirement: &
|
65
|
+
requirement: &70277087173200 !ruby/object:Gem::Requirement
|
66
66
|
none: false
|
67
67
|
requirements:
|
68
68
|
- - ~>
|
@@ -70,10 +70,10 @@ dependencies:
|
|
70
70
|
version: 2.1.2
|
71
71
|
type: :development
|
72
72
|
prerelease: false
|
73
|
-
version_requirements: *
|
73
|
+
version_requirements: *70277087173200
|
74
74
|
- !ruby/object:Gem::Dependency
|
75
75
|
name: yard
|
76
|
-
requirement: &
|
76
|
+
requirement: &70277087172720 !ruby/object:Gem::Requirement
|
77
77
|
none: false
|
78
78
|
requirements:
|
79
79
|
- - ~>
|
@@ -81,10 +81,10 @@ dependencies:
|
|
81
81
|
version: 0.7.2
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
|
-
version_requirements: *
|
84
|
+
version_requirements: *70277087172720
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: bundler
|
87
|
-
requirement: &
|
87
|
+
requirement: &70277087172240 !ruby/object:Gem::Requirement
|
88
88
|
none: false
|
89
89
|
requirements:
|
90
90
|
- - ~>
|
@@ -92,10 +92,10 @@ dependencies:
|
|
92
92
|
version: 1.0.18
|
93
93
|
type: :development
|
94
94
|
prerelease: false
|
95
|
-
version_requirements: *
|
95
|
+
version_requirements: *70277087172240
|
96
96
|
- !ruby/object:Gem::Dependency
|
97
97
|
name: jeweler
|
98
|
-
requirement: &
|
98
|
+
requirement: &70277087171740 !ruby/object:Gem::Requirement
|
99
99
|
none: false
|
100
100
|
requirements:
|
101
101
|
- - ~>
|
@@ -103,10 +103,10 @@ dependencies:
|
|
103
103
|
version: 1.6.4
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
|
-
version_requirements: *
|
106
|
+
version_requirements: *70277087171740
|
107
107
|
- !ruby/object:Gem::Dependency
|
108
108
|
name: simplecov
|
109
|
-
requirement: &
|
109
|
+
requirement: &70277087171260 !ruby/object:Gem::Requirement
|
110
110
|
none: false
|
111
111
|
requirements:
|
112
112
|
- - ~>
|
@@ -114,10 +114,10 @@ dependencies:
|
|
114
114
|
version: 0.5.3
|
115
115
|
type: :development
|
116
116
|
prerelease: false
|
117
|
-
version_requirements: *
|
117
|
+
version_requirements: *70277087171260
|
118
118
|
- !ruby/object:Gem::Dependency
|
119
119
|
name: ZenTest
|
120
|
-
requirement: &
|
120
|
+
requirement: &70277087170780 !ruby/object:Gem::Requirement
|
121
121
|
none: false
|
122
122
|
requirements:
|
123
123
|
- - ~>
|
@@ -125,7 +125,7 @@ dependencies:
|
|
125
125
|
version: 4.6.2
|
126
126
|
type: :development
|
127
127
|
prerelease: false
|
128
|
-
version_requirements: *
|
128
|
+
version_requirements: *70277087170780
|
129
129
|
description: tengine_job provides jobnet management
|
130
130
|
email: tengine@nautilus-technologies.com
|
131
131
|
executables: []
|
@@ -278,9 +278,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
278
278
|
- - ! '>='
|
279
279
|
- !ruby/object:Gem::Version
|
280
280
|
version: '0'
|
281
|
-
segments:
|
282
|
-
- 0
|
283
|
-
hash: 2171567257402705046
|
284
281
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
285
282
|
none: false
|
286
283
|
requirements:
|
@@ -289,8 +286,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
289
286
|
version: '0'
|
290
287
|
requirements: []
|
291
288
|
rubyforge_project:
|
292
|
-
rubygems_version: 1.8.
|
289
|
+
rubygems_version: 1.8.16
|
293
290
|
signing_key:
|
294
291
|
specification_version: 3
|
295
292
|
summary: tengine_job provides jobnet management
|
296
293
|
test_files: []
|
294
|
+
has_rdoc:
|