refinery 0.10.6 → 0.10.8
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.
- data/.gitignore +2 -1
- data/VERSION +1 -1
- data/bin/epub +13 -2
- data/bin/refinery +13 -2
- data/lib/refinery/daemon.rb +7 -0
- data/lib/refinery/heartbeat.rb +6 -0
- data/lib/refinery/processor.rb +6 -0
- data/refinery.gemspec +2 -2
- data/test/unit/daemon_test.rb +1 -0
- data/test/unit/processor_test.rb +1 -0
- metadata +2 -2
data/.gitignore
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.10.
|
|
1
|
+
0.10.8
|
data/bin/epub
CHANGED
|
@@ -27,13 +27,16 @@ require 'getoptlong'
|
|
|
27
27
|
require 'rdoc/usage'
|
|
28
28
|
require File.dirname(__FILE__) + '/../lib/refinery'
|
|
29
29
|
|
|
30
|
+
pidfile = 'epub.pid'
|
|
31
|
+
|
|
30
32
|
options = {}
|
|
31
33
|
opts = GetoptLong.new(
|
|
32
34
|
[ '--help', '-h', GetoptLong::NO_ARGUMENT ],
|
|
33
35
|
[ '--debug', '-d', GetoptLong::NO_ARGUMENT ],
|
|
34
36
|
[ '--config', '-c', GetoptLong::REQUIRED_ARGUMENT],
|
|
35
37
|
[ '--publishers', '-p', GetoptLong::REQUIRED_ARGUMENT],
|
|
36
|
-
[ '--verbose', '-v', GetoptLong::NO_ARGUMENT]
|
|
38
|
+
[ '--verbose', '-v', GetoptLong::NO_ARGUMENT],
|
|
39
|
+
[ '--pidfile', GetoptLong::REQUIRED_ARGUMENT]
|
|
37
40
|
)
|
|
38
41
|
opts.each do |opt, arg|
|
|
39
42
|
case opt
|
|
@@ -47,7 +50,15 @@ opts.each do |opt, arg|
|
|
|
47
50
|
options[:publishers] = arg
|
|
48
51
|
when '--verbose'
|
|
49
52
|
options[:verbose] = true
|
|
53
|
+
when '--pidfile'
|
|
54
|
+
pidfile = arg
|
|
50
55
|
end
|
|
51
56
|
end
|
|
52
57
|
|
|
53
|
-
|
|
58
|
+
open(pidfile, 'w') do |f|
|
|
59
|
+
f << $$
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
Refinery::EventPublisher.new(options).run
|
|
63
|
+
|
|
64
|
+
File.delete(pidfile)
|
data/bin/refinery
CHANGED
|
@@ -27,13 +27,16 @@ require 'getoptlong'
|
|
|
27
27
|
require 'rdoc/usage'
|
|
28
28
|
require File.dirname(__FILE__) + '/../lib/refinery'
|
|
29
29
|
|
|
30
|
+
pidfile = 'refinery.pid'
|
|
31
|
+
|
|
30
32
|
options = {}
|
|
31
33
|
opts = GetoptLong.new(
|
|
32
34
|
[ '--help', '-h', GetoptLong::NO_ARGUMENT ],
|
|
33
35
|
[ '--debug', '-d', GetoptLong::NO_ARGUMENT ],
|
|
34
36
|
[ '--config', '-c', GetoptLong::REQUIRED_ARGUMENT],
|
|
35
37
|
[ '--workers', '-w', GetoptLong::REQUIRED_ARGUMENT],
|
|
36
|
-
[ '--verbose', '-v', GetoptLong::NO_ARGUMENT]
|
|
38
|
+
[ '--verbose', '-v', GetoptLong::NO_ARGUMENT],
|
|
39
|
+
[ '--pidfile', GetoptLong::REQUIRED_ARGUMENT]
|
|
37
40
|
)
|
|
38
41
|
opts.each do |opt, arg|
|
|
39
42
|
case opt
|
|
@@ -47,7 +50,15 @@ opts.each do |opt, arg|
|
|
|
47
50
|
options[:workers] = arg
|
|
48
51
|
when '--verbose'
|
|
49
52
|
options[:verbose] = true
|
|
53
|
+
when '--pidfile'
|
|
54
|
+
pidfile = arg
|
|
50
55
|
end
|
|
51
56
|
end
|
|
52
57
|
|
|
53
|
-
|
|
58
|
+
open(pidfile, 'w') do |f|
|
|
59
|
+
f << $$
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
Refinery::Server.new(options).run
|
|
63
|
+
|
|
64
|
+
File.delete(pidfile)
|
data/lib/refinery/daemon.rb
CHANGED
|
@@ -73,6 +73,13 @@ module Refinery #:nodoc:
|
|
|
73
73
|
private
|
|
74
74
|
def execute
|
|
75
75
|
logger.debug "Running daemon thread: #{name} (settings: #{settings.inspect})"
|
|
76
|
+
|
|
77
|
+
begin
|
|
78
|
+
require 'java'
|
|
79
|
+
java.lang.Thread.current_thread.name = "#{name} Daemon"
|
|
80
|
+
rescue LoadError => e
|
|
81
|
+
end
|
|
82
|
+
|
|
76
83
|
while(running?)
|
|
77
84
|
#logger.debug "Checking #{queue_name}_waiting"
|
|
78
85
|
with_queue("#{queue_name}_waiting") do |waiting_queue|
|
data/lib/refinery/heartbeat.rb
CHANGED
|
@@ -11,6 +11,12 @@ module Refinery #:nodoc:
|
|
|
11
11
|
queue_prefix = config['prefix'] || ''
|
|
12
12
|
@server = server
|
|
13
13
|
@thread = Thread.new do
|
|
14
|
+
begin
|
|
15
|
+
require 'java'
|
|
16
|
+
java.lang.Thread.current_thread.name = 'Heartbeat'
|
|
17
|
+
rescue Exception => e
|
|
18
|
+
end
|
|
19
|
+
|
|
14
20
|
loop do
|
|
15
21
|
with_queue("#{queue_prefix}heartbeat") do |heartbeat_queue|
|
|
16
22
|
logger.debug "Send heartbeat"
|
data/lib/refinery/processor.rb
CHANGED
|
@@ -26,6 +26,12 @@ module Refinery #:nodoc:
|
|
|
26
26
|
def execute
|
|
27
27
|
queue_prefix = config['prefix'] || ''
|
|
28
28
|
|
|
29
|
+
begin
|
|
30
|
+
require 'java'
|
|
31
|
+
java.lang.Thread.current_thread.name = "#{key} Processor"
|
|
32
|
+
rescue Exception => e
|
|
33
|
+
end
|
|
34
|
+
|
|
29
35
|
logger.debug "Creating daemons for #{key}"
|
|
30
36
|
1.upto(settings['workers']['initial']) do
|
|
31
37
|
daemons << Daemon.new(self, key, queue_prefix, settings)
|
data/refinery.gemspec
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = %q{refinery}
|
|
5
|
-
s.version = "0.10.
|
|
5
|
+
s.version = "0.10.8"
|
|
6
6
|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
8
8
|
s.authors = ["Anthony Eden"]
|
|
9
|
-
s.date = %q{2009-
|
|
9
|
+
s.date = %q{2009-08-11}
|
|
10
10
|
s.description = %q{Process data in a distributed fashion.}
|
|
11
11
|
s.email = %q{anthonyeden@gmail.com}
|
|
12
12
|
s.executables = ["epub", "monitor", "pubnow", "refinery"]
|
data/test/unit/daemon_test.rb
CHANGED
|
@@ -9,6 +9,7 @@ class DaemonTest < Test::Unit::TestCase
|
|
|
9
9
|
@error_queue = stub('Queue(error)')
|
|
10
10
|
@done_queue = stub('Queue(done)')
|
|
11
11
|
|
|
12
|
+
Refinery::Daemon.any_instance.stubs(:require).with('java').raises(LoadError)
|
|
12
13
|
Refinery::Daemon.any_instance.stubs(:queue).with(
|
|
13
14
|
'sample_waiting').returns(@waiting_queue)
|
|
14
15
|
Refinery::Daemon.any_instance.stubs(:queue).with(
|
data/test/unit/processor_test.rb
CHANGED
|
@@ -13,6 +13,7 @@ class ProcessorTest < Test::Unit::TestCase
|
|
|
13
13
|
@error_queue = stub('Queue(error)')
|
|
14
14
|
@done_queue = stub('Queue(done)')
|
|
15
15
|
|
|
16
|
+
Refinery::Daemon.any_instance.stubs(:require).with('java').raises(LoadError)
|
|
16
17
|
Refinery::Daemon.any_instance.stubs(:queue).with(
|
|
17
18
|
'sample_waiting').returns(@waiting_queue)
|
|
18
19
|
Refinery::Daemon.any_instance.stubs(:queue).with(
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: refinery
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.10.
|
|
4
|
+
version: 0.10.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Anthony Eden
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-
|
|
12
|
+
date: 2009-08-11 00:00:00 -10:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies: []
|
|
15
15
|
|