robot-controller 0.3.6 → 0.3.7
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 +4 -4
- data/VERSION +1 -1
- data/lib/robot-controller/bluepill.rb +55 -52
- data/lib/robot-controller/tasks.rb +1 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 803c5e4fa8d9c371645a0f74b54c2a5b65af9e40
|
4
|
+
data.tar.gz: 4f07045008301e932fba0f15fa01a1a265bbb876
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55669aa02a47f94fa2799e3207f7fb4f92a0e4e09a089b7fe21d9d39d0d597252b2c2676005ebca157325ab7d1331a1ed5d22dd21969ebbf2086b8b8e70b7002
|
7
|
+
data.tar.gz: 6d89ff076d45d76d4c675a90fc7ec62d279e91f75ad706a93f8c46e921f4a67f2396bb48fc797a516798819d7f218987acf9cdcc29e30d6551753b570636f204
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.7
|
@@ -15,69 +15,72 @@ Bluepill.application File.basename(File.dirname(File.dirname(WORKDIR))),
|
|
15
15
|
:log_file => "#{WORKDIR}/log/bluepill.log" do |app|
|
16
16
|
app.working_dir = WORKDIR
|
17
17
|
ROBOTS.each_index do |i|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
ROBOTS[i][:n].to_i.times do |j|
|
19
|
+
# prefix process name with index number to prevent duplicate process names
|
20
|
+
prefix = sprintf("robot%02d_%02d", i+1, j+1)
|
21
|
+
app.process("#{prefix}_#{ROBOTS[i][:robot]}") do |process|
|
22
|
+
puts "Creating robot #{process.name}"
|
22
23
|
|
23
|
-
|
24
|
-
|
24
|
+
# queue order is *VERY* important
|
25
|
+
queues = ROBOTS[i][:queues].join(',')
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
# use environment for these resque variables
|
28
|
+
process.environment = {
|
29
|
+
'QUEUES' => queues,
|
30
|
+
'ROBOT_ENVIRONMENT' => robot_environment,
|
31
|
+
'INTERVAL' => '5'
|
32
|
+
}
|
33
|
+
process.environment['VERBOSE'] = 'yes' if ENV['ROBOT_VERBOSE'] == 'yes'
|
34
|
+
process.environment['VVERBOSE'] = 'yes' if ENV['ROBOT_VVERBOSE'] == 'yes'
|
35
|
+
|
36
|
+
# process configuration
|
37
|
+
process.group = robot_environment
|
38
|
+
process.stdout = process.stderr = "#{WORKDIR}/log/#{ROBOTS[i][:robot]}.log"
|
32
39
|
|
33
|
-
|
34
|
-
|
35
|
-
process.stdout = process.stderr = "#{WORKDIR}/log/#{ROBOTS[i][:robot]}.log"
|
40
|
+
# spawn worker processes using robot-controller
|
41
|
+
process.start_command = "rake environment resque:work"
|
36
42
|
|
37
|
-
|
38
|
-
|
39
|
-
|
43
|
+
# we use bluepill to daemonize the resque workers rather than using
|
44
|
+
# resque's BACKGROUND flag
|
45
|
+
process.daemonize = true
|
40
46
|
|
41
|
-
|
42
|
-
|
43
|
-
process.daemonize = true
|
47
|
+
# bluepill manages pid files
|
48
|
+
# process.pid_file = "#{WORKDIR}/run/#{process.name}.pid"
|
44
49
|
|
45
|
-
|
46
|
-
|
50
|
+
# graceful stops
|
51
|
+
process.stop_grace_time = 360.seconds # must be greater than stop_signals total
|
52
|
+
process.stop_signals = [
|
53
|
+
:quit, 300.seconds, # waits for jobs, then exits gracefully
|
54
|
+
:term, 10.seconds, # kills jobs and exits
|
55
|
+
:kill # no mercy
|
56
|
+
]
|
47
57
|
|
48
|
-
|
49
|
-
process.stop_grace_time = 360.seconds # must be greater than stop_signals total
|
50
|
-
process.stop_signals = [
|
51
|
-
:quit, 300.seconds, # waits for jobs, then exits gracefully
|
52
|
-
:term, 10.seconds, # kills jobs and exits
|
53
|
-
:kill # no mercy
|
54
|
-
]
|
58
|
+
# process monitoring
|
55
59
|
|
56
|
-
|
60
|
+
# backoff if process is flapping between states
|
61
|
+
# process.checks :flapping,
|
62
|
+
# :times => 2, :within => 30.seconds,
|
63
|
+
# :retry_in => 7.seconds
|
57
64
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
# :retry_in => 7.seconds
|
65
|
+
# restart if process runs for longer than 15 mins of CPU time
|
66
|
+
# process.checks :running_time,
|
67
|
+
# :every => 5.minutes, :below => 15.minutes
|
62
68
|
|
63
|
-
|
64
|
-
|
65
|
-
|
69
|
+
# restart if CPU usage > 75% for 3 times, check every 10 seconds
|
70
|
+
# process.checks :cpu_usage,
|
71
|
+
# :every => 10.seconds,
|
72
|
+
# :below => 75, :times => 3,
|
73
|
+
# :include_children => true
|
74
|
+
#
|
75
|
+
# restart the process or any of its children
|
76
|
+
# if MEM usage > 100MB for 3 times, check every 10 seconds
|
77
|
+
# process.checks :mem_usage,
|
78
|
+
# :every => 10.seconds,
|
79
|
+
# :below => 100.megabytes, :times => 3,
|
80
|
+
# :include_children => true
|
66
81
|
|
67
|
-
|
68
|
-
|
69
|
-
# :every => 10.seconds,
|
70
|
-
# :below => 75, :times => 3,
|
71
|
-
# :include_children => true
|
72
|
-
#
|
73
|
-
# restart the process or any of its children
|
74
|
-
# if MEM usage > 100MB for 3 times, check every 10 seconds
|
75
|
-
# process.checks :mem_usage,
|
76
|
-
# :every => 10.seconds,
|
77
|
-
# :below => 100.megabytes, :times => 3,
|
78
|
-
# :include_children => true
|
79
|
-
|
80
|
-
# NOTE: there is an implicit process.keepalive
|
82
|
+
# NOTE: there is an implicit process.keepalive
|
83
|
+
end
|
81
84
|
end
|
82
85
|
end
|
83
86
|
end
|
@@ -1,12 +1 @@
|
|
1
|
-
require 'resque/tasks'
|
2
|
-
|
3
|
-
desc "Start multiple Resque workers using environment"
|
4
|
-
task :workers => [ :environment ] do
|
5
|
-
threads = []
|
6
|
-
(ENV['COUNT'] || '1').to_i.times do
|
7
|
-
threads << Thread.new do
|
8
|
-
system "rake environment resque:work" # XXX is better way to do this?
|
9
|
-
end
|
10
|
-
end
|
11
|
-
threads.each { |thread| thread.join }
|
12
|
-
end
|
1
|
+
require 'resque/tasks'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: robot-controller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darren Hardy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bluepill
|