omf_rc_shm 0.1.14 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDIzMzIwYTcxNjEwNzRmNmY5YWYzMGI1OTI3ZjhjY2Y4NWU1ZTIzOA==
4
+ YTJmMDM5Mjk2NjQ0YmYxNDViNjliYjA0OTA4MDc4OTZkNDRkMTFlZg==
5
5
  data.tar.gz: !binary |-
6
- NzAwNzljZTBkMjhmZmU0ZjM1MzMxMzVjNjdhMjRmYzE2MTdkZWMxNw==
6
+ ZjMxN2E3YmJlY2UwZDhiYjc3Y2IxMTNhYTkyNTNkMDQ2ODQyMjdlNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDM3N2JkZTBkZjBlMWM3NmQwMDM5ZWM5NTIzMjY0YjRmMjNmNDc4ODI0N2Nm
10
- NDg5MmUzZmYwYTg1NDdhN2U0ODFlZmIyMWFkYThmZTQwMTZjYTIxYTgwYTZh
11
- MmIwNTgyOThiZGQyZDgzMzI2ZGVkNmRjZjZmMWI1YWZmMDE2OWY=
9
+ NWFhMmVhMTJkZjBjODY4YmFkZWMzMTQ0ZDI1NTg1NTQxODYzMGI3NTVjMmRh
10
+ ODBjODQxMzlkMWI4OTI0MTRkMGEyMTRhNjI4YTNhNGE5NGUyN2VmODY0MDk3
11
+ Yjc0ODc1ZGZkNDI5Yjk2NTQ4ZDI5NTUyNjhlYzU3MWRkZDhjNjg=
12
12
  data.tar.gz: !binary |-
13
- YjI3MTc0ZjBiOGI3OTA1ZGViNmYyODVkNGI1OTA2YzY2YWNhM2QyMjViODE0
14
- MWI1ZjFiOGE4MGZiOTY3MWZhYTk3OGYzMmVjOGY2MWQwZTQ1YWQ1YTdjZmFm
15
- YzA1NmE5YmQ5YmQ4ZmZjMWRjZTkyOTk0MjZlN2E3Y2UwY2Q2MmI=
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
- File.readlines(pid_file).each do |line|
293
- begin
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
- res.property.schedule = t.strftime("%-M %-H %-d %-m *")
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 '#{res.property.schedule}' and command '#{cmd}'"
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, "#{res.property.schedule} #{cmd}"
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 "Using app definition from '#{node.request_app_definition_file}'"
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, parent_id: node.uid)
24
- s_app = OmfRc::ResourceFactory.create(:scheduled_application, opts)
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
@@ -8,6 +8,9 @@ class App
8
8
  info "Adding new definition #{name}"
9
9
  block.call(app_def) if block
10
10
  end
11
+ def defDefaultGroup(name)
12
+ OmfRcShm.app.default_groups << name
13
+ end
11
14
  end
12
15
  end
13
16
  end
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module OmfRcShm
2
- VERSION = "0.1.14"
2
+ VERSION = "0.1.15"
3
3
  end
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.0.5"
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.14
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-02-27 00:00:00.000000000 Z
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.0.5
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.0.5
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: