This repository has been archived by the owner on Oct 4, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make all utilities and examples work
- Loading branch information
1 parent
2554556
commit db9820b
Showing
12 changed files
with
23 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env ruby | ||
$LOAD_PATH.push '../../lib/rb' | ||
require 'producer' | ||
require 'jp/producer' | ||
|
||
p = Jp::TextProducer.new 'text' | ||
p.add 'simple pie' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
$LOAD_PATH.unshift File.dirname(__FILE__) + '/gen-rb' | ||
require 'job_pool' | ||
require 'job_pool_instrumented' | ||
$LOAD_PATH.shift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,27 @@ | ||
#!/usr/bin/env ruby | ||
|
||
$LOAD_PATH.push File.dirname(__FILE__) + '/../classes/' | ||
$LOAD_PATH.push File.dirname(__FILE__) + '/../lib/rb/' | ||
|
||
require 'ruby-1.9.0-compat' | ||
require 'jp_config_loader' | ||
require 'jp/server/configuration_loader' | ||
require 'jp/server/handler' | ||
require 'mongo' | ||
|
||
|
||
module Jp | ||
def self.pool_sizes | ||
# Load options & defaults | ||
options = Jp::load_server_config | ||
|
||
options[:mongo_uri] ||= 'mongodb://localhost' | ||
raise ArgumentError.new "mongo_db option must be specified" unless options[:mongo_db] | ||
raise ArgumentError.new "pools option must be specified" unless options[:pools] | ||
raise ArgumentError.new "pools option must not be empty" unless ! options[:pools].empty? | ||
|
||
# Connect to mongodb | ||
connection = Mongo::Connection.from_uri options[:mongo_uri] | ||
database = connection.db options[:mongo_db] | ||
options = Jp::Server::ConfigurationLoader.server_config | ||
server = Jp::Server::Handler.new(options) | ||
|
||
out = Hash.new | ||
options[:pools].each do |name, data| | ||
out[name] = database[name].count | ||
server.pools.each do |name, data| | ||
out[name] = server.database[name].count | ||
end | ||
out | ||
end | ||
end | ||
|
||
if File.expand_path($0) == File.expand_path(__FILE__) | ||
Jp.pool_sizes.each do |name, size| | ||
next if ARGV[0] && ARGV[0] != name | ||
print "%s: %d\n" % [name, size] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters