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,174 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
require File.expand_path('test_credential_fixture', File.dirname(__FILE__))
|
4
|
-
require File.expand_path('test_server_fixture', File.dirname(__FILE__))
|
5
|
-
|
6
|
-
# 以下のジョブネットについてテンプレートジョブネットや
|
7
|
-
# 実行用ジョブネットを扱うフィクスチャ生成のためのクラスです。
|
8
|
-
#
|
9
|
-
# in [rjn0009]
|
10
|
-
# [S1] --e1-->[j1100]--e2-->[j1200]--e3-->[j1300]--e4-->[j1400]--e5-->[j1500]--e6-->[j1600]--e7-->[E1]
|
11
|
-
#
|
12
|
-
# [j1100]
|
13
|
-
# [S2]--e8-->(j1110)--e9-->(j1120)--e10-->[E2]
|
14
|
-
#
|
15
|
-
# [j1200]
|
16
|
-
# [S3]--e11-->(j1210)--e12-->[E3]
|
17
|
-
#
|
18
|
-
# [j1300]
|
19
|
-
# [S4]--e13-->(j1310)--e14-->[E4]
|
20
|
-
#
|
21
|
-
# [j1400]
|
22
|
-
# [S5]--e15-->(j1410)--e16-->[E5]
|
23
|
-
#
|
24
|
-
# [j1500]
|
25
|
-
# [S6]--e17-->[j1510]--e18-->[E6]
|
26
|
-
#
|
27
|
-
# [j1510]
|
28
|
-
# [S7]--e19-->(j1511)--e20-->[E7]
|
29
|
-
#
|
30
|
-
# [j1600]
|
31
|
-
# [S8]--e21-->[j1610]--e22-->[j1620]--e23-->[j1630]--e24-->[E8]
|
32
|
-
#
|
33
|
-
# [j1610]
|
34
|
-
# [S9]--e25-->(j1611)--e26-->(j1612)--e27-->[E9]
|
35
|
-
#
|
36
|
-
# [j1620]
|
37
|
-
# [S10]--e28-->(j1621)--e29-->[E10]
|
38
|
-
#
|
39
|
-
# [j1630]
|
40
|
-
# [S11]--e30-->(j1631)--e31-->[E11]
|
41
|
-
class Rjn0009TreeSequentialJobnetBuilder < JobnetFixtureBuilder
|
42
|
-
include TestCredentialFixture
|
43
|
-
include TestServerFixture
|
44
|
-
|
45
|
-
DSL = <<-EOS
|
46
|
-
jobnet("rjn0009") do
|
47
|
-
jobnet("j1100", :credential_name => "test_credential1", :server_name => "test_server1") do
|
48
|
-
job("j1110", "job_test j1110")
|
49
|
-
job("j1120", "job_test j1120")
|
50
|
-
end
|
51
|
-
jobnet("j1200", :credential_name => "test_credential1") do
|
52
|
-
job("j1210", "job_test j1210", :server_name => "mysql_master")
|
53
|
-
end
|
54
|
-
jobnet("j1300", :server_name => "mysql_master") do
|
55
|
-
job("j1310", "job_test j1310", :credential_name => "test_credential1")
|
56
|
-
end
|
57
|
-
jobnet("j1400") do
|
58
|
-
job("j1410", "job_test j1410", :credential_name => "test_credential1", :server_name => "mysql_master")
|
59
|
-
end
|
60
|
-
jobnet("j1500", :credential_name => "test_credential1", :server_name => "mysql_master") do
|
61
|
-
jobnet("j1510") do
|
62
|
-
job("j1511", "job_test j1511")
|
63
|
-
end
|
64
|
-
end
|
65
|
-
jobnet("j1600", :credential_name => "test_credential1", :server_name => "mysql_master") do
|
66
|
-
jobnet("j1610") do
|
67
|
-
job("j1611", "job_test j1611", :server_name => "test_server1") # server_nameを上書き
|
68
|
-
job("j1612", "job_test j1612", :credential_name => "gohan_ssh_pk") # credential_nameを上書き
|
69
|
-
end
|
70
|
-
jobnet("j1620", :server_name => "test_server1") do # server_nameを上書き
|
71
|
-
job("j1621", "job_test j1621")
|
72
|
-
end
|
73
|
-
jobnet("j1630", :credential_name => "gohan_ssh_pk") do # credential_nameを上書き
|
74
|
-
job("j1631", "job_test j1631")
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
EOS
|
79
|
-
|
80
|
-
def create(options = {})
|
81
|
-
resource_fixture = GokuAtEc2ApNortheast.new
|
82
|
-
resource_fixture.mysql_master
|
83
|
-
|
84
|
-
root = new_root_jobnet("rjn0009", options)
|
85
|
-
root.children << new_start
|
86
|
-
root.children << new_jobnet("j1100", :credential_name => test_credential1.name, :server_name => test_server1.name)
|
87
|
-
root.children << new_jobnet("j1200", :credential_name => test_credential1.name)
|
88
|
-
root.children << new_jobnet("j1300", :server_name => "mysql_master")
|
89
|
-
root.children << new_jobnet("j1400")
|
90
|
-
root.children << new_jobnet("j1500", :credential_name => test_credential1.name, :server_name => "mysql_master")
|
91
|
-
root.children << new_jobnet("j1600", :credential_name => test_credential1.name, :server_name => "mysql_master")
|
92
|
-
root.children << new_end
|
93
|
-
root.build_sequencial_edges{|edge| remember_edge(edge)}
|
94
|
-
check_edge_count(7)
|
95
|
-
raise "edge count error: expected 7 but #{@edge_count}\n" << root.edges.map(&:inspect).join("\n ") unless @edge_count == 7
|
96
|
-
|
97
|
-
j1100 = self[:j1100]
|
98
|
-
j1100.children << new_start
|
99
|
-
j1100.children << new_script("j1110", :script => "job_test j1110")
|
100
|
-
j1100.children << new_script("j1120", :script => "job_test j1120")
|
101
|
-
j1100.children << new_end
|
102
|
-
j1100.build_sequencial_edges{|edge| remember_edge(edge)}
|
103
|
-
check_edge_count(10)
|
104
|
-
|
105
|
-
j1200 = self[:j1200]
|
106
|
-
j1200.children << new_start
|
107
|
-
j1200.children << new_script("j1210", :script => "job_test j1210", :server_name => "mysql_master")
|
108
|
-
j1200.children << new_end
|
109
|
-
j1200.build_sequencial_edges{|edge| remember_edge(edge)}
|
110
|
-
check_edge_count(12)
|
111
|
-
|
112
|
-
j1300 = self[:j1300]
|
113
|
-
j1300.children << new_start
|
114
|
-
j1300.children << new_script("j1310", :script => "job_test j1310", :credential_name => test_credential1.name)
|
115
|
-
j1300.children << new_end
|
116
|
-
j1300.build_sequencial_edges{|edge| remember_edge(edge)}
|
117
|
-
check_edge_count(14)
|
118
|
-
|
119
|
-
j1400 = self[:j1400]
|
120
|
-
j1400.children << new_start
|
121
|
-
j1400.children << new_script("j1410", :script => "job_test j1410", :server_name => "mysql_master", :credential_name => test_credential1.name)
|
122
|
-
j1400.children << new_end
|
123
|
-
j1400.build_sequencial_edges{|edge| remember_edge(edge)}
|
124
|
-
check_edge_count(16)
|
125
|
-
|
126
|
-
j1500 = self[:j1500]
|
127
|
-
j1500.children << new_start
|
128
|
-
j1500.children << new_jobnet("j1510")
|
129
|
-
j1500.children << new_end
|
130
|
-
j1500.build_sequencial_edges{|edge| remember_edge(edge)}
|
131
|
-
check_edge_count(18)
|
132
|
-
|
133
|
-
j1510 = self[:j1510]
|
134
|
-
j1510.children << new_start
|
135
|
-
j1510.children << new_script("j1511", :script => "job_test j1511")
|
136
|
-
j1510.children << new_end
|
137
|
-
j1510.build_sequencial_edges{|edge| remember_edge(edge)}
|
138
|
-
check_edge_count(20)
|
139
|
-
|
140
|
-
j1600 = self[:j1600]
|
141
|
-
j1600.children << new_start
|
142
|
-
j1600.children << new_jobnet("j1610")
|
143
|
-
j1600.children << new_jobnet("j1620", :server_name => test_server1.name)
|
144
|
-
j1600.children << new_jobnet("j1630", :credential_name => "gohan_ssh_pk")
|
145
|
-
j1600.children << new_end
|
146
|
-
j1600.build_sequencial_edges{|edge| remember_edge(edge)}
|
147
|
-
check_edge_count(24)
|
148
|
-
|
149
|
-
j1610 = self[:j1610]
|
150
|
-
j1610.children << new_start
|
151
|
-
j1610.children << new_script("j1611", :script => "job_test j1611", :server_name => test_server1.name)
|
152
|
-
j1610.children << new_script("j1612", :script => "job_test j1612", :credential_name => "gohan_ssh_pk")
|
153
|
-
j1610.children << new_end
|
154
|
-
j1610.build_sequencial_edges{|edge| remember_edge(edge)}
|
155
|
-
check_edge_count(27)
|
156
|
-
|
157
|
-
j1620 = self[:j1620]
|
158
|
-
j1620.children << new_start
|
159
|
-
j1620.children << new_script("j1621", :script => "job_test j1621")
|
160
|
-
j1620.children << new_end
|
161
|
-
j1620.build_sequencial_edges{|edge| remember_edge(edge)}
|
162
|
-
check_edge_count(29)
|
163
|
-
|
164
|
-
j1630 = self[:j1630]
|
165
|
-
j1630.children << new_start
|
166
|
-
j1630.children << new_script("j1631", :script => "job_test j1631")
|
167
|
-
j1630.children << new_end
|
168
|
-
j1630.build_sequencial_edges{|edge| remember_edge(edge)}
|
169
|
-
check_edge_count(31)
|
170
|
-
|
171
|
-
root.save!
|
172
|
-
root
|
173
|
-
end
|
174
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
# 以下のジョブネットについてテンプレートジョブネットや
|
3
|
-
# 実行用ジョブネットを扱うフィクスチャ生成のためのクラスです。
|
4
|
-
#
|
5
|
-
# in [rjn0010]
|
6
|
-
# |-----e2----->(j11)-----e4----->|
|
7
|
-
# [S1]--e1-->[F1] [J1]--e7-->[E1]
|
8
|
-
# |--e3-->(j12)--e5-->(j13)--e6-->|
|
9
|
-
|
10
|
-
class Rjn00102jobsAnd1jobParallelJobnetBuilder < JobnetFixtureBuilder
|
11
|
-
DSL = <<-EOS
|
12
|
-
jobnet("rjn0010") do
|
13
|
-
boot_jobs("j11", "j12")
|
14
|
-
job("j11", "job_test j11")
|
15
|
-
job("j12", "job_test j12", :to => "j13")
|
16
|
-
job("j13", "job_test j13")
|
17
|
-
end
|
18
|
-
EOS
|
19
|
-
|
20
|
-
def create(options = {})
|
21
|
-
root = new_root_jobnet("rjn0010")
|
22
|
-
root.children << new_start
|
23
|
-
root.children << new_fork
|
24
|
-
root.children << new_script("j11", :script => "job_test j11")
|
25
|
-
root.children << new_script("j12", :script => "job_test j12")
|
26
|
-
root.children << new_script("j13", :script => "job_test j13")
|
27
|
-
root.children << new_join
|
28
|
-
root.children << new_end
|
29
|
-
root.edges << new_edge(:S1, :F1)
|
30
|
-
root.edges << new_edge(:F1, :j11)
|
31
|
-
root.edges << new_edge(:F1, :j12)
|
32
|
-
root.edges << new_edge(:j11, :J1)
|
33
|
-
root.edges << new_edge(:j12, :j13)
|
34
|
-
root.edges << new_edge(:j13, :J1)
|
35
|
-
root.edges << new_edge(:J1, :E1)
|
36
|
-
root.save!
|
37
|
-
root
|
38
|
-
end
|
39
|
-
end
|
@@ -1,96 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
require File.expand_path('test_credential_fixture', File.dirname(__FILE__))
|
4
|
-
require File.expand_path('test_server_fixture', File.dirname(__FILE__))
|
5
|
-
|
6
|
-
# 以下のジョブネットについてテンプレートジョブネットや
|
7
|
-
# 実行用ジョブネットを扱うフィクスチャ生成のためのクラスです。
|
8
|
-
#
|
9
|
-
# in [rjn0011]
|
10
|
-
# (S1)--e1-->[j1100]--e2-->(j1200)--e3-->[j1300]--e4-->(E1)
|
11
|
-
#
|
12
|
-
# in [j1100]
|
13
|
-
# (S2)--e5-->(j1110)--e6-->[j1120]--e7-->[j1130]--e8-->(j1140)--e9-->(E2)
|
14
|
-
#
|
15
|
-
# in [j1120]
|
16
|
-
# (S3)--e10-->(j1121)--e11-->(E3)
|
17
|
-
#
|
18
|
-
# in [j1130]
|
19
|
-
# (S4)--e12-->(j1131)--e13-->(E4)
|
20
|
-
#
|
21
|
-
# in [j1300]
|
22
|
-
# (S5)--e14-->(j1310)--e15-->(E5)
|
23
|
-
#
|
24
|
-
class Rjn0011NestedForkJobnetBuilder < JobnetFixtureBuilder
|
25
|
-
include TestCredentialFixture
|
26
|
-
include TestServerFixture
|
27
|
-
|
28
|
-
DSL = <<-EOS
|
29
|
-
jobnet("rjn0011", :server_name => "test_server1", :credential_name => "test_credential1") do
|
30
|
-
auto_sequence
|
31
|
-
jobnet("j1100") do
|
32
|
-
job("j1110", "job_test j1110")
|
33
|
-
jobnet("j1120") do
|
34
|
-
job("j1121", "job_test j1121")
|
35
|
-
end
|
36
|
-
jobnet("j1130") do
|
37
|
-
job("j1131", "job_test j1131")
|
38
|
-
end
|
39
|
-
job("j1140", "job_test j1140")
|
40
|
-
end
|
41
|
-
job("j1200", "job_test j1200")
|
42
|
-
jobnet("j1300") do
|
43
|
-
job("j1310", "job_test j1310")
|
44
|
-
end
|
45
|
-
end
|
46
|
-
EOS
|
47
|
-
|
48
|
-
def create(options = {})
|
49
|
-
root = new_root_jobnet("rjn0011", :server_name => test_server1.name, :credential_name => test_credential1.name)
|
50
|
-
root.children << new_start
|
51
|
-
root.children << new_jobnet("j1100")
|
52
|
-
root.children << new_script("j1200", :script => "job_test j1200")
|
53
|
-
root.children << new_jobnet("j1300")
|
54
|
-
root.children << new_end
|
55
|
-
root.edges << new_edge(:S1 , :j1100)
|
56
|
-
root.edges << new_edge(:j1100, :j1200)
|
57
|
-
root.edges << new_edge(:j1200, :j1300)
|
58
|
-
root.edges << new_edge(:j1300, :E1 )
|
59
|
-
self[:j1100].tap do |j1100|
|
60
|
-
j1100.children << new_start
|
61
|
-
j1100.children << new_script("j1110", :script => "job_test j1110")
|
62
|
-
j1100.children << new_jobnet("j1120")
|
63
|
-
j1100.children << new_jobnet("j1130")
|
64
|
-
j1100.children << new_script("j1140", :script => "job_test j1140")
|
65
|
-
j1100.children << new_end
|
66
|
-
j1100.edges << new_edge(:S2 , :j1110)
|
67
|
-
j1100.edges << new_edge(:j1110, :j1120)
|
68
|
-
j1100.edges << new_edge(:j1120, :j1130)
|
69
|
-
j1100.edges << new_edge(:j1130, :j1140)
|
70
|
-
j1100.edges << new_edge(:j1140, :E2 )
|
71
|
-
end
|
72
|
-
self[:j1120].tap do |j1120|
|
73
|
-
j1120.children << new_start
|
74
|
-
j1120.children << new_script("j1121", :script => "job_test j1121")
|
75
|
-
j1120.children << new_end
|
76
|
-
j1120.edges << new_edge(:S3 , :j1121)
|
77
|
-
j1120.edges << new_edge(:j1121, :E3 )
|
78
|
-
end
|
79
|
-
self[:j1130].tap do |j1130|
|
80
|
-
j1130.children << new_start
|
81
|
-
j1130.children << new_script("j1131", :script => "job_test j1131")
|
82
|
-
j1130.children << new_end
|
83
|
-
j1130.edges << new_edge(:S4 , :j1131)
|
84
|
-
j1130.edges << new_edge(:j1131, :E4 )
|
85
|
-
end
|
86
|
-
self[:j1300].tap do |j1300|
|
87
|
-
j1300.children << new_start
|
88
|
-
j1300.children << new_script("j1310", :script => "job_test j1310")
|
89
|
-
j1300.children << new_end
|
90
|
-
j1300.edges << new_edge(:S5 , :j1310)
|
91
|
-
j1300.edges << new_edge(:j1310, :E5 )
|
92
|
-
end
|
93
|
-
root.save!
|
94
|
-
root
|
95
|
-
end
|
96
|
-
end
|
@@ -1,157 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
# 以下のジョブネットについてテンプレートジョブネットや
|
3
|
-
# 実行用ジョブネットを扱うフィクスチャ生成のためのクラスです。
|
4
|
-
#
|
5
|
-
# in [rjn0012]
|
6
|
-
# (S1)--e1-->[j1000]--e2-->[j2000]--e3-->(E1)
|
7
|
-
#
|
8
|
-
# in [j1000]
|
9
|
-
# (S2)--e4-->[j1100]--e5-->[j1200]--e6-->(E2)
|
10
|
-
#
|
11
|
-
# in [j1100]
|
12
|
-
# (S3)--e7-->(j1110)--e8-->(E3)
|
13
|
-
#
|
14
|
-
# in [j1200]
|
15
|
-
# (S4)--e9-->(j1210)--e10-->(E4)
|
16
|
-
#
|
17
|
-
# in [j1000:finally (=j1f00)]
|
18
|
-
# (S5)--e11-->[j1f10]--e12-->(E5)
|
19
|
-
#
|
20
|
-
# in [j1f10]
|
21
|
-
# (S6)--e13-->(j1f11)--e14-->(E6)
|
22
|
-
#
|
23
|
-
# in [j1000:finally:finally (=j1ff0)]
|
24
|
-
# (S7)--e15-->(j1ff1)--e16-->(E7)
|
25
|
-
#
|
26
|
-
# in [j2000]
|
27
|
-
# (S8)--e17-->(j2100)--e18-->(E8)
|
28
|
-
#
|
29
|
-
# in [jf000:finally (=jf000)]
|
30
|
-
# (S9)--e19-->(jf100)--e20-->(E9)
|
31
|
-
#
|
32
|
-
|
33
|
-
class Rjn0012NestedAndFinallyBuilder < JobnetFixtureBuilder
|
34
|
-
DSL = <<-EOS
|
35
|
-
jobnet("rjn0012") do
|
36
|
-
auto_sequence
|
37
|
-
jobnet("j1000") do
|
38
|
-
jobnet("j1100") do
|
39
|
-
job("j1110", "job_test j1110")
|
40
|
-
end
|
41
|
-
jobnet("j1200") do
|
42
|
-
job("j1210", "job_test j1210")
|
43
|
-
end
|
44
|
-
finally do
|
45
|
-
jobnet("j1f10") do
|
46
|
-
job("j1f11", "job_test j1f11")
|
47
|
-
end
|
48
|
-
finally do
|
49
|
-
job("j1ff1", "job_test j1ff1")
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
jobnet("j2000") do
|
55
|
-
job("j2100", "job_test j2100")
|
56
|
-
end
|
57
|
-
|
58
|
-
finally do
|
59
|
-
job("jf100", "job_test jf100")
|
60
|
-
end
|
61
|
-
end
|
62
|
-
EOS
|
63
|
-
|
64
|
-
def create(options = {})
|
65
|
-
root = new_root_jobnet("rjn0012")
|
66
|
-
root.children << new_start
|
67
|
-
root.children << new_jobnet("j1000")
|
68
|
-
root.children << new_jobnet("j2000")
|
69
|
-
root.children << new_finally
|
70
|
-
root.children << new_end
|
71
|
-
root.edges << new_edge(:S1 , :j1000)
|
72
|
-
root.edges << new_edge(:j1000, :j2000)
|
73
|
-
root.edges << new_edge(:j2000, :E1 )
|
74
|
-
|
75
|
-
self[:j1000].tap do |j1000|
|
76
|
-
j1000.children << new_start
|
77
|
-
j1000.children << new_jobnet("j1100")
|
78
|
-
j1000.children << new_jobnet("j1200")
|
79
|
-
j1000.children << new_finally
|
80
|
-
j1000.children << new_end
|
81
|
-
j1000.edges << new_edge(:S2 , :j1100)
|
82
|
-
j1000.edges << new_edge(:j1100, :j1200)
|
83
|
-
j1000.edges << new_edge(:j1200, :E2 )
|
84
|
-
|
85
|
-
self[:j1100].tap do |j1100|
|
86
|
-
j1100.children << new_start
|
87
|
-
j1100.children << new_script("j1110", :script => "job_test j1110")
|
88
|
-
j1100.children << new_end
|
89
|
-
j1100.edges << new_edge(:S3 , :j1110)
|
90
|
-
j1100.edges << new_edge(:j1110, :E3 )
|
91
|
-
end
|
92
|
-
self[:j1200].tap do |j1200|
|
93
|
-
j1200.children << new_start
|
94
|
-
j1200.children << new_script("j1210", :script => "job_test j1210")
|
95
|
-
j1200.children << new_end
|
96
|
-
j1200.edges << new_edge(:S4 , :j1210)
|
97
|
-
j1200.edges << new_edge(:j1210, :E4 )
|
98
|
-
end
|
99
|
-
|
100
|
-
self[:j1f00] = j1000.finally_vertex
|
101
|
-
self[:j1f00].tap do |j1f00|
|
102
|
-
j1f00.children << new_start
|
103
|
-
j1f00.children << new_jobnet("j1f10")
|
104
|
-
j1f00.children << new_finally
|
105
|
-
j1f00.children << new_end
|
106
|
-
j1f00.edges << new_edge(:S5 , :j1f10)
|
107
|
-
j1f00.edges << new_edge(:j1f10, :E5 )
|
108
|
-
self[:j1f10].tap do |j1f10|
|
109
|
-
j1f10.children << new_start
|
110
|
-
j1f10.children << new_script("j1f11", :script => "job_test j1f11")
|
111
|
-
j1f10.children << new_end
|
112
|
-
j1f10.edges << new_edge(:S6 , :j1f11)
|
113
|
-
j1f10.edges << new_edge(:j1f11, :E6 )
|
114
|
-
end
|
115
|
-
self[:j1ff0] = j1f00.finally_vertex
|
116
|
-
self[:j1ff0].tap do |j1ff0|
|
117
|
-
j1ff0.children << new_start
|
118
|
-
j1ff0.children << new_jobnet("j1ff1")
|
119
|
-
j1ff0.children << new_end
|
120
|
-
j1ff0.edges << new_edge(:S7 , :j1ff1)
|
121
|
-
j1ff0.edges << new_edge(:j1ff1, :E7 )
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
self[:j2000].tap do |j2000|
|
127
|
-
j2000.children << new_start
|
128
|
-
j2000.children << new_script("j2100", :script => "job_test j2100")
|
129
|
-
j2000.children << new_end
|
130
|
-
j2000.edges << new_edge(:S8 , :j2100)
|
131
|
-
j2000.edges << new_edge(:j2100, :E8 )
|
132
|
-
end
|
133
|
-
|
134
|
-
self[:jf000] = root.finally_vertex
|
135
|
-
self[:jf000].tap do |jf000|
|
136
|
-
jf000.children << new_start
|
137
|
-
jf000.children << new_script("jf100")
|
138
|
-
jf000.children << new_end
|
139
|
-
jf000.edges << new_edge(:S9 , :jf100)
|
140
|
-
jf000.edges << new_edge(:jf100, :E9 )
|
141
|
-
end
|
142
|
-
|
143
|
-
unless root.valid?
|
144
|
-
v = Tengine::Job::Vertex::AllVisitorWithEdge.new do |obj|
|
145
|
-
if obj.respond_to?(:errors) && !obj.errors.empty?
|
146
|
-
puts obj.errors.inspect
|
147
|
-
true
|
148
|
-
end
|
149
|
-
end
|
150
|
-
root.accept_visitor(v)
|
151
|
-
end
|
152
|
-
|
153
|
-
root.save!
|
154
|
-
|
155
|
-
root
|
156
|
-
end
|
157
|
-
end
|