omf_rc_shm 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -51,7 +51,8 @@ Example:
51
51
  a.schedule = "*/5 * * * *"
52
52
  a.timeout = 20
53
53
  a.parameters = {
54
- udp_target_host: { cmd: "--udp-target", value: "0.0.0.0", mandatory: true }
54
+ udp_target_host: { cmd: "--udp-target", value: "0.0.0.0", mandatory: true },
55
+ udp_target_port: { cmd: "--udp-port", value: 5000, mandatory: true }
55
56
  }
56
57
  a.use_oml = true
57
58
  a.oml = {
@@ -61,9 +62,8 @@ Example:
61
62
  {
62
63
  url: "tcp:0.0.0.0:3003",
63
64
  streams: [
64
- {
65
- mp: "udp_in", samples: 1
66
- }
65
+ { mp: "udp_in", samples: 1 },
66
+ { mp: "udp_out", samples: 1 }
67
67
  ]
68
68
  }
69
69
  ]
@@ -73,7 +73,7 @@ Example:
73
73
  Where
74
74
 
75
75
  * `binary_path` is local path to the application's binary
76
- * `schedule` is the definition of the schedule to run the application on. It can be either the string 'now' (= run this application as soon as possible) or a cron-type formatted schedule (see [crontab manual](http://www.google.com/search?q=man+crontab))
76
+ * `schedule` is the definition of the schedule to run the application on. It can be either the string 'in X' which means that the application will be started X minutes after its definition has been processed; or a cron-type formatted schedule (see [crontab manual](http://www.google.com/search?q=man+crontab))
77
77
  * `timeout` the time in second after which the application should be stopped, set to 0 to let the application stop by itself
78
78
  * `parameters` the list of command line parameters that this application accepts, see the [OMF Documentation](https://github.com/mytestbed/omf/blob/master/doc/APPLICATION_PROXY.mkd#parameter-properties) for more detail
79
79
  * `use_oml` enable OML instrumentation
@@ -3,7 +3,8 @@ defApplication("my_app_name") do |a|
3
3
  a.schedule = "*/5 * * * *"
4
4
  a.timeout = 20
5
5
  a.parameters = {
6
- udp_target_host: { cmd: "--udp-target", value: "0.0.0.0", mandatory: true }
6
+ udp_target_host: { cmd: "--udp-target", value: "0.0.0.0", mandatory: true },
7
+ udp_target_port: { cmd: "--udp-port", value: 5000, mandatory: true }
7
8
  }
8
9
  a.use_oml = true
9
10
  a.oml = {
@@ -13,11 +14,10 @@ defApplication("my_app_name") do |a|
13
14
  {
14
15
  url: "tcp:0.0.0.0:3003",
15
16
  streams: [
16
- {
17
- mp: "udp_in", samples: 1
18
- }
17
+ { mp: "udp_in", samples: 1 },
18
+ { mp: "udp_out", samples: 1 }
19
19
  ]
20
20
  }
21
21
  ]
22
22
  }
23
- end
23
+ end
@@ -97,7 +97,7 @@ module OmfRc::ResourceProxy::ScheduledApplication
97
97
  property :oml, :default => Hashie::Mash.new
98
98
  property :oml_logfile, :default => nil
99
99
  property :oml_loglevel, :default => nil
100
- property :schedule, :default => 'now'
100
+ property :schedule, :default => 'in 2'
101
101
  property :timeout, :default => 0
102
102
  property :timeout_kill_signal, :default => 'TERM'
103
103
  property :file_change_listener, :default => nil
@@ -287,7 +287,7 @@ module OmfRc::ResourceProxy::ScheduledApplication
287
287
  if res.property.state == :scheduled
288
288
  info "Removing cron job for '#{res.property.app_id}'"
289
289
  CronEdit::Crontab.Remove res.property.app_id
290
- restart_cron = `/etc/init.d/cron restart` # Vixie Cron on Angstrom requires restart!
290
+ restart_cron = `/etc/init.d/cron restart &>/dev/null` # Vixie Cron on Angstrom requires restart!
291
291
  pid_file = "#{res.property.app_log_dir}/#{res.property.app_id}.pid.log"
292
292
  File.readlines(pid_file).each do |line|
293
293
  begin
@@ -316,9 +316,10 @@ module OmfRc::ResourceProxy::ScheduledApplication
316
316
  elsif res.property.schedule.nil?
317
317
  res.log_inform_warn "No schedule given!"
318
318
  else
319
- # "now" schedules job to run once, two minutes from now
320
- if res.property.schedule == "now"
321
- t = Time.now()+120
319
+ # "in X" schedules job to run once, X minutes from now
320
+ if res.property.schedule[0,3] == "in "
321
+ delay = res.property.schedule.split(' ')[1].to_i * 60
322
+ t = Time.now() + delay
322
323
  res.property.schedule = t.strftime("%-M %-H %-d %-m *")
323
324
  end
324
325
  Dir.mkdir(res.property.app_log_dir) if !Dir.exist?(res.property.app_log_dir)
@@ -337,7 +338,7 @@ module OmfRc::ResourceProxy::ScheduledApplication
337
338
  info "Adding cron job for '#{res.property.app_id}' with schedule '#{res.property.schedule}' and command '#{cmd}'"
338
339
 
339
340
  CronEdit::Crontab.Add res.property.app_id, "#{res.property.schedule} #{cmd}"
340
- restart_cron = `/etc/init.d/cron restart` # Vixie Cron on Angstrom requires restart!
341
+ restart_cron = `/etc/init.d/cron restart &>/dev/null` # Vixie Cron on Angstrom requires restart!
341
342
  res.property.file_change_callback = Proc.new do |modified, added, removed|
342
343
  removed.each do |file|
343
344
  res.property.file_read_offset[file]=nil
@@ -17,8 +17,9 @@ module OmfRc::ResourceProxy::ShmNode
17
17
  hook :after_initial_configured do |node|
18
18
  OmfRcShm.app.load_definition(node.request_app_definition_file)
19
19
 
20
+ info "Using app definition from '#{node.request_app_definition_file}'"
20
21
  OmfRcShm.app.definitions.each do |name, app_opts|
21
- info "Got definition #{app_opts.inspect}, now schedule them..."
22
+ info "Got definition #{app_opts.inspect}, now schedule it..."
22
23
  opts = app_opts.properties.merge(hrn: name, ruby_path: node.property.ruby_path, parent_id: node.uid)
23
24
  s_app = OmfRc::ResourceFactory.create(:scheduled_application, opts)
24
25
  OmfCommon.el.after(5) do
@@ -1,3 +1,3 @@
1
1
  module OmfRcShm
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
@@ -23,7 +23,7 @@ def run_test(app)
23
23
  # oml_configfile: "/some/file",
24
24
  timeout: 3,
25
25
  # use_oml: true,
26
- schedule: "* * * * *") # or use "now"
26
+ schedule: "* * * * *") # or use "in 1"
27
27
 
28
28
  # Start the application 2 seconds later
29
29
  OmfCommon.eventloop.after 1 do
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omf_rc_shm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - NICTA
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-10-02 00:00:00.000000000 Z
12
+ date: 2013-10-04 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: rake
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ! '>='
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ! '>='
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: omf_rc
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ~>
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ~>
53
60
  - !ruby/object:Gem::Version
@@ -55,6 +62,7 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: json-jwt
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - ! '>='
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - ! '>='
67
76
  - !ruby/object:Gem::Version
@@ -69,6 +78,7 @@ dependencies:
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: cronedit
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
83
  - - ! '>='
74
84
  - !ruby/object:Gem::Version
@@ -76,6 +86,7 @@ dependencies:
76
86
  type: :runtime
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
91
  - - ! '>='
81
92
  - !ruby/object:Gem::Version
@@ -83,6 +94,7 @@ dependencies:
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: listen
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
99
  - - ! '>='
88
100
  - !ruby/object:Gem::Version
@@ -90,6 +102,7 @@ dependencies:
90
102
  type: :runtime
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
107
  - - ! '>='
95
108
  - !ruby/object:Gem::Version
@@ -123,27 +136,29 @@ files:
123
136
  homepage: ''
124
137
  licenses:
125
138
  - MIT
126
- metadata: {}
127
139
  post_install_message:
128
140
  rdoc_options: []
129
141
  require_paths:
130
142
  - lib
131
143
  required_ruby_version: !ruby/object:Gem::Requirement
144
+ none: false
132
145
  requirements:
133
146
  - - ! '>='
134
147
  - !ruby/object:Gem::Version
135
148
  version: '0'
136
149
  required_rubygems_version: !ruby/object:Gem::Requirement
150
+ none: false
137
151
  requirements:
138
152
  - - ! '>='
139
153
  - !ruby/object:Gem::Version
140
154
  version: '0'
141
155
  requirements: []
142
156
  rubyforge_project:
143
- rubygems_version: 2.0.7
157
+ rubygems_version: 1.8.24
144
158
  signing_key:
145
- specification_version: 4
159
+ specification_version: 3
146
160
  summary: OMF resource proxy extension for SHM project
147
161
  test_files:
148
162
  - test/scheduled_app_controller.rb
149
163
  - test/scheduled_app_tester.rb
164
+ has_rdoc:
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MmNiYWI3NTM2N2I0ZGRiMDNhZDc2MTY2ODM2MzM5ZTQ0YjgxMDBlMA==
5
- data.tar.gz: !binary |-
6
- MWMzN2M1OWQyNzJlOGE3NGNmNDVhMWI1YWE5NWM1NGU4YmU4MWM3Ng==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- ZmY2ZjdhZjhmNTVlNTg0Y2QzMzVjZTFiMGY3NDBmODY3MTk3N2Y4NzNjMjU4
10
- ZWMwZmIxYTQzZjU4ODkyNTI4OGZmZmZlMGJhMmFiNDJiZjMxYWE2MDMwMDBj
11
- YmUxYWU0M2E3OGFhZTQ3MjM4ZDgyODBmNjc1ZWNhZjVkMDFhNDQ=
12
- data.tar.gz: !binary |-
13
- MWQ4NjJhYzU5ODBjNDE4MWVkNjQ1NDRlNmM2NDBjMDdlNDM0NDlhOTY1YTQ1
14
- OTFhYTg3YWZmODYwNDIxYmI5NWQ4OTNkZjZiNmNhOTljNmRjM2Q5MDk3ODRk
15
- ZTM3OGE2YzYzMWIxN2M2OTMyMjk3Yjg4YTlkNDhlMmY0MDJmMWI=