tengine_job 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +23 -0
  4. data/Gemfile.lock +109 -0
  5. data/README.rdoc +20 -0
  6. data/Rakefile +42 -0
  7. data/VERSION +1 -0
  8. data/examples/0004_retry_one_layer.rb +24 -0
  9. data/examples/0004_retry_one_layer.sh +38 -0
  10. data/examples/0005_retry_two_layer.rb +54 -0
  11. data/examples/0005_retry_two_layer.sh +80 -0
  12. data/examples/0006_retry_three_layer.rb +58 -0
  13. data/examples/0006_retry_three_layer.sh +74 -0
  14. data/examples/0007_simple_jobnet.rb +7 -0
  15. data/examples/0021_dynamic_env.rb +20 -0
  16. data/examples/VERSION +1 -0
  17. data/examples/tengine_job_test.sh +10 -0
  18. data/lib/tengine/job.rb +94 -0
  19. data/lib/tengine/job/category.rb +54 -0
  20. data/lib/tengine/job/connectable.rb +43 -0
  21. data/lib/tengine/job/drivers/job_control_driver.rb +82 -0
  22. data/lib/tengine/job/drivers/job_execution_driver.rb +30 -0
  23. data/lib/tengine/job/drivers/jobnet_control_driver.rb +117 -0
  24. data/lib/tengine/job/drivers/schedule_driver.rb +30 -0
  25. data/lib/tengine/job/dsl_binder.rb +12 -0
  26. data/lib/tengine/job/dsl_evaluator.rb +18 -0
  27. data/lib/tengine/job/dsl_loader.rb +180 -0
  28. data/lib/tengine/job/edge.rb +150 -0
  29. data/lib/tengine/job/element_selector_notation.rb +169 -0
  30. data/lib/tengine/job/end.rb +32 -0
  31. data/lib/tengine/job/executable.rb +74 -0
  32. data/lib/tengine/job/execution.rb +141 -0
  33. data/lib/tengine/job/expansion.rb +37 -0
  34. data/lib/tengine/job/fork.rb +6 -0
  35. data/lib/tengine/job/job.rb +23 -0
  36. data/lib/tengine/job/jobnet.rb +173 -0
  37. data/lib/tengine/job/jobnet/builder.rb +150 -0
  38. data/lib/tengine/job/jobnet/job_state_transition.rb +167 -0
  39. data/lib/tengine/job/jobnet/jobnet_state_transition.rb +110 -0
  40. data/lib/tengine/job/jobnet/state_transition.rb +37 -0
  41. data/lib/tengine/job/jobnet_actual.rb +55 -0
  42. data/lib/tengine/job/jobnet_template.rb +10 -0
  43. data/lib/tengine/job/join.rb +6 -0
  44. data/lib/tengine/job/junction.rb +29 -0
  45. data/lib/tengine/job/killing.rb +30 -0
  46. data/lib/tengine/job/mm_compatibility.rb +6 -0
  47. data/lib/tengine/job/mm_compatibility/connectable.rb +13 -0
  48. data/lib/tengine/job/name_path.rb +31 -0
  49. data/lib/tengine/job/root.rb +16 -0
  50. data/lib/tengine/job/root_jobnet_actual.rb +39 -0
  51. data/lib/tengine/job/root_jobnet_template.rb +49 -0
  52. data/lib/tengine/job/script_executable.rb +235 -0
  53. data/lib/tengine/job/signal.rb +121 -0
  54. data/lib/tengine/job/start.rb +20 -0
  55. data/lib/tengine/job/stoppable.rb +15 -0
  56. data/lib/tengine/job/vertex.rb +172 -0
  57. data/lib/tengine_job.rb +3 -0
  58. data/spec/fixtures/rjn_0001_simple_jobnet_builder.rb +42 -0
  59. data/spec/fixtures/rjn_0002_simple_parallel_jobnet_builder.rb +42 -0
  60. data/spec/fixtures/rjn_0003_fork_join_jobnet_builder.rb +61 -0
  61. data/spec/fixtures/rjn_0004_parallel_jobnet_with_finally_fixture.rb +62 -0
  62. data/spec/fixtures/rjn_0005_retry_two_layer_fixture.rb +153 -0
  63. data/spec/fixtures/rjn_0008_expansion_fixture.rb +32 -0
  64. data/spec/fixtures/rjn_0009_tree_sequential_jobnet_builder.rb +174 -0
  65. data/spec/fixtures/rjn_0010_2jobs_and_1job_parallel_jobnet_builder.rb +39 -0
  66. data/spec/fixtures/rjn_0011_nested_fork_jobnet_builder.rb +96 -0
  67. data/spec/fixtures/rjn_0012_nested_and_finally_builder.rb +157 -0
  68. data/spec/fixtures/rjn_1004_hadoop_job_in_jobnet_fixture.rb +105 -0
  69. data/spec/fixtures/rjn_means_root_jobnet +0 -0
  70. data/spec/fixtures/test_credential_fixture.rb +12 -0
  71. data/spec/fixtures/test_server_fixture.rb +28 -0
  72. data/spec/mongoid.yml +35 -0
  73. data/spec/spec_helper.rb +56 -0
  74. data/spec/sshd/.gitignore +1 -0
  75. data/spec/sshd/id_rsa +51 -0
  76. data/spec/sshd/id_rsa.pub +1 -0
  77. data/spec/sshd/ssh_host_rsa_key +51 -0
  78. data/spec/sshd/ssh_host_rsa_key.pub +1 -0
  79. data/spec/sshd/sshd_config +10 -0
  80. data/spec/sshd/sshd_config.erb +11 -0
  81. data/spec/sshd/tengine_job_test.sh +6 -0
  82. data/spec/support/jobnet_fixture_builder.rb +145 -0
  83. data/spec/support/mongo_index_key_log.rb +91 -0
  84. data/spec/tengine/job/category_spec.rb +193 -0
  85. data/spec/tengine/job/connectable_spec.rb +94 -0
  86. data/spec/tengine/job/drivers/job_controll_driver/connection_error_spec.rb +236 -0
  87. data/spec/tengine/job/drivers/job_controll_driver/duplicated_job_start_spec.rb +302 -0
  88. data/spec/tengine/job/drivers/job_controll_driver/expansion_spec.rb +120 -0
  89. data/spec/tengine/job/drivers/job_controll_driver/stop_spec.rb +159 -0
  90. data/spec/tengine/job/drivers/job_controll_driver_spec.rb +623 -0
  91. data/spec/tengine/job/drivers/job_execution_driver_spec.rb +88 -0
  92. data/spec/tengine/job/drivers/jobnet_control_driver/nested_and_finally_spec.rb +472 -0
  93. data/spec/tengine/job/drivers/jobnet_control_driver/nested_jobnet_spec.rb +231 -0
  94. data/spec/tengine/job/drivers/jobnet_control_driver/stop_jobnet_spec.rb +202 -0
  95. data/spec/tengine/job/drivers/jobnet_control_driver_spec.rb +446 -0
  96. data/spec/tengine/job/drivers/schedule_driver_spec.rb +202 -0
  97. data/spec/tengine/job/dsl_binder_spec.rb +36 -0
  98. data/spec/tengine/job/dsl_loader_spec.rb +403 -0
  99. data/spec/tengine/job/dsls/0013_hadoop_job_run.rb +29 -0
  100. data/spec/tengine/job/dsls/0014_join_and_join.rb +19 -0
  101. data/spec/tengine/job/dsls/0015_fork_and_fork.rb +18 -0
  102. data/spec/tengine/job/dsls/0016_complex_fork_and_join.rb +20 -0
  103. data/spec/tengine/job/dsls/0017_finally.rb +15 -0
  104. data/spec/tengine/job/dsls/0018_expansion.rb +23 -0
  105. data/spec/tengine/job/dsls/0019_execute_job_on_event.rb +16 -0
  106. data/spec/tengine/job/dsls/0020_duplicated_jobnet_name.rb +16 -0
  107. data/spec/tengine/job/dsls/1060_test_dir1/1060_test_dir2/0013_hadoop_job_run.rb +29 -0
  108. data/spec/tengine/job/dsls/2003_expansion/expansion_5.rb +11 -0
  109. data/spec/tengine/job/dsls/VERSION +1 -0
  110. data/spec/tengine/job/dynamic_env_spec.rb +95 -0
  111. data/spec/tengine/job/edge_spec.rb +241 -0
  112. data/spec/tengine/job/element_selector_notation_spec.rb +354 -0
  113. data/spec/tengine/job/examples_spec.rb +62 -0
  114. data/spec/tengine/job/execution_spec.rb +100 -0
  115. data/spec/tengine/job/expansion_spec.rb +116 -0
  116. data/spec/tengine/job/hadoop_job_run_spec.rb +65 -0
  117. data/spec/tengine/job/job_spec.rb +4 -0
  118. data/spec/tengine/job/jobnet/1015_complecated_jobnet_spec.rb +72 -0
  119. data/spec/tengine/job/jobnet_actual_spec.rb +175 -0
  120. data/spec/tengine/job/jobnet_spec.rb +399 -0
  121. data/spec/tengine/job/jobnet_template_spec.rb +240 -0
  122. data/spec/tengine/job/killing_spec.rb +91 -0
  123. data/spec/tengine/job/reset_spec.rb +958 -0
  124. data/spec/tengine/job/reset_spec/4056_1_dump.txt +1 -0
  125. data/spec/tengine/job/root_jobnet_actual_spec.rb +89 -0
  126. data/spec/tengine/job/root_jobnet_template_spec.rb +248 -0
  127. data/spec/tengine/job/script_executable_spec.rb +132 -0
  128. data/spec/tengine/job/stoppable_spec.rb +176 -0
  129. data/spec/tengine/job/vertex_spec.rb +25 -0
  130. data/spec/tengine_job_spec.rb +4 -0
  131. data/tengine_job.gemspec +197 -0
  132. data/tmp/log/.gitignore +1 -0
  133. metadata +296 -0
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,23 @@
1
+ # -*- coding: utf-8 -*-
2
+ source "http://rubygems.org"
3
+
4
+ # Add dependencies required to use your gem here.
5
+ # Example:
6
+ # gem "activesupport", ">= 2.3.5"
7
+
8
+ gem "tengine_support", "~> 0.3.12"
9
+ gem "tengine_core", "~> 0.5.25"
10
+ gem "tengine_resource", "~> 0.5.4"
11
+
12
+ # Add dependencies to develop your gem here.
13
+ # Include everything needed to run rake, tests, features, etc.
14
+ group :development do
15
+ gem "rspec", "~> 2.6.0"
16
+ gem "factory_girl", "~> 2.1.2"
17
+ gem "yard", "~> 0.7.2"
18
+ gem "bundler", "~> 1.0.18"
19
+ gem "jeweler", "~> 1.6.4"
20
+ # gem "rcov", ">= 0"
21
+ gem "simplecov", "~> 0.5.3"
22
+ gem "ZenTest", "~> 4.6.2"
23
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,109 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ ZenTest (4.6.2)
5
+ activemodel (3.1.3)
6
+ activesupport (= 3.1.3)
7
+ builder (~> 3.0.0)
8
+ i18n (~> 0.6)
9
+ activesupport (3.1.3)
10
+ multi_json (~> 1.0)
11
+ amq-client (0.8.7)
12
+ amq-protocol (>= 0.8.4)
13
+ eventmachine
14
+ amq-protocol (0.8.4)
15
+ amqp (0.8.4)
16
+ amq-client (~> 0.8.7)
17
+ amq-protocol (~> 0.8.4)
18
+ eventmachine
19
+ bson (1.5.2)
20
+ bson_ext (1.5.2)
21
+ bson (= 1.5.2)
22
+ builder (3.0.0)
23
+ daemons (1.1.8)
24
+ diff-lcs (1.1.3)
25
+ eventmachine (0.12.10)
26
+ factory_girl (2.1.2)
27
+ activesupport
28
+ git (1.2.5)
29
+ i18n (0.6.0)
30
+ jeweler (1.6.4)
31
+ bundler (~> 1.0)
32
+ git (>= 1.2.5)
33
+ rake
34
+ json (1.6.5)
35
+ macaddr (1.5.0)
36
+ systemu (>= 2.4.0)
37
+ mongo (1.5.2)
38
+ bson (= 1.5.2)
39
+ mongoid (2.3.4)
40
+ activemodel (~> 3.1)
41
+ mongo (~> 1.3)
42
+ tzinfo (~> 0.3.22)
43
+ multi_json (1.0.4)
44
+ net-ssh (2.2.2)
45
+ rake (0.9.2.2)
46
+ right_aws (2.1.0)
47
+ right_http_connection (>= 1.2.5)
48
+ right_http_connection (1.3.0)
49
+ rspec (2.6.0)
50
+ rspec-core (~> 2.6.0)
51
+ rspec-expectations (~> 2.6.0)
52
+ rspec-mocks (~> 2.6.0)
53
+ rspec-core (2.6.4)
54
+ rspec-expectations (2.6.0)
55
+ diff-lcs (~> 1.1.2)
56
+ rspec-mocks (2.6.0)
57
+ selectable_attr (0.3.15)
58
+ i18n
59
+ simplecov (0.5.4)
60
+ multi_json (~> 1.0.3)
61
+ simplecov-html (~> 0.5.3)
62
+ simplecov-html (0.5.3)
63
+ systemu (2.4.2)
64
+ tengine_core (0.5.28)
65
+ activemodel (~> 3.1.0)
66
+ activesupport (~> 3.1.0)
67
+ bson (~> 1.5.2)
68
+ bson_ext (~> 1.5.2)
69
+ daemons (~> 1.1.4)
70
+ mongo (~> 1.5.2)
71
+ mongoid (~> 2.3.3)
72
+ selectable_attr (~> 0.3.15)
73
+ tengine_event (~> 0.4.0)
74
+ tengine_support (~> 0.3.12)
75
+ tengine_event (0.4.6)
76
+ activesupport (>= 3.0.0)
77
+ amqp (~> 0.8.0)
78
+ tengine_support (>= 0.3.24)
79
+ uuid (~> 2.3.4)
80
+ tengine_resource (0.5.13)
81
+ net-ssh (~> 2.2.1)
82
+ right_aws (~> 2.1.0)
83
+ tengine_core (~> 0.5.23)
84
+ tengine_support (~> 0.3.24)
85
+ wakame-adapters-tengine (~> 0.0.0)
86
+ tengine_support (0.3.24)
87
+ activesupport (>= 3.0.0)
88
+ tzinfo (0.3.31)
89
+ uuid (2.3.5)
90
+ macaddr (~> 1.0)
91
+ wakame-adapters-tengine (0.0.7)
92
+ json
93
+ right_aws (~> 2.1.0)
94
+ yard (0.7.5)
95
+
96
+ PLATFORMS
97
+ ruby
98
+
99
+ DEPENDENCIES
100
+ ZenTest (~> 4.6.2)
101
+ bundler (~> 1.0.18)
102
+ factory_girl (~> 2.1.2)
103
+ jeweler (~> 1.6.4)
104
+ rspec (~> 2.6.0)
105
+ simplecov (~> 0.5.3)
106
+ tengine_core (~> 0.5.25)
107
+ tengine_resource (~> 0.5.4)
108
+ tengine_support (~> 0.3.12)
109
+ yard (~> 0.7.2)
data/README.rdoc ADDED
@@ -0,0 +1,20 @@
1
+ = tengine_job
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to tengine_job
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == License
16
+ tengine_event is distributed under the MPL2.0 or LGPLv3 or the dual license of MPL2.0/LGPLv3
17
+
18
+ == Copyright
19
+
20
+ Copyright (c) 2011 nautilus-technologies.com
data/Rakefile ADDED
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "tengine_job"
18
+ gem.homepage = "http://github.com/tengine/tengine_job"
19
+ gem.license = "MPL2.0/LGPLv3"
20
+ gem.summary = %Q{tengine_job provides jobnet management}
21
+ gem.description = %Q{tengine_job provides jobnet management}
22
+ gem.email = "tengine@nautilus-technologies.com"
23
+ gem.authors = %w[taigou totty g-morita shyouhei akm guemon]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ task :default => :spec
40
+
41
+ require 'yard'
42
+ YARD::Rake::YardocTask.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.6.9
@@ -0,0 +1,24 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'tengine_job'
4
+
5
+ # [jn0004]
6
+ # |-->[j2]-->
7
+ # | |
8
+ # [S1]-->[j1]--> |-->[j4]-->[E1]
9
+ # |-->[j3]-->
10
+ # _________finally________
11
+ # { }
12
+ # {[S2]-->[jn0004_f]-->[E2]}
13
+ # {________________________}
14
+ #
15
+ jobnet("jn0004", :instance_name => "test_server1", :credential_name => "test_credential1") do
16
+ boot_jobs("j1")
17
+ job("j1", "$HOME/0004_retry_one_layer.sh", :to => ["j2", "j3"])
18
+ job("j2", "$HOME/0004_retry_one_layer.sh", :to => "j4")
19
+ job("j3", "$HOME/0004_retry_one_layer.sh", :to => "j4")
20
+ job("j4", "$HOME/0004_retry_one_layer.sh")
21
+ finally do
22
+ job("jn0004_f", "$HOME/0004_retry_one_layer.sh")
23
+ end
24
+ end
@@ -0,0 +1,38 @@
1
+ #!/bin/bash
2
+ typeset -i time=$1
3
+ export LOGFILE=tengine_job_test.log
4
+ echo "`date` tengine_job_test $MM_ACTUAL_JOB_NAME_PATH start" >> $LOGFILE
5
+ case "$MM_ACTUAL_JOB_NAME_PATH" in
6
+ "/jn0004/j1" )
7
+ sleep ${J1_SLEEP:=0}
8
+ if [ "$J1_FAIL" = "true" ] ; then
9
+ exit 1
10
+ fi
11
+ ;;
12
+ "/jn0004/j2" )
13
+ sleep ${J2_SLEEP:=0}
14
+ if [ "$J2_FAIL" = "true" ] ; then
15
+ exit 1
16
+ fi
17
+ ;;
18
+ "/jn0004/j3" )
19
+ sleep ${J3_SLEEP:=0}
20
+ if [ "$J3_FAIL" = "true" ] ; then
21
+ exit 1
22
+ fi
23
+ ;;
24
+ "/jn0004/j4" )
25
+ sleep ${J4_SLEEP:=0}
26
+ if [ "$J4_FAIL" = "true" ] ; then
27
+ exit 1
28
+ fi
29
+ ;;
30
+ "/jn0004/finally/jn0004_f" )
31
+ sleep ${JN0004_F_SLEEP:=0}
32
+ if [ "$JN0004_F_FAIL" = "true" ] ; then
33
+ exit 1
34
+ fi
35
+ ;;
36
+ esac
37
+
38
+ echo "`date` tengine_job_test $MM_ACTUAL_JOB_NAME_PATH finish" >> $LOGFILE
@@ -0,0 +1,54 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'tengine_job'
4
+
5
+ # [jn0005]
6
+ # ________________[jn4]________________
7
+ # { }
8
+ # { |-->[j42]--> }
9
+ # { | | }
10
+ # [S1]-->[j1]-->F-->{ [S2]-->[j41]--> |-->[j44]-->[E2]}-->J--[j4]-->[E1]
11
+ # | { |-->[j43]--> } |
12
+ # | { __________finally__________ } |
13
+ # | { { [S3]-->[jn4_f]-->[E3] } } |
14
+ # | { _________________________________________} |
15
+ # |-------------------->[j2]------------------------>|
16
+ #
17
+ # ________________________________finally________________________________
18
+ # { _____________________jn0005_fjn__________ }
19
+ # { { } }
20
+ # { { [S5]-->[jn0005_f1]-->[jn0005_f2]-->[E5] } }
21
+ # { [S4]-->{ }-->[jn0005_f]-->[E4]}
22
+ # { { ____________finally________ } }
23
+ # { { {[S6]-->[jn0005_fif]-->[E6]} } }
24
+ # { {_________________________________________} }
25
+ # { ______________________________________________________________________}
26
+
27
+ jobnet("jn0005", :instance_name => "test_server1", :credential_name => "test_credential1") do
28
+ boot_jobs("j1")
29
+ job("j1", "$HOME/0005_retry_two_layer.sh", :to => ["j2", "jn4"])
30
+ job("j2", "$HOME/0005_retry_two_layer.sh", :to => "j4")
31
+ jobnet("jn4", :to => "j4") do
32
+ boot_jobs("j41")
33
+ job("j41", "$HOME/0005_retry_two_layer.sh", :to => ["j42", "j43"])
34
+ job("j42", "$HOME/0005_retry_two_layer.sh", :to => "j44")
35
+ job("j43", "$HOME/0005_retry_two_layer.sh", :to => "j44")
36
+ job("j44", "$HOME/0005_retry_two_layer.sh")
37
+ finally do
38
+ job("jn4_f", "$HOME/0005_retry_two_layer.sh")
39
+ end
40
+ end
41
+ job("j4", "$HOME/0005_retry_two_layer.sh")
42
+ finally do
43
+ boot_jobs("jn0005_fjn")
44
+ jobnet("jn0005_fjn", :to => "jn0005_f") do
45
+ boot_jobs("jn0005_f1")
46
+ job("jn0005_f1", "$HOME/0005_retry_two_layer.sh", :to => ["jn0005_f2"])
47
+ job("jn0005_f2", "$HOME/0005_retry_two_layer.sh")
48
+ finally do
49
+ job("jn0005_fif","$HOME/0005_retry_two_layer.sh")
50
+ end
51
+ end
52
+ job("jn0005_f", "$HOME/0005_retry_two_layer.sh")
53
+ end
54
+ end
@@ -0,0 +1,80 @@
1
+ #!/bin/bash
2
+ typeset -i time=$1
3
+ export LOGFILE=tengine_job_test.log
4
+ echo "`date` tengine_job_test $MM_ACTUAL_JOB_NAME_PATH start" >> $LOGFILE
5
+ case "$MM_ACTUAL_JOB_NAME_PATH" in
6
+ "/jn0005/j1" )
7
+ sleep ${J1_SLEEP:=0}
8
+ if [ $J1_FAIL = "true" ] ; then
9
+ exit 1
10
+ fi
11
+ ;;
12
+ "/jn0005/j2" )
13
+ sleep ${J2_SLEEP:=0}
14
+ if [ "$J2_FAIL" = "true" ] ; then
15
+ exit 1
16
+ fi
17
+ ;;
18
+ "/jn0005/jn4/j41" )
19
+ sleep ${J41_SLEEP:=0}
20
+ if [ "$J41_FAIL" = "true" ] ; then
21
+ exit 1
22
+ fi
23
+ ;;
24
+ "/jn0005/jn4/j42" )
25
+ sleep ${J42_SLEEP:=0}
26
+ if [ "$J42_FAIL" = "true" ] ; then
27
+ exit 1
28
+ fi
29
+ ;;
30
+ "/jn0005/jn4/j43" )
31
+ sleep ${J43_SLEEP:=0}
32
+ if [ "$J43_FAIL" = "true" ] ; then
33
+ exit 1
34
+ fi
35
+ ;;
36
+ "/jn0005/jn4/j44" )
37
+ sleep ${J44_SLEEP:=0}
38
+ if [ "$J44_FAIL" = "true" ] ; then
39
+ exit 1
40
+ fi
41
+ ;;
42
+ "/jn0005/jn4/finally/jn4_f" )
43
+ sleep ${JN4_F_SLEEP:=0}
44
+ if [ "$JN4_F_FAIL" = "true" ] ; then
45
+ exit 1
46
+ fi
47
+ ;;
48
+ "/jn0005/j4" )
49
+ sleep ${J4_SLEEP:=0}
50
+ if [ "$J4_FAIL" = "true" ] ; then
51
+ exit 1
52
+ fi
53
+ ;;
54
+ "/jn0005/finally/jn0005_fjn/jn0005_f1" )
55
+ sleep ${JN0005_F1_SLEEP:=0}
56
+ if [ "$JN0005_F1_FAIL" = "true" ] ; then
57
+ exit 1
58
+ fi
59
+ ;;
60
+ "/jn0005/finally/jn0005_fjn/jn0005_f2" )
61
+ sleep ${JN0005_F2_SLEEP:=0}
62
+ if [ "$JN0005_F2_FAIL" = "true" ] ; then
63
+ exit 1
64
+ fi
65
+ ;;
66
+ "/jn0005/finally/jn0005_fjn/finally/jn0005_fif" )
67
+ sleep ${JN0005_FIF_SLEEP:=0}
68
+ if [ "$JN0005_FIF_FAIL" = "true" ] ; then
69
+ exit 1
70
+ fi
71
+ ;;
72
+ "/jn0005/finally/jn0005_f" )
73
+ sleep ${JN0005_F_SLEEP:=0}
74
+ if [ "$JN0005_F_FAIL" = "true" ] ; then
75
+ exit 1
76
+ fi
77
+ ;;
78
+ esac
79
+
80
+ echo "`date` tengine_job_test $MM_ACTUAL_JOB_NAME_PATH finish" >> $LOGFILE
@@ -0,0 +1,58 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'tengine_job'
4
+
5
+ # finallyを追加する
6
+ # [jn0006]
7
+ # __________________________[jn1]____________________________ ______________[jn2]_____________________________________
8
+ # { __________[jn11]_______________ } { _____________[jn22]____________ }
9
+ # { { } } { { } }
10
+ # [S1]-->{ [S2]--> { [S3]-->[j111]-->[j112]-->[E3] } -->[j12]-->[E2] } --> { [S6]-->[j21]-->{ [S7]-->[j221]-->[j222]-->[E7]} -->[E6] } -->[E1]
11
+ # { { } } { { } }
12
+ # { { _______finally_______ } } { { _________finally_______ } }
13
+ # { { {[S4]-->[jn11_f]-->[E4]} } } { { {[S8]-->[jn22_f]-->[E8]} } }
14
+ # { {_______________________________} } { {______________________________} }
15
+ # { } { }
16
+ # { _______finally_______ } { _______finally_______ }
17
+ # { {[S5]-->[jn1_f]-->[E5]} } { {[S9]-->[jn2_f]-->[E9]} }
18
+ # {___________________________________________________________} {_________________________________________________________}
19
+ #
20
+ # _______finally_______
21
+ # {[S10]-->[jn_f]-->[E10]}
22
+ #
23
+ jobnet("jn0006", :instance_name => "test_server1", :credential_name => "test_credential1") do
24
+ boot_jobs("jn1")
25
+ jobnet("jn1", :to => "jn2") do
26
+ boot_jobs("jn11")
27
+ jobnet("jn11", :to => "j12") do
28
+ boot_jobs("j111")
29
+ job("j111", "$HOME/0006_retry_three_layer.sh",:to => "j112")
30
+ job("j112", "$HOME/0006_retry_three_layer.sh" )
31
+ finally do
32
+ job("jn11_f","$HOME/0006_retry_three_layer.sh")
33
+ end
34
+ end
35
+ job("j12", "$HOME/0006_retry_three_layer.sh")
36
+ finally do
37
+ job("jn1_f","$HOME/0006_retry_three_layer.sh")
38
+ end
39
+ end
40
+ jobnet("jn2") do
41
+ boot_jobs("j21")
42
+ job("j21", "$HOME/0006_retry_three_layer.sh", :to => "jn22")
43
+ jobnet("jn22") do
44
+ boot_jobs("j221")
45
+ job("j221", "$HOME/0006_retry_three_layer.sh",:to => "j222")
46
+ job("j222", "$HOME/0006_retry_three_layer.sh" )
47
+ finally do
48
+ job("jn22_f","$HOME/0006_retry_three_layer.sh")
49
+ end
50
+ end
51
+ finally do
52
+ job("jn2_f","$HOME/0006_retry_three_layer.sh")
53
+ end
54
+ end
55
+ finally do
56
+ job("jn_f","$HOME/0006_retry_three_layer.sh")
57
+ end
58
+ end