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
data/Gemfile
CHANGED
@@ -1,23 +1,4 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
source "http://rubygems.org"
|
3
3
|
|
4
|
-
|
5
|
-
# Example:
|
6
|
-
# gem "activesupport", ">= 2.3.5"
|
7
|
-
|
8
|
-
gem "tengine_support", "~> 0.3.27"
|
9
|
-
gem "tengine_core", "~> 0.5.39"
|
10
|
-
gem "tengine_resource", "~> 0.5.15"
|
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.1.3"
|
19
|
-
gem "jeweler", "~> 1.6.4"
|
20
|
-
# gem "rcov", ">= 0"
|
21
|
-
gem "simplecov", "~> 0.5.3"
|
22
|
-
gem "ZenTest", "~> 4.6.2"
|
23
|
-
end
|
4
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,20 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
tengine_job (1.1.0)
|
5
|
+
tengine_core (~> 1.1.0)
|
6
|
+
tengine_resource (~> 1.1.0)
|
7
|
+
tengine_support (~> 1.1.0)
|
8
|
+
|
1
9
|
GEM
|
2
10
|
remote: http://rubygems.org/
|
3
11
|
specs:
|
4
|
-
ZenTest (4.
|
5
|
-
activemodel (3.
|
6
|
-
activesupport (= 3.
|
12
|
+
ZenTest (4.8.2)
|
13
|
+
activemodel (3.2.8)
|
14
|
+
activesupport (= 3.2.8)
|
7
15
|
builder (~> 3.0.0)
|
16
|
+
activesupport (3.2.8)
|
8
17
|
i18n (~> 0.6)
|
9
|
-
activesupport (3.1.4)
|
10
18
|
multi_json (~> 1.0)
|
11
19
|
amq-client (0.8.7)
|
12
20
|
amq-protocol (>= 0.8.4)
|
@@ -16,94 +24,84 @@ GEM
|
|
16
24
|
amq-client (~> 0.8.7)
|
17
25
|
amq-protocol (~> 0.8.4)
|
18
26
|
eventmachine
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
daemons (1.1.8)
|
27
|
+
autotest (4.4.6)
|
28
|
+
ZenTest (>= 4.4.1)
|
29
|
+
builder (3.0.4)
|
30
|
+
daemons (1.1.9)
|
24
31
|
diff-lcs (1.1.3)
|
25
|
-
eventmachine (0.
|
26
|
-
factory_girl (
|
27
|
-
activesupport
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
macaddr (1.5.0)
|
36
|
-
systemu (>= 2.4.0)
|
37
|
-
mongo (1.5.2)
|
38
|
-
bson (= 1.5.2)
|
39
|
-
mongoid (2.3.5)
|
40
|
-
activemodel (~> 3.1.0)
|
41
|
-
mongo (~> 1.3)
|
32
|
+
eventmachine (1.0.0)
|
33
|
+
factory_girl (3.3.0)
|
34
|
+
activesupport (>= 3.0.0)
|
35
|
+
i18n (0.6.1)
|
36
|
+
macaddr (1.6.1)
|
37
|
+
systemu (~> 2.5.0)
|
38
|
+
mongoid (3.0.15)
|
39
|
+
activemodel (~> 3.1)
|
40
|
+
moped (~> 1.1)
|
41
|
+
origin (~> 1.0)
|
42
42
|
tzinfo (~> 0.3.22)
|
43
|
-
|
44
|
-
|
43
|
+
moped (1.3.1)
|
44
|
+
multi_json (1.3.6)
|
45
|
+
net-ssh (2.5.2)
|
46
|
+
origin (1.0.11)
|
45
47
|
rake (0.9.2.2)
|
48
|
+
rdiscount (1.6.8)
|
46
49
|
right_aws (2.1.0)
|
47
50
|
right_http_connection (>= 1.2.5)
|
48
51
|
right_http_connection (1.3.0)
|
49
|
-
rspec (2.
|
50
|
-
rspec-core (~> 2.
|
51
|
-
rspec-expectations (~> 2.
|
52
|
-
rspec-mocks (~> 2.
|
53
|
-
rspec-core (2.
|
54
|
-
rspec-expectations (2.
|
55
|
-
diff-lcs (~> 1.1.
|
56
|
-
rspec-mocks (2.
|
57
|
-
selectable_attr (0.3.
|
52
|
+
rspec (2.10.0)
|
53
|
+
rspec-core (~> 2.10.0)
|
54
|
+
rspec-expectations (~> 2.10.0)
|
55
|
+
rspec-mocks (~> 2.10.0)
|
56
|
+
rspec-core (2.10.1)
|
57
|
+
rspec-expectations (2.10.0)
|
58
|
+
diff-lcs (~> 1.1.3)
|
59
|
+
rspec-mocks (2.10.1)
|
60
|
+
selectable_attr (0.3.17)
|
58
61
|
i18n
|
59
|
-
simplecov (0.
|
60
|
-
multi_json (~> 1.0
|
62
|
+
simplecov (0.6.4)
|
63
|
+
multi_json (~> 1.0)
|
61
64
|
simplecov-html (~> 0.5.3)
|
62
65
|
simplecov-html (0.5.3)
|
63
|
-
systemu (2.5.
|
64
|
-
tengine_core (
|
65
|
-
activemodel (
|
66
|
-
activesupport (
|
67
|
-
bson (~> 1.5.2)
|
68
|
-
bson_ext (~> 1.5.2)
|
66
|
+
systemu (2.5.2)
|
67
|
+
tengine_core (1.1.0)
|
68
|
+
activemodel (>= 3.1.0)
|
69
|
+
activesupport (>= 3.1.0)
|
69
70
|
daemons (~> 1.1.4)
|
70
|
-
|
71
|
-
mongoid (~> 2.3.3)
|
71
|
+
mongoid (~> 3.0.0)
|
72
72
|
selectable_attr (~> 0.3.15)
|
73
|
-
tengine_event (~>
|
74
|
-
tengine_support (~>
|
75
|
-
tengine_event (
|
73
|
+
tengine_event (~> 1.1.0)
|
74
|
+
tengine_support (~> 1.1.0)
|
75
|
+
tengine_event (1.1.0)
|
76
76
|
activesupport (>= 3.0.0)
|
77
77
|
amqp (~> 0.8.0)
|
78
|
-
tengine_support (
|
78
|
+
tengine_support (~> 1.1.0)
|
79
79
|
uuid (~> 2.3.4)
|
80
|
-
tengine_resource (
|
81
|
-
net-ssh (~> 2.2
|
80
|
+
tengine_resource (1.1.0)
|
81
|
+
net-ssh (~> 2.5.2)
|
82
|
+
tengine_core (~> 1.1.0)
|
83
|
+
tengine_support (~> 1.1.0)
|
84
|
+
tengine_resource_ec2 (1.1.0)
|
82
85
|
right_aws (~> 2.1.0)
|
83
|
-
|
84
|
-
|
85
|
-
wakame-adapters-tengine (~> 0.0.0)
|
86
|
-
tengine_support (0.3.27)
|
86
|
+
tengine_resource (~> 1.1.0)
|
87
|
+
tengine_support (1.1.0)
|
87
88
|
activesupport (>= 3.0.0)
|
88
|
-
tzinfo (0.3.
|
89
|
+
tzinfo (0.3.35)
|
89
90
|
uuid (2.3.5)
|
90
91
|
macaddr (~> 1.0)
|
91
|
-
|
92
|
-
json
|
93
|
-
right_aws (~> 2.1.0)
|
94
|
-
yard (0.7.5)
|
92
|
+
yard (0.8.2.1)
|
95
93
|
|
96
94
|
PLATFORMS
|
97
95
|
ruby
|
98
96
|
|
99
97
|
DEPENDENCIES
|
100
|
-
|
101
|
-
bundler
|
102
|
-
factory_girl (~>
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
yard (~> 0.
|
98
|
+
autotest
|
99
|
+
bundler
|
100
|
+
factory_girl (~> 3.3.0)
|
101
|
+
rake (~> 0.9.2.2)
|
102
|
+
rdiscount
|
103
|
+
rspec (~> 2.10.0)
|
104
|
+
simplecov (~> 0.6.4)
|
105
|
+
tengine_job!
|
106
|
+
tengine_resource_ec2 (~> 1.1.0)
|
107
|
+
yard (~> 0.8.1)
|
data/README.rdoc
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Description goes here.
|
4
4
|
|
5
5
|
== Contributing to tengine_job
|
6
|
-
|
6
|
+
|
7
7
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
8
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
9
|
* Fork the project
|
@@ -13,7 +13,7 @@ Description goes here.
|
|
13
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
14
|
|
15
15
|
== License
|
16
|
-
|
16
|
+
tengine_job is distributed under the MPL2.0 or LGPLv3 or the dual license of MPL2.0/LGPLv3
|
17
17
|
|
18
18
|
== Copyright
|
19
19
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
# Use to create indexes. Sample is below.
|
5
|
+
# create_indexes_for_tengine_job localhost:27017/tengine_production
|
6
|
+
#
|
7
|
+
# Default options
|
8
|
+
# hostname localhost
|
9
|
+
# port 27017
|
10
|
+
# database tengine_production
|
11
|
+
#
|
12
|
+
require 'tengine_support'
|
13
|
+
require 'tengine_job'
|
14
|
+
|
15
|
+
include Tengine::Support::Mongoid
|
16
|
+
|
17
|
+
target = File.expand_path('../lib', File.dirname(__FILE__))
|
18
|
+
Tengine::Support::Mongoid.create_indexes(target, ARGV.shift)
|
@@ -23,18 +23,18 @@ module Tengine::Job::Connectable
|
|
23
23
|
def actual_credential
|
24
24
|
key = actual_credential_name
|
25
25
|
return nil if key.blank?
|
26
|
-
result = Tengine::Resource::Credential.
|
26
|
+
result = Tengine::Resource::Credential.where({:name => key}).first
|
27
27
|
# TODO 使用する例外クラスはこれで良いのか検討
|
28
|
-
raise Mongoid::Errors::DocumentNotFound.new(Tengine::Resource::Credential, key) unless result
|
28
|
+
raise Mongoid::Errors::DocumentNotFound.new(Tengine::Resource::Credential, key, []) unless result
|
29
29
|
result
|
30
30
|
end
|
31
31
|
|
32
32
|
def actual_server
|
33
33
|
key = actual_server_name
|
34
34
|
return nil if key.blank?
|
35
|
-
result = Tengine::Resource::Server.
|
35
|
+
result = Tengine::Resource::Server.where({:name => key}).first
|
36
36
|
# TODO 使用する例外クラスはこれで良いのか検討
|
37
|
-
raise Mongoid::Errors::DocumentNotFound.new(Tengine::Resource::Server, key) unless result
|
37
|
+
raise Mongoid::Errors::DocumentNotFound.new(Tengine::Resource::Server, key, []) unless result
|
38
38
|
result
|
39
39
|
end
|
40
40
|
|
@@ -15,7 +15,7 @@ driver :job_execution_driver do
|
|
15
15
|
signal.reset
|
16
16
|
execution.transmit(signal)
|
17
17
|
end
|
18
|
-
execution.
|
18
|
+
execution.with(safe: safemode(Tengine::Job::Execution.collection)).save!
|
19
19
|
signal.reservations.each{|r| fire(*r.fire_args)}
|
20
20
|
submit
|
21
21
|
end
|
@@ -41,7 +41,7 @@ driver :job_execution_driver do
|
|
41
41
|
signal.reset
|
42
42
|
execution.stop(signal)
|
43
43
|
end
|
44
|
-
execution.
|
44
|
+
execution.with(safe: safemode(Tengine::Job::Execution.collection)).save!
|
45
45
|
signal.reservations.each{|r| fire(*r.fire_args)}
|
46
46
|
submit
|
47
47
|
end
|
@@ -26,7 +26,7 @@ driver :jobnet_control_driver do
|
|
26
26
|
target_jobnet.activate(signal)
|
27
27
|
end
|
28
28
|
end
|
29
|
-
signal.execution.
|
29
|
+
signal.execution.with(safe: safemode(Tengine::Job::Execution.collection)).save! if event[:root_jobnet_id] == event[:target_jobnet_id]
|
30
30
|
signal.reservations.each{|r| fire(*r.fire_args)}
|
31
31
|
submit
|
32
32
|
end
|
@@ -151,7 +151,7 @@ driver :jobnet_control_driver do
|
|
151
151
|
end
|
152
152
|
end
|
153
153
|
end
|
154
|
-
signal.execution.
|
154
|
+
signal.execution.with(sage: safemode(Tengine::Job::Execution.collection)).save! if event[:root_jobnet_id] == event[:target_jobnet_id]
|
155
155
|
signal.reservations.each{|r| fire(*r.fire_args)}
|
156
156
|
submit
|
157
157
|
end
|
@@ -196,7 +196,7 @@ driver :jobnet_control_driver do
|
|
196
196
|
# target_parent.end_vertex.transmit(signal)
|
197
197
|
# end
|
198
198
|
end
|
199
|
-
signal.execution.
|
199
|
+
signal.execution.with(safe: safemode(Tengine::Job::Execution.collection)).save! if event[:root_jobnet_id] == event[:target_jobnet_id]
|
200
200
|
signal.reservations.each{|r| fire(*r.fire_args)}
|
201
201
|
submit
|
202
202
|
end
|
@@ -10,16 +10,16 @@ driver :schedule_driver do
|
|
10
10
|
status = Tengine::Core::Schedule::SCHEDULED
|
11
11
|
if exec.actual_base_timeout_alert && !exec.actual_base_timeout_alert.zero?
|
12
12
|
t1 = Time.now + (exec.actual_base_timeout_alert * 60.0)
|
13
|
-
Tengine::Core::Schedule.
|
14
|
-
safemode(Tengine::Core::Schedule.collection)
|
13
|
+
Tengine::Core::Schedule.with(
|
14
|
+
safe: safemode(Tengine::Core::Schedule.collection)
|
15
15
|
).create(
|
16
16
|
event_type_name: "alert.execution.job.tengine", scheduled_at: t1, source_name: name, status: status , properties: event.properties
|
17
17
|
)
|
18
18
|
end
|
19
19
|
if exec.actual_base_timeout_termination && !exec.actual_base_timeout_termination.zero?
|
20
20
|
t2 = Time.now + (exec.actual_base_timeout_termination * 60.0)
|
21
|
-
Tengine::Core::Schedule.
|
22
|
-
safemode(Tengine::Core::Schedule.collection)
|
21
|
+
Tengine::Core::Schedule.with(
|
22
|
+
safe: safemode(Tengine::Core::Schedule.collection)
|
23
23
|
).create(
|
24
24
|
event_type_name: "stop.execution.job.tengine", scheduled_at: t2, source_name: name, status: status, properties: event.properties.merge(stop_reason: 'timeout')
|
25
25
|
)
|
@@ -40,16 +40,16 @@ driver :schedule_driver do
|
|
40
40
|
status = Tengine::Core::Schedule::SCHEDULED
|
41
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
42
|
t1 = Time.now + (exec.actual_base_timeout_alert * 60.0)
|
43
|
-
Tengine::Core::Schedule.
|
44
|
-
safemode(Tengine::Core::Schedule.collection)
|
43
|
+
Tengine::Core::Schedule.with(
|
44
|
+
safe: safemode(Tengine::Core::Schedule.collection)
|
45
45
|
).create(
|
46
46
|
event_type_name: "alert.execution.job.tengine", scheduled_at: t1, source_name: name, status: status , properties: orig.properties
|
47
47
|
)
|
48
48
|
end
|
49
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
50
|
t2 = Time.now + (exec.actual_base_timeout_termination * 60.0)
|
51
|
-
Tengine::Core::Schedule.
|
52
|
-
safemode(Tengine::Core::Schedule.collection)
|
51
|
+
Tengine::Core::Schedule.with(
|
52
|
+
safe: safemode(Tengine::Core::Schedule.collection)
|
53
53
|
).create(
|
54
54
|
event_type_name: "stop.execution.job.tengine", scheduled_at: t2, source_name: name, status: status, properties: orig.properties.merge(stop_reason: 'timeout')
|
55
55
|
)
|
@@ -59,8 +59,8 @@ driver :schedule_driver do
|
|
59
59
|
|
60
60
|
on :'success.execution.job.tengine' do
|
61
61
|
name = Tengine::Job::Signal.new(event).execution.name_as_resource
|
62
|
-
Tengine::Core::Schedule.
|
63
|
-
safemode(Tengine::Core::Schedule.collection)
|
62
|
+
Tengine::Core::Schedule.with(
|
63
|
+
safe: safemode(Tengine::Core::Schedule.collection)
|
64
64
|
).where(
|
65
65
|
source_name: name, status: Tengine::Core::Schedule::SCHEDULED
|
66
66
|
).update_all(status: Tengine::Core::Schedule::INVALID)
|
@@ -69,8 +69,8 @@ driver :schedule_driver do
|
|
69
69
|
|
70
70
|
on :'error.execution.job.tengine' do
|
71
71
|
name = Tengine::Job::Signal.new(event).execution.name_as_resource
|
72
|
-
Tengine::Core::Schedule.
|
73
|
-
safemode(Tengine::Core::Schedule.collection)
|
72
|
+
Tengine::Core::Schedule.with(
|
73
|
+
safe: safemode(Tengine::Core::Schedule.collection)
|
74
74
|
).where(
|
75
75
|
source_name: name, status: Tengine::Core::Schedule::SCHEDULED
|
76
76
|
).update_all(status: Tengine::Core::Schedule::INVALID)
|
data/lib/tengine/job/edge.rb
CHANGED
@@ -16,8 +16,8 @@ class Tengine::Job::Edge
|
|
16
16
|
embedded_in :owner, :class_name => "Tengine::Job::Jobnet", :inverse_of => :edges
|
17
17
|
|
18
18
|
field :phase_cd , :type => Integer, :default => 0 # ステータス。とりうる値は後述を参照してください。詳しくはtengine_jobパッケージ設計書の「edge状態遷移」を参照してください。
|
19
|
-
field :origin_id , :type => BSON::ObjectId # 辺の遷移元となるvertexのid
|
20
|
-
field :destination_id, :type => BSON::ObjectId # 辺の遷移先となるvertexのid
|
19
|
+
field :origin_id , :type => Moped::BSON::ObjectId # 辺の遷移元となるvertexのid
|
20
|
+
field :destination_id, :type => Moped::BSON::ObjectId # 辺の遷移先となるvertexのid
|
21
21
|
|
22
22
|
validates :origin_id, :presence => true
|
23
23
|
validates :destination_id, :presence => true
|
@@ -9,7 +9,7 @@ class Tengine::Job::Expansion < Tengine::Job::Job
|
|
9
9
|
def root_jobnet_template
|
10
10
|
unless @root_jobnet_template
|
11
11
|
cond = {:dsl_version => root.dsl_version, :name => name}
|
12
|
-
@root_jobnet_template = Tengine::Job::RootJobnetTemplate.
|
12
|
+
@root_jobnet_template = Tengine::Job::RootJobnetTemplate.where(cond).first
|
13
13
|
end
|
14
14
|
@root_jobnet_template
|
15
15
|
end
|
data/lib/tengine/job/jobnet.rb
CHANGED
@@ -30,11 +30,21 @@ class Tengine::Job::Jobnet < Tengine::Job::Job
|
|
30
30
|
end
|
31
31
|
def chained_box?; jobnet_type_entry[:chained_box]; end
|
32
32
|
|
33
|
-
embeds_many :edges, :class_name => "Tengine::Job::Edge", :inverse_of => :owner
|
33
|
+
embeds_many :edges, :class_name => "Tengine::Job::Edge", :inverse_of => :owner , :validate => false
|
34
|
+
|
35
|
+
before_validation do |r|
|
36
|
+
r.edges.each do |edge|
|
37
|
+
unless edge.valid?
|
38
|
+
edge.errors.each do |f, error|
|
39
|
+
r.errors.add(:base, "#{edge.name_for_message} #{f.to_s.humanize} #{error}")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
34
44
|
|
35
45
|
class << self
|
36
46
|
def by_name(name)
|
37
|
-
|
47
|
+
where({:name => name}).first
|
38
48
|
end
|
39
49
|
end
|
40
50
|
|
@@ -52,4 +52,33 @@ class Tengine::Job::JobnetActual < Tengine::Job::Jobnet
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
+
def fire_stop_event(root_jobnet, options = Hash.new)
|
56
|
+
root_jobnet_id = root_jobnet.id.to_s
|
57
|
+
result = Tengine::Job::Execution.create!(
|
58
|
+
options.merge(:root_jobnet_id => root_jobnet_id))
|
59
|
+
properties = {
|
60
|
+
:execution_id => result.id.to_s,
|
61
|
+
:root_jobnet_id => root_jobnet_id,
|
62
|
+
:stop_reason => "user_stop"
|
63
|
+
}
|
64
|
+
|
65
|
+
target_id = self.id.to_s
|
66
|
+
# if target.children.blank?
|
67
|
+
if script_executable?
|
68
|
+
event = :"stop.job.job.tengine"
|
69
|
+
properties[:target_job_id] = target_id
|
70
|
+
properties[:target_jobnet_id] = parent.id.to_s
|
71
|
+
else
|
72
|
+
event = :"stop.jobnet.job.tengine"
|
73
|
+
properties[:target_jobnet_id] = target_id
|
74
|
+
end
|
75
|
+
|
76
|
+
EM.run do
|
77
|
+
Tengine::Event.fire(event,
|
78
|
+
:source_name => name_as_resource,
|
79
|
+
:properties => properties)
|
80
|
+
end
|
81
|
+
|
82
|
+
return result
|
83
|
+
end
|
55
84
|
end
|