omf_rc_shm 0.1.14 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTJmMDM5Mjk2NjQ0YmYxNDViNjliYjA0OTA4MDc4OTZkNDRkMTFlZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjMxN2E3YmJlY2UwZDhiYjc3Y2IxMTNhYTkyNTNkMDQ2ODQyMjdlNA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWFhMmVhMTJkZjBjODY4YmFkZWMzMTQ0ZDI1NTg1NTQxODYzMGI3NTVjMmRh
|
10
|
+
ODBjODQxMzlkMWI4OTI0MTRkMGEyMTRhNjI4YTNhNGE5NGUyN2VmODY0MDk3
|
11
|
+
Yjc0ODc1ZGZkNDI5Yjk2NTQ4ZDI5NTUyNjhlYzU3MWRkZDhjNjg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTk3MDg3MDcyN2RmM2Q1N2M3OGEyZDdhMjNjMjg5YjY1ZWNjYzcyMzcwZGJh
|
14
|
+
ZGMxZGYxODRlNzMzYzg1NjZjNDA0ZWM4M2ZmMjI2Y2I4ZTdhYTk3YTIzODhh
|
15
|
+
NWRjNGM1ZTFlNDhmMzU5YjA4ZTJkMjViNjFhNzE5OTJhMzkxZDM=
|
@@ -288,13 +288,14 @@ module OmfRc::ResourceProxy::ScheduledApplication
|
|
288
288
|
info "Removing cron job for '#{res.property.app_id}'"
|
289
289
|
CronEdit::Crontab.Remove res.property.app_id
|
290
290
|
restart_cron = `/etc/init.d/cron restart &>/dev/null` # Vixie Cron on Angstrom requires restart!
|
291
|
-
pid_file = "#{res.property.app_log_dir}/#{res.property.app_id}.pid.log"
|
292
|
-
|
293
|
-
|
291
|
+
pid_file = "#{res.property.app_log_dir}/#{res.property.app_id}.#{res.uid}.pid.log"
|
292
|
+
begin
|
293
|
+
File.readlines(pid_file).each do |line|
|
294
294
|
Process.kill(res.property.timeout_kill_signal, line.to_i)
|
295
295
|
info "Killing process #{line.to_i}"
|
296
|
-
rescue Errno::ESRCH
|
297
296
|
end
|
297
|
+
rescue Exception => e
|
298
|
+
warn "Could not kill scheduled app #{res.property.app_id}.#{res.uid}"
|
298
299
|
end
|
299
300
|
res.property.file_change_listener.stop
|
300
301
|
res.property.state = :unscheduled
|
@@ -320,7 +321,9 @@ module OmfRc::ResourceProxy::ScheduledApplication
|
|
320
321
|
if res.property.schedule[0,3] == "in "
|
321
322
|
delay = res.property.schedule.split(' ')[1].to_i * 60
|
322
323
|
t = Time.now() + delay
|
323
|
-
|
324
|
+
cron_schedule = t.strftime("%-M %-H %-d %-m *")
|
325
|
+
else
|
326
|
+
cron_schedule = res.property.schedule
|
324
327
|
end
|
325
328
|
Dir.mkdir(res.property.app_log_dir) if !Dir.exist?(res.property.app_log_dir)
|
326
329
|
stderr_file = "#{res.property.app_log_dir}/#{res.property.app_id}.#{res.uid}.err.log"
|
@@ -335,9 +338,9 @@ module OmfRc::ResourceProxy::ScheduledApplication
|
|
335
338
|
cmd = "#{app_wrapper_path} #{stdout_file} #{stderr_file} #{pid_file} #{res.property.timeout} #{res.property.timeout_kill_signal} #{res.build_command_line}"
|
336
339
|
cmd = "#{res.property.ruby_path} #{cmd}" if res.property.ruby_path
|
337
340
|
|
338
|
-
info "Adding cron job for '#{res.property.app_id}' with schedule '#{
|
341
|
+
info "Adding cron job for '#{res.property.app_id}' with schedule '#{cron_schedule}' and command '#{cmd}'"
|
339
342
|
|
340
|
-
CronEdit::Crontab.Add res.property.app_id, "#{
|
343
|
+
CronEdit::Crontab.Add res.property.app_id, "#{cron_schedule} #{cmd}"
|
341
344
|
restart_cron = `/etc/init.d/cron restart &>/dev/null` # Vixie Cron on Angstrom requires restart!
|
342
345
|
res.property.file_change_callback = Proc.new do |modified, added, removed|
|
343
346
|
removed.each do |file|
|
@@ -17,11 +17,13 @@ module OmfRc::ResourceProxy::ShmNode
|
|
17
17
|
hook :after_initial_configured do |node|
|
18
18
|
unless node.request_app_definition_file.nil?
|
19
19
|
OmfRcShm.app.load_definition(node.request_app_definition_file)
|
20
|
-
info "
|
20
|
+
info "Loaded scheduled app definition from '#{node.request_app_definition_file}'"
|
21
|
+
info "Setting default membership to '#{OmfRcShm.app.default_groups}'"
|
21
22
|
OmfRcShm.app.definitions.each do |name, app_opts|
|
22
23
|
info "Got definition #{app_opts.inspect}, now schedule it..."
|
23
|
-
opts = app_opts.properties.merge(hrn: name, ruby_path: node.property.ruby_path,
|
24
|
-
|
24
|
+
opts = app_opts.properties.merge(hrn: name, ruby_path: node.property.ruby_path,
|
25
|
+
parent_id: node.uid, membership: OmfRcShm.app.default_groups)
|
26
|
+
s_app = node.create(:scheduled_application, opts)
|
25
27
|
OmfCommon.el.after(5) { s_app.configure_state(:scheduled) }
|
26
28
|
end
|
27
29
|
end
|
data/lib/omf_rc_shm/app/dsl.rb
CHANGED
data/lib/omf_rc_shm/app.rb
CHANGED
@@ -9,12 +9,14 @@ module OmfRcShm
|
|
9
9
|
|
10
10
|
attr_accessor :definitions
|
11
11
|
attr_accessor :watchdog
|
12
|
+
attr_accessor :default_groups
|
12
13
|
|
13
14
|
|
14
15
|
def initialize
|
15
16
|
super
|
16
17
|
@definitions ||= Hash.new
|
17
18
|
@watchdog = nil
|
19
|
+
@default_groups = []
|
18
20
|
end
|
19
21
|
|
20
22
|
def load_definition(file_path)
|
data/lib/omf_rc_shm/version.rb
CHANGED
data/omf_rc_shm.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.add_development_dependency "bundler", "~> 1.3"
|
21
21
|
spec.add_development_dependency "rake"
|
22
|
-
spec.add_runtime_dependency "omf_rc", "~> 6.
|
22
|
+
spec.add_runtime_dependency "omf_rc" , "~> 6.1"
|
23
23
|
spec.add_runtime_dependency "json-jwt"
|
24
24
|
spec.add_runtime_dependency "cronedit"
|
25
25
|
spec.add_runtime_dependency "listen", "~> 1.3.1"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omf_rc_shm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NICTA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 6.
|
47
|
+
version: '6.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 6.
|
54
|
+
version: '6.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: json-jwt
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,4 +147,3 @@ summary: OMF resource proxy extension for SHM project
|
|
147
147
|
test_files:
|
148
148
|
- test/scheduled_app_controller.rb
|
149
149
|
- test/scheduled_app_tester.rb
|
150
|
-
has_rdoc:
|