stormtroopers 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Vagrantfile +3 -0
- data/lib/stormtroopers/manager.rb +14 -5
- data/lib/stormtroopers/version.rb +1 -1
- metadata +2 -2
data/.gitignore
CHANGED
data/Vagrantfile
CHANGED
@@ -6,5 +6,8 @@ Vagrant::Config.run do |config|
|
|
6
6
|
config.vm.box = "precise64"
|
7
7
|
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
|
8
8
|
config.vm.share_folder "v-root", "/vagrant", "."
|
9
|
+
if File.directory?(File.expand_path("./.apt-cache/partial/"))
|
10
|
+
config.vm.share_folder "apt-cache", "/var/cache/apt/archives", "./.apt-cache", :owner => "root", :group => "root"
|
11
|
+
end
|
9
12
|
config.vm.provision :shell, :path => "vagrant-provision"
|
10
13
|
end
|
@@ -10,14 +10,23 @@ module Stormtroopers
|
|
10
10
|
class Manager
|
11
11
|
include Singleton
|
12
12
|
|
13
|
+
def stop_managing
|
14
|
+
return unless managing?
|
15
|
+
logger.info "Stopping, waiting for running jobs to complete"
|
16
|
+
log_current_status
|
17
|
+
@managing = false
|
18
|
+
end
|
19
|
+
|
13
20
|
def manage
|
14
21
|
raise AlreadyRunning if managing?
|
15
22
|
@managing = true
|
16
23
|
|
24
|
+
Signal.trap("TERM") do
|
25
|
+
stop_managing
|
26
|
+
end
|
27
|
+
|
17
28
|
Signal.trap("INT") do
|
18
|
-
|
19
|
-
log_current_status
|
20
|
-
@managing = false
|
29
|
+
stop_managing
|
21
30
|
end
|
22
31
|
|
23
32
|
Signal.trap("USR2") do
|
@@ -38,7 +47,7 @@ module Stormtroopers
|
|
38
47
|
|
39
48
|
while managing? do
|
40
49
|
assigned = armies.map(&:manage)
|
41
|
-
sleep timeout(assigned.include?(true))
|
50
|
+
sleep timeout(assigned.include?(true))
|
42
51
|
end
|
43
52
|
|
44
53
|
armies.each(&:finish)
|
@@ -81,7 +90,7 @@ module Stormtroopers
|
|
81
90
|
end
|
82
91
|
|
83
92
|
def logger
|
84
|
-
unless @logger
|
93
|
+
unless @logger
|
85
94
|
log_directory = File.join(working_directory, "log")
|
86
95
|
Dir.mkdir(log_directory) unless File.directory?(log_directory)
|
87
96
|
@logger = Logger.new(File.join(working_directory, "log", "stormtroopers.log"), 'daily')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stormtroopers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-02-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|