qmore 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -3
- data/CHANGELOG +5 -0
- data/lib/qmore/job_reserver.rb +2 -1
- data/lib/qmore/version.rb +1 -1
- data/spec/job_reserver_spec.rb +11 -1
- data/spec/redis/qless01-test.conf +1 -1
- data/spec/redis/qless02-test.conf +1 -1
- data/spec/spec_helper.rb +15 -18
- 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: 6f079f1d98ba4c005750de9469e2606766e18ea3
|
4
|
+
data.tar.gz: c736db45bb274e617bca058222298eea4fa55b8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f847b813fd9f3d01073060a3efad7373e7e50cd8c37def71be557f05b0e2ef9e078fb54dc3239cac8d68831991ef5c58ac5d377ed1044b41ece77490aa0bfa74
|
7
|
+
data.tar.gz: 8e7f39e5973a0dddb8d8e4cac20ffe4e1e1862b075b2962f2121f90332b4dcfb6fae180317411374715a0a61330d3a6bee4392eb9b6b78846479001b97248b1a
|
data/.travis.yml
CHANGED
data/CHANGELOG
CHANGED
data/lib/qmore/job_reserver.rb
CHANGED
@@ -39,7 +39,8 @@ module Qmore
|
|
39
39
|
def realize_queues
|
40
40
|
realized_queues = []
|
41
41
|
|
42
|
-
self.clients.each do |client
|
42
|
+
self.clients.keys.shuffle.each do |client|
|
43
|
+
regexes = self.clients[client]
|
43
44
|
# Cache the queues so we don't make multiple calls.
|
44
45
|
actual_queues = client.queues
|
45
46
|
|
data/lib/qmore/version.rb
CHANGED
data/spec/job_reserver_spec.rb
CHANGED
@@ -26,10 +26,19 @@ describe "JobReserver" do
|
|
26
26
|
queue_a.length.should == 0
|
27
27
|
queue_b.length.should == 0
|
28
28
|
end
|
29
|
+
|
30
|
+
it "shuffles the order of the clients" do
|
31
|
+
queue = Qmore.client.queues['queue']
|
32
|
+
|
33
|
+
reserver = Qmore::JobReserver.new([queue])
|
34
|
+
k = reserver.clients.keys
|
35
|
+
k.should_receive(:shuffle).once.and_return(reserver.clients.keys)
|
36
|
+
reserver.clients.should_receive(:keys).and_return(k)
|
37
|
+
reserver.reserve
|
38
|
+
end
|
29
39
|
end
|
30
40
|
|
31
41
|
context "basic qless behavior still works" do
|
32
|
-
|
33
42
|
it "can reserve from multiple queues" do
|
34
43
|
high_queue = Qmore.client.queues['high']
|
35
44
|
critical_queue = Qmore.client.queues['critical']
|
@@ -38,6 +47,7 @@ describe "JobReserver" do
|
|
38
47
|
critical_queue.put(SomeJob, [])
|
39
48
|
|
40
49
|
reserver = Qmore::JobReserver.new([critical_queue, high_queue])
|
50
|
+
|
41
51
|
reserver.reserve.queue.name.should == 'critical'
|
42
52
|
reserver.reserve.queue.name.should == 'high'
|
43
53
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,26 +5,23 @@ Coveralls.wear!
|
|
5
5
|
|
6
6
|
require 'qmore'
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
redis_configs_directory = File.join(File.dirname(File.expand_path(__FILE__)), "redis")
|
11
|
-
redis_configs = Dir.entries(redis_configs_directory).select{|f| !File.directory? f}
|
8
|
+
redis_configs_directory = File.join(File.dirname(File.expand_path(__FILE__)), "redis")
|
9
|
+
redis_configs = Dir.entries(redis_configs_directory).select{|f| !File.directory? f}
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
redis_configs.each do |config|
|
12
|
+
redis_cmd = "redis-server #{redis_configs_directory}/#{config}"
|
13
|
+
puts "Starting redis for testing at localhost..."
|
14
|
+
puts `cd #{redis_configs_directory}; #{redis_cmd}`
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
16
|
+
# Schedule the redis server for shutdown when tests are all finished.
|
17
|
+
at_exit do
|
18
|
+
redis_instance_name = config.chomp(".conf")
|
19
|
+
puts 'Stopping redis'
|
20
|
+
pid = File.read("#{redis_configs_directory}/#{redis_instance_name}.pid").to_i rescue nil
|
21
|
+
system ("kill -9 #{pid}") if pid.to_i != 0
|
22
|
+
File.delete("#{redis_configs_directory}/#{redis_instance_name}.pid") rescue nil
|
23
|
+
File.delete("#{redis_configs_directory}/#{redis_instance_name}-server.log") rescue nil
|
24
|
+
File.delete("#{redis_configs_directory}/#{redis_instance_name}-dump.rdb") rescue nil
|
28
25
|
end
|
29
26
|
end
|
30
27
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qmore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Conway
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: qless
|