sqs_image_processor 0.1.0 → 0.1.1
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,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2fc3e6370c83e9ce6ade54d4a54e521b4eeede6
|
4
|
+
data.tar.gz: 17c29df5395fe1b7d5a411d9a543c28348a0d35c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bc846e3dcb1e088ef1822dc2fb47b7efbed6912018edf0fa98754a0dfe1765b536489b17e26124fe7c3a55a940597ee09fdf91ad059be92ea9080ab88218d73
|
7
|
+
data.tar.gz: 8261300d8873be57090d4b5b38af75e6aeaa91d420a640b934044514ba58a81b26122132aba7d9bb92183ec5dbb8eb2c5f7c1a1a19d79dac4934220b399ebf31
|
@@ -22,6 +22,7 @@ module SqsImageProcessor
|
|
22
22
|
def start
|
23
23
|
config_path = options[:c]
|
24
24
|
daemonize = options[:d]
|
25
|
+
child_pids = []
|
25
26
|
|
26
27
|
if !File.exists?(config_path)
|
27
28
|
puts "Error: Config file not found."
|
@@ -33,7 +34,12 @@ module SqsImageProcessor
|
|
33
34
|
config = SqsImageProcessor::Config.load( config_path )
|
34
35
|
puts "Loaded config file at #{config_path}."
|
35
36
|
puts "Starting SQS Image Processor."
|
36
|
-
|
37
|
+
4.times do
|
38
|
+
fork do
|
39
|
+
SqsImageProcessor::Worker.start( config )
|
40
|
+
end
|
41
|
+
end
|
42
|
+
Process.waitall
|
37
43
|
end
|
38
44
|
end
|
39
45
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
1
3
|
module SqsImageProcessor
|
2
4
|
module ProcessManager
|
3
5
|
def self.pid_is_running?( pid )
|
@@ -13,6 +15,13 @@ module SqsImageProcessor
|
|
13
15
|
if self.is_running?
|
14
16
|
pid = File.open("/tmp/sqs_image_processor_manager.pid", 'a+') {|f| f.read }.to_i
|
15
17
|
Process.kill("KILL", pid)
|
18
|
+
Dir.foreach('/tmp/sqs_image_processor_manager') do |item|
|
19
|
+
next if item == '.' or item == '..'
|
20
|
+
begin
|
21
|
+
Process.kill("KILL", item.gsub('.pid','').to_i)
|
22
|
+
rescue
|
23
|
+
end
|
24
|
+
end
|
16
25
|
puts "Stopped instance of SqsImageProcessor."
|
17
26
|
else
|
18
27
|
puts "Error: SqsImageProcessor isn't running."
|
@@ -29,11 +38,18 @@ module SqsImageProcessor
|
|
29
38
|
end
|
30
39
|
|
31
40
|
def self.generate_pid_file
|
41
|
+
FileUtils.mkdir_p '/tmp/sqs_image_processor_manager'
|
32
42
|
File.open("/tmp/sqs_image_processor_manager.pid", 'w') {|f|
|
33
43
|
f.write(Process.pid)
|
34
44
|
}
|
35
45
|
end
|
36
46
|
|
47
|
+
def self.generate_child_pid_file( pid )
|
48
|
+
File.open("/tmp/sqs_image_processor_manager/#{pid}.pid", 'w') {|f|
|
49
|
+
f.write(pid)
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
37
53
|
def self.get_pid
|
38
54
|
pid = File.open("/tmp/sqs_image_processor_manager.pid", 'a+') {|f| f.read }.to_i
|
39
55
|
end
|