tengine_job 0.6.13 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -20
- data/Gemfile.lock +70 -72
- data/README.rdoc +2 -2
- data/bin/create_indexes_for_tengine_job +18 -0
- data/lib/tengine/job/connectable.rb +4 -4
- data/lib/tengine/job/drivers/job_execution_driver.rb +2 -2
- data/lib/tengine/job/drivers/jobnet_control_driver.rb +3 -3
- data/lib/tengine/job/drivers/schedule_driver.rb +12 -12
- data/lib/tengine/job/edge.rb +2 -2
- data/lib/tengine/job/expansion.rb +1 -1
- data/lib/tengine/job/jobnet.rb +12 -2
- data/lib/tengine/job/jobnet_actual.rb +29 -0
- data/lib/tengine/job/root_jobnet_actual.rb +20 -1
- data/lib/tengine/job/root_jobnet_template.rb +4 -4
- data/lib/tengine/job/signal.rb +1 -1
- data/lib/tengine/job/vertex.rb +10 -1
- metadata +130 -126
- data/.document +0 -5
- data/.rspec +0 -1
- data/Rakefile +0 -42
- data/VERSION +0 -1
- data/spec/fixtures/rjn_0001_simple_jobnet_builder.rb +0 -42
- data/spec/fixtures/rjn_0002_simple_parallel_jobnet_builder.rb +0 -42
- data/spec/fixtures/rjn_0003_fork_join_jobnet_builder.rb +0 -61
- data/spec/fixtures/rjn_0004_parallel_jobnet_with_finally_fixture.rb +0 -62
- data/spec/fixtures/rjn_0005_retry_two_layer_fixture.rb +0 -153
- data/spec/fixtures/rjn_0008_expansion_fixture.rb +0 -32
- data/spec/fixtures/rjn_0009_tree_sequential_jobnet_builder.rb +0 -174
- data/spec/fixtures/rjn_0010_2jobs_and_1job_parallel_jobnet_builder.rb +0 -39
- data/spec/fixtures/rjn_0011_nested_fork_jobnet_builder.rb +0 -96
- data/spec/fixtures/rjn_0012_nested_and_finally_builder.rb +0 -157
- data/spec/fixtures/rjn_1004_hadoop_job_in_jobnet_fixture.rb +0 -105
- data/spec/fixtures/rjn_means_root_jobnet +0 -0
- data/spec/fixtures/test_credential_fixture.rb +0 -12
- data/spec/fixtures/test_server_fixture.rb +0 -28
- data/spec/mongoid.yml +0 -35
- data/spec/spec_helper.rb +0 -58
- data/spec/sshd/.gitignore +0 -1
- data/spec/sshd/id_rsa +0 -51
- data/spec/sshd/id_rsa.pub +0 -1
- data/spec/sshd/ssh_host_rsa_key +0 -51
- data/spec/sshd/ssh_host_rsa_key.pub +0 -1
- data/spec/sshd/sshd_config +0 -10
- data/spec/sshd/sshd_config.erb +0 -11
- data/spec/sshd/tengine_job_test.sh +0 -6
- data/spec/support/jobnet_fixture_builder.rb +0 -145
- data/spec/support/mongo_index_key_log.rb +0 -91
- data/spec/tengine/job/category_spec.rb +0 -193
- data/spec/tengine/job/connectable_spec.rb +0 -94
- data/spec/tengine/job/drivers/job_controll_driver/connection_error_spec.rb +0 -236
- data/spec/tengine/job/drivers/job_controll_driver/duplicated_job_start_spec.rb +0 -302
- data/spec/tengine/job/drivers/job_controll_driver/expansion_spec.rb +0 -120
- data/spec/tengine/job/drivers/job_controll_driver/stop_spec.rb +0 -159
- data/spec/tengine/job/drivers/job_controll_driver_spec.rb +0 -740
- data/spec/tengine/job/drivers/job_execution_driver_spec.rb +0 -138
- data/spec/tengine/job/drivers/jobnet_control_driver/nested_and_finally_spec.rb +0 -472
- data/spec/tengine/job/drivers/jobnet_control_driver/nested_jobnet_spec.rb +0 -231
- data/spec/tengine/job/drivers/jobnet_control_driver/stop_jobnet_spec.rb +0 -202
- data/spec/tengine/job/drivers/jobnet_control_driver_spec.rb +0 -608
- data/spec/tengine/job/drivers/schedule_driver_spec.rb +0 -241
- data/spec/tengine/job/dsl_binder_spec.rb +0 -36
- data/spec/tengine/job/dsl_loader_spec.rb +0 -437
- data/spec/tengine/job/dsls/0013_hadoop_job_run.rb +0 -29
- data/spec/tengine/job/dsls/0014_join_and_join.rb +0 -19
- data/spec/tengine/job/dsls/0015_fork_and_fork.rb +0 -18
- data/spec/tengine/job/dsls/0016_complex_fork_and_join.rb +0 -20
- data/spec/tengine/job/dsls/0017_finally.rb +0 -15
- data/spec/tengine/job/dsls/0018_expansion.rb +0 -23
- data/spec/tengine/job/dsls/0019_execute_job_on_event.rb +0 -16
- data/spec/tengine/job/dsls/0020_duplicated_jobnet_name.rb +0 -16
- data/spec/tengine/job/dsls/0021_caption.rb +0 -13
- data/spec/tengine/job/dsls/1060_test_dir1/1060_test_dir2/0013_hadoop_job_run.rb +0 -29
- data/spec/tengine/job/dsls/2003_expansion/expansion_5.rb +0 -11
- data/spec/tengine/job/dsls/VERSION +0 -1
- data/spec/tengine/job/dynamic_env_spec.rb +0 -95
- data/spec/tengine/job/edge_spec.rb +0 -241
- data/spec/tengine/job/element_selector_notation_spec.rb +0 -354
- data/spec/tengine/job/examples_spec.rb +0 -62
- data/spec/tengine/job/execution_spec.rb +0 -100
- data/spec/tengine/job/expansion_spec.rb +0 -116
- data/spec/tengine/job/hadoop_job_run_spec.rb +0 -65
- data/spec/tengine/job/job_spec.rb +0 -4
- data/spec/tengine/job/jobnet/1015_complecated_jobnet_spec.rb +0 -72
- data/spec/tengine/job/jobnet_actual_spec.rb +0 -175
- data/spec/tengine/job/jobnet_spec.rb +0 -399
- data/spec/tengine/job/jobnet_template_spec.rb +0 -240
- data/spec/tengine/job/killing_spec.rb +0 -91
- data/spec/tengine/job/reset_spec.rb +0 -958
- data/spec/tengine/job/reset_spec/4056_1_dump.txt +0 -1
- data/spec/tengine/job/root_jobnet_actual_spec.rb +0 -89
- data/spec/tengine/job/root_jobnet_template_spec.rb +0 -248
- data/spec/tengine/job/script_executable_spec.rb +0 -132
- data/spec/tengine/job/stoppable_spec.rb +0 -176
- data/spec/tengine/job/vertex_spec.rb +0 -25
- data/spec/tengine_job_spec.rb +0 -4
- data/tengine_job.gemspec +0 -198
- data/tmp/log/.gitignore +0 -1
@@ -1,354 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe Tengine::Job::ElementSelectorNotation do
|
5
|
-
|
6
|
-
# Tengine::Job::ElementSelectorNotation は、#element, #element! を提供します。
|
7
|
-
# Tengine::Job::Jobnetにincludeされます。
|
8
|
-
# #element は指定されたnotationで対象となる要素が見つからなかった場合はnilを返しますが、
|
9
|
-
# #element! は指定されたnotationで対象となる要素が見つからなかった場合は例外をraiseします
|
10
|
-
|
11
|
-
rjn0001_notations = {
|
12
|
-
:S1 => [
|
13
|
-
"start",
|
14
|
-
"start@/rjn0001",
|
15
|
-
"start!/rjn0001",
|
16
|
-
],
|
17
|
-
:e1 => [
|
18
|
-
"prev!/rjn0001/j11",
|
19
|
-
"prev!j11@/rjn0001",
|
20
|
-
"prev!j11",
|
21
|
-
],
|
22
|
-
:j11 => [
|
23
|
-
"/rjn0001/j11",
|
24
|
-
"j11@/rjn0001",
|
25
|
-
"j11",
|
26
|
-
],
|
27
|
-
:e2 => [
|
28
|
-
"next!/rjn0001/j11",
|
29
|
-
"next!j11@/rjn0001",
|
30
|
-
"next!j11",
|
31
|
-
"prev!/rjn0001/j12",
|
32
|
-
"prev!j12@/rjn0001",
|
33
|
-
"prev!j12",
|
34
|
-
"j11~j12@/rjn0001",
|
35
|
-
"j11~j12",
|
36
|
-
],
|
37
|
-
:j12 => [
|
38
|
-
"/rjn0001/j12",
|
39
|
-
"j12@/rjn0001",
|
40
|
-
"j12",
|
41
|
-
],
|
42
|
-
:e3 => [
|
43
|
-
"next!/rjn0001/j12",
|
44
|
-
"next!j12@/rjn0001",
|
45
|
-
"next!j12",
|
46
|
-
],
|
47
|
-
:E1 => [
|
48
|
-
"end",
|
49
|
-
"end@/rjn0001",
|
50
|
-
"end!/rjn0001",
|
51
|
-
]
|
52
|
-
}
|
53
|
-
|
54
|
-
{
|
55
|
-
# in [rjn0001]
|
56
|
-
# (S1) --e1-->(j11)--e2-->(j12)--e3-->(E1)
|
57
|
-
Rjn0001SimpleJobnetBuilder => rjn0001_notations,
|
58
|
-
|
59
|
-
# in [rjn0002]
|
60
|
-
# |--e2-->(j11)--e4-->|
|
61
|
-
# (S1)--e1-->[F1] [J1]--e6-->(E1)
|
62
|
-
# |--e3-->(j12)--e5-->|
|
63
|
-
Rjn0002SimpleParallelJobnetBuilder => {
|
64
|
-
:S1 => [
|
65
|
-
"start",
|
66
|
-
"start@/rjn0002",
|
67
|
-
"start!/rjn0002",
|
68
|
-
],
|
69
|
-
:e1 => [
|
70
|
-
"next!start@/rjn0002",
|
71
|
-
"next!start",
|
72
|
-
],
|
73
|
-
:F1 => [
|
74
|
-
"fork!start~j11@/rjn0002",
|
75
|
-
"fork!start~j11",
|
76
|
-
"fork!start~j12@/rjn0002",
|
77
|
-
"fork!start~j12",
|
78
|
-
],
|
79
|
-
:e2 => [
|
80
|
-
"prev!/rjn0002/j11",
|
81
|
-
"prev!j11@/rjn0002",
|
82
|
-
"prev!j11",
|
83
|
-
],
|
84
|
-
:j11 => [
|
85
|
-
"/rjn0002/j11",
|
86
|
-
"j11@/rjn0002",
|
87
|
-
"j11",
|
88
|
-
],
|
89
|
-
|
90
|
-
:e3 => [
|
91
|
-
"prev!/rjn0002/j12",
|
92
|
-
"prev!j12@/rjn0002",
|
93
|
-
"prev!j12",
|
94
|
-
],
|
95
|
-
:j12 => [
|
96
|
-
"/rjn0002/j12",
|
97
|
-
"j12@/rjn0002",
|
98
|
-
"j12",
|
99
|
-
],
|
100
|
-
|
101
|
-
:e4 => [
|
102
|
-
"next!/rjn0002/j11",
|
103
|
-
"next!j11@/rjn0002",
|
104
|
-
"next!j11",
|
105
|
-
],
|
106
|
-
:e5 => [
|
107
|
-
"next!/rjn0002/j12",
|
108
|
-
"next!j12@/rjn0002",
|
109
|
-
"next!j12",
|
110
|
-
],
|
111
|
-
|
112
|
-
:J1 => [
|
113
|
-
"join!j11~end@/rjn0002",
|
114
|
-
"join!j11~end",
|
115
|
-
"join!j12~end@/rjn0002",
|
116
|
-
"join!j12~end",
|
117
|
-
],
|
118
|
-
:e6 => [
|
119
|
-
"prev!end@/rjn0002",
|
120
|
-
"prev!end",
|
121
|
-
],
|
122
|
-
:E1 => [
|
123
|
-
"end",
|
124
|
-
"end@/rjn0002",
|
125
|
-
"end!/rjn0002",
|
126
|
-
]
|
127
|
-
},
|
128
|
-
|
129
|
-
# in [rjn0003]
|
130
|
-
# |--e7-->(j14)--e11-->(j16)--e14--->|
|
131
|
-
# |--e2-->(j11)--e4-->(j13)--e6-->[F2] |
|
132
|
-
# (S1)--e1-->[F1] |--e8-->[J1]--e12-->(j17)--e15-->[J2]--e16-->(E2)
|
133
|
-
# | |--e9-->[J1] |
|
134
|
-
# |--e3-->(j12)------e5---------->[F3] |
|
135
|
-
# |--e10---->(j15)---e13------------>|
|
136
|
-
Rjn0003ForkJoinJobnetBuilder => {
|
137
|
-
:e6 => [
|
138
|
-
"next!/rjn0003/j13",
|
139
|
-
"next!j13@/rjn0003",
|
140
|
-
"next!j13",
|
141
|
-
],
|
142
|
-
:F2 => [
|
143
|
-
"fork!j13~j14@/rjn0003",
|
144
|
-
"fork!j13~j14",
|
145
|
-
"fork!j13~j17@/rjn0003",
|
146
|
-
"fork!j13~j17",
|
147
|
-
],
|
148
|
-
:e7 => [
|
149
|
-
"prev!/rjn0003/j14",
|
150
|
-
"prev!j14@/rjn0003",
|
151
|
-
"prev!j14",
|
152
|
-
],
|
153
|
-
:e8 => [
|
154
|
-
"fork~join!j13~j17@/rjn0003",
|
155
|
-
"fork~join!j13~j17",
|
156
|
-
],
|
157
|
-
:e9 => [
|
158
|
-
"fork~join!j12~j17@/rjn0003",
|
159
|
-
"fork~join!j12~j17",
|
160
|
-
],
|
161
|
-
:J1 => [
|
162
|
-
"join!j13~j17@/rjn0003",
|
163
|
-
"join!j13~j17",
|
164
|
-
"join!j12~j17@/rjn0003",
|
165
|
-
"join!j12~j17",
|
166
|
-
],
|
167
|
-
:e12 => [
|
168
|
-
"prev!/rjn0003/j17",
|
169
|
-
"prev!j17@/rjn0003",
|
170
|
-
"prev!j17",
|
171
|
-
],
|
172
|
-
},
|
173
|
-
|
174
|
-
# in [rjn0009]
|
175
|
-
# [S1] --e1-->[j1100]--e2-->[j1200]--e3-->[j1300]--e4-->[j1400]--e5-->[j1500]--e6-->[j1600]--e7-->[E1]
|
176
|
-
#
|
177
|
-
# [j1100]
|
178
|
-
# [S2]--e8-->(j1110)--e9-->(j1120)--e10-->[E2]
|
179
|
-
#
|
180
|
-
# [j1200]
|
181
|
-
# [S3]--e11-->(j1210)--e12-->[E3]
|
182
|
-
#
|
183
|
-
# [j1300]
|
184
|
-
# [S4]--e13-->(j1310)--e14-->[E4]
|
185
|
-
#
|
186
|
-
# [j1400]
|
187
|
-
# [S5]--e15-->(j1410)--e16-->[E5]
|
188
|
-
#
|
189
|
-
# [j1500]
|
190
|
-
# [S6]--e17-->[j1510]--e18-->[E6]
|
191
|
-
#
|
192
|
-
# [j1510]
|
193
|
-
# [S7]--e19-->(j1511)--e20-->[E7]
|
194
|
-
#
|
195
|
-
# [j1600]
|
196
|
-
# [S8]--e21-->[j1610]--e22-->[j1620]--e23-->[j1630]--e24-->[E8]
|
197
|
-
#
|
198
|
-
# [j1610]
|
199
|
-
# [S9]--e25-->(j1611)--e26-->(j1612)--e27-->[E9]
|
200
|
-
#
|
201
|
-
# [j1620]
|
202
|
-
# [S10]--e28-->(j1621)--e29-->[E10]
|
203
|
-
#
|
204
|
-
# [j1630]
|
205
|
-
# [S11]--e30-->(j1631)--e31-->[E11]
|
206
|
-
|
207
|
-
Rjn0009TreeSequentialJobnetBuilder => {
|
208
|
-
:S2 => [
|
209
|
-
"start@/rjn0009/j1100",
|
210
|
-
"start@j1100",
|
211
|
-
],
|
212
|
-
:e8 => [
|
213
|
-
"next!start@/rjn0009/j1100",
|
214
|
-
"next!start@j1100",
|
215
|
-
"start~j1110@/rjn0009/j1100",
|
216
|
-
"start~j1110@j1100",
|
217
|
-
],
|
218
|
-
:j11 => [
|
219
|
-
"/rjn0009/j1110",
|
220
|
-
"j1110@/rjn0009",
|
221
|
-
"j1110",
|
222
|
-
],
|
223
|
-
:e9 => [
|
224
|
-
"next!/rjn0009/j1100/j1110",
|
225
|
-
"next!j1110@/rjn0009/j1100",
|
226
|
-
"next!j1110@j1100",
|
227
|
-
"prev!/rjn0009/j1100/j1120",
|
228
|
-
"prev!j1120@/rjn0009/j1100",
|
229
|
-
"prev!j1120@j1100",
|
230
|
-
"j1110~j1120@/rjn0009/j1100",
|
231
|
-
"j1110~j1120@j1100",
|
232
|
-
],
|
233
|
-
:E2 => [
|
234
|
-
"end@/rjn0009/j1100",
|
235
|
-
"end@j1100",
|
236
|
-
"end!/rjn0009/j1100",
|
237
|
-
"end!j1100",
|
238
|
-
],
|
239
|
-
:E1 => [
|
240
|
-
"end",
|
241
|
-
"end@/rjn0009",
|
242
|
-
"end!/rjn0009",
|
243
|
-
],
|
244
|
-
},
|
245
|
-
|
246
|
-
# in [rjn0012]
|
247
|
-
# (S1)--e1-->[j1000]--e2-->[j2000]--e3-->(E1)
|
248
|
-
#
|
249
|
-
# in [j1000]
|
250
|
-
# (S2)--e4-->[j1100]--e5-->[j1200]--e6-->(E2)
|
251
|
-
#
|
252
|
-
# in [j1100]
|
253
|
-
# (S3)--e7-->(j1110)--e8-->(E3)
|
254
|
-
#
|
255
|
-
# in [j1200]
|
256
|
-
# (S4)--e9-->(j1210)--e10-->(E4)
|
257
|
-
#
|
258
|
-
# in [j1000:finally (=j1f00)]
|
259
|
-
# (S5)--e11-->[j1f10]--e12-->(E5)
|
260
|
-
#
|
261
|
-
# in [j1f10]
|
262
|
-
# (S6)--e13-->(j1f11)--e14-->(E6)
|
263
|
-
#
|
264
|
-
# in [j1000:finally:finally (=j1ff0)]
|
265
|
-
# (S7)--e15-->(j1ff1)--e16-->(E7)
|
266
|
-
#
|
267
|
-
# in [j2000]
|
268
|
-
# (S8)--e17-->(j2100)--e18-->(E8)
|
269
|
-
#
|
270
|
-
# in [jf000:finally (=jf000)]
|
271
|
-
# (S9)--e19-->(jf100)--e20-->(E9)
|
272
|
-
#
|
273
|
-
Rjn0012NestedAndFinallyBuilder => {
|
274
|
-
:j1f00 => [
|
275
|
-
"/rjn0012/j1000/finally",
|
276
|
-
"finally@/rjn0012/j1000",
|
277
|
-
],
|
278
|
-
:S5 => [
|
279
|
-
"start@/rjn0012/j1000/finally",
|
280
|
-
"start@j1000/finally",
|
281
|
-
"start!finally@/rjn0012/j1000",
|
282
|
-
"start!finally@j1000",
|
283
|
-
],
|
284
|
-
},
|
285
|
-
|
286
|
-
}.each do |builder_class, patterns|
|
287
|
-
|
288
|
-
context builder_class.name do
|
289
|
-
%w[actual template].each do |type|
|
290
|
-
before do
|
291
|
-
Tengine::Job::Vertex.delete_all
|
292
|
-
builder = builder_class.new
|
293
|
-
@root = builder.send(:"create_#{type}")
|
294
|
-
@ctx = builder.context
|
295
|
-
end
|
296
|
-
|
297
|
-
patterns.each do |element_key, notations|
|
298
|
-
notations.each do |notation|
|
299
|
-
it "#{notation.inspect} selects #{type} #{element_key.inspect}" do
|
300
|
-
expected = @ctx[element_key]
|
301
|
-
if expected.is_a?(Tengine::Job::Vertex)
|
302
|
-
expected_name_path = expected.name_path
|
303
|
-
actual_name_path = @root.element(notation).name_path
|
304
|
-
actual_name_path.should == expected_name_path
|
305
|
-
else
|
306
|
-
@root.element(notation).should == expected
|
307
|
-
end
|
308
|
-
end
|
309
|
-
end
|
310
|
-
end
|
311
|
-
|
312
|
-
end
|
313
|
-
end
|
314
|
-
end
|
315
|
-
|
316
|
-
|
317
|
-
# in [rjn0001]
|
318
|
-
# (S1) --e1-->(j11)--e2-->(j12)--e3-->(E1)
|
319
|
-
context "rjn0001" do
|
320
|
-
before do
|
321
|
-
Tengine::Job::Vertex.delete_all
|
322
|
-
builder = Rjn0001SimpleJobnetBuilder.new
|
323
|
-
@root = builder.create_template
|
324
|
-
@ctx = builder.context
|
325
|
-
end
|
326
|
-
|
327
|
-
[:element, :element!].each do |method_name|
|
328
|
-
rjn0001_notations.each do |element_name, notations|
|
329
|
-
notations.each do |notation|
|
330
|
-
it "#{method_name}(#{notation}) selects #{element_name}" do
|
331
|
-
@root.send(method_name, notation).should == @ctx[element_name]
|
332
|
-
end
|
333
|
-
end
|
334
|
-
end
|
335
|
-
end
|
336
|
-
|
337
|
-
context "存在しないデータを検索" do
|
338
|
-
it "elementはnilを返す" do
|
339
|
-
@root.element("unexist_element").should == nil
|
340
|
-
end
|
341
|
-
|
342
|
-
it "element!は例外をraiseする" do
|
343
|
-
begin
|
344
|
-
@root.element!("unexist_element")
|
345
|
-
fail
|
346
|
-
rescue Tengine::Errors::NotFound => e
|
347
|
-
e.message.should == "Tengine Jobnet Element not found by selector \"unexist_element\" in /rjn0001"
|
348
|
-
end
|
349
|
-
end
|
350
|
-
end
|
351
|
-
|
352
|
-
end
|
353
|
-
|
354
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe "job DSL examples" do
|
5
|
-
before(:all) do
|
6
|
-
Tengine.plugins.add(Tengine::Job)
|
7
|
-
end
|
8
|
-
|
9
|
-
def load_dsl(filename)
|
10
|
-
config = {
|
11
|
-
:action => "load",
|
12
|
-
:tengined => { :load_path => File.expand_path("../../../examples/#{filename}", File.dirname(__FILE__)) },
|
13
|
-
}
|
14
|
-
@bootstrap = Tengine::Core::Bootstrap.new(config)
|
15
|
-
@bootstrap.boot
|
16
|
-
end
|
17
|
-
|
18
|
-
example_dir = File.expand_path("../../../examples", File.dirname(__FILE__))
|
19
|
-
|
20
|
-
context "load and bind" do
|
21
|
-
Dir.glob("#{example_dir}/*.rb") do |job_dsl_path|
|
22
|
-
it "load #{job_dsl_path}" do
|
23
|
-
Tengine::Core::Driver.delete_all
|
24
|
-
Tengine::Core::HandlerPath.delete_all
|
25
|
-
Tengine::Job::Vertex.delete_all
|
26
|
-
Tengine::Job::Vertex.count.should == 0
|
27
|
-
expect {
|
28
|
-
load_dsl(File.basename(job_dsl_path))
|
29
|
-
}.to_not raise_error
|
30
|
-
Tengine::Job::Vertex.count.should_not == 0
|
31
|
-
end
|
32
|
-
|
33
|
-
it "bind #{job_dsl_path}" do
|
34
|
-
Tengine::Core::Driver.delete_all
|
35
|
-
Tengine::Core::HandlerPath.delete_all
|
36
|
-
Tengine::Job::Vertex.delete_all
|
37
|
-
load_dsl(File.basename(job_dsl_path))
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
context "<BUG>[tenginedがジョブネット定義をロードするパスとして指定したディレクトリ内に更にディレクトリが存在すると、Errorが発生してtenginedが起動できない]" do
|
44
|
-
it do
|
45
|
-
Tengine::Core::Driver.delete_all
|
46
|
-
Tengine::Core::HandlerPath.delete_all
|
47
|
-
Tengine::Job::Vertex.delete_all
|
48
|
-
Tengine::Job::Vertex.count.should == 0
|
49
|
-
expect {
|
50
|
-
dsl_dir = File.expand_path("dsls/1060_test_dir1", File.dirname(__FILE__))
|
51
|
-
config = {
|
52
|
-
:action => "load",
|
53
|
-
:tengined => { :load_path => dsl_dir },
|
54
|
-
}
|
55
|
-
@bootstrap = Tengine::Core::Bootstrap.new(config)
|
56
|
-
@bootstrap.boot
|
57
|
-
}.to_not raise_error
|
58
|
-
Tengine::Job::Vertex.count.should_not == 0
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
@@ -1,100 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'time'
|
4
|
-
|
5
|
-
describe Tengine::Job::Execution do
|
6
|
-
describe :actual_estimated_end do
|
7
|
-
context "strted_atがnilならnil" do
|
8
|
-
subject{ Tengine::Job::Execution.new(:started_at => nil, :estimated_time => 10.minutes) }
|
9
|
-
its(:actual_estimated_end) { should == nil }
|
10
|
-
end
|
11
|
-
|
12
|
-
context "strted_atが設定されていたらstarted_atに見積もり時間を足した時間" do
|
13
|
-
subject do
|
14
|
-
Tengine::Job::Execution.new(
|
15
|
-
:started_at => Time.parse("2011/10/11 01:00Z"),
|
16
|
-
:estimated_time => 10 * 60)
|
17
|
-
end
|
18
|
-
it { subject.actual_estimated_end.iso8601.should == Time.parse("2011/10/11 01:10Z").iso8601 }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
describe "reset rjn0010" do
|
25
|
-
# in [rjn0010]
|
26
|
-
# |-----e2----->(j11)-----e4----->|
|
27
|
-
# [S1]--e1-->[F1] [J1]--e7-->[E1]
|
28
|
-
# |--e3-->(j12)--e5-->(j13)--e6-->|
|
29
|
-
before do
|
30
|
-
Tengine::Job::Vertex.delete_all
|
31
|
-
builder = Rjn00102jobsAnd1jobParallelJobnetBuilder.new
|
32
|
-
@root = builder.create_actual
|
33
|
-
@ctx = builder.context
|
34
|
-
@execution = Tengine::Job::Execution.create!({
|
35
|
-
:root_jobnet_id => @root.id,
|
36
|
-
:retry => true, :spot => false,
|
37
|
-
})
|
38
|
-
@base_props = {
|
39
|
-
:execution_id => @execution.id.to_s,
|
40
|
-
:root_jobnet_id => @root.id.to_s,
|
41
|
-
:target_jobnet_id => @root.id.to_s,
|
42
|
-
}
|
43
|
-
mock_event = mock(:event)
|
44
|
-
mock_event.stub(:occurred_at).and_return{ Time.now }
|
45
|
-
mock_event.stub(:[]).with(:execution_id).and_return(@execution.id.to_s)
|
46
|
-
@signal = Tengine::Job::Signal.new(mock_event)
|
47
|
-
end
|
48
|
-
|
49
|
-
context "全て正常終了した後に" do
|
50
|
-
before do
|
51
|
-
[:root, :j11, :j12, :j13].each{|j| @ctx[j].phase_key = :success}
|
52
|
-
@root.edges.each{|edge| edge.phase_key = :transmitted }
|
53
|
-
@root.save!
|
54
|
-
@execution.stub(:root_jobnet).and_return(@root)
|
55
|
-
end
|
56
|
-
|
57
|
-
context 'target_actualでジョブを取得' do
|
58
|
-
it "値を設定している場合" do
|
59
|
-
@execution.target_actual_ids = [@ctx[:j12].id.to_s]
|
60
|
-
@execution.save!
|
61
|
-
@execution.target_actuals.map(&:id).should == [@ctx[:j12].id]
|
62
|
-
end
|
63
|
-
|
64
|
-
it '設定していない場合' do
|
65
|
-
@execution.target_actual_ids = []
|
66
|
-
@execution.save!
|
67
|
-
@execution.target_actuals.map(&:id).should == [@ctx[:root].id]
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
it "全てのedgeとvetexは初期化される" do
|
72
|
-
@execution.transmit(@signal)
|
73
|
-
@root.save!
|
74
|
-
@execution.save!
|
75
|
-
@root.reload
|
76
|
-
@execution.reload
|
77
|
-
@root.phase_key.should == :ready
|
78
|
-
[:j11, :j12, :j13].each{|j| [j, @ctx[j].phase_key].should == [j, :initialized]}
|
79
|
-
@root.edges.each{|edge| edge.phase_key.should == :active }
|
80
|
-
end
|
81
|
-
|
82
|
-
it "一部再実行の為にreset" do
|
83
|
-
@execution.target_actual_ids = [@ctx[:j12].id.to_s]
|
84
|
-
@execution.save!
|
85
|
-
@execution.transmit(@signal)
|
86
|
-
@root.save!
|
87
|
-
@execution.save!
|
88
|
-
@execution.reload
|
89
|
-
@root.reload
|
90
|
-
[:root, :j11].each{|j| @ctx[j].phase_key.should == :success}
|
91
|
-
[:j12].each{|j| @ctx[j].phase_key.should == :ready}
|
92
|
-
[:j13].each{|j| @ctx[j].phase_key.should == :initialized}
|
93
|
-
[:e1, :e2, :e3, :e4].each{|n| @ctx[n].phase_key.should == :transmitted }
|
94
|
-
[:e5, :e6, :e7].each{|n| @ctx[n].phase_key.should == :active }
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
end
|
99
|
-
|
100
|
-
end
|