Wakame-os is the Cluster Level Infrastructure Operating System. It is designed to be very simple to handle resources of cluster beyond the different cloud infrastructures. (Amazon EC2, Wakame-vdc, and etc in the future)
require 'wakame'
process = Wakame::Process.setup(:credential => {:user => 'your_name'})
process.fork {
print "Running code on the remote!\n"
}
require 'wakame'
credential = {:user => 'your_name'}
instance = Wakame::SyncRpc('instance')
instance.create_instances(credential)
You can build “the Hybrid-cloud,” and use it in your code.
Difinition of specification have a logical name.
...(snip)...
cc.credential 'amazon_account' do |c|
c.access_key = 'YOUR_ACCESS_KEY'
c.secret_access_key = 'YOUR_SECRET_ACCESS_KEY'
end
...(snip)...
cc.spec 'aws_fedora_core_8' do |s|
s.credential = 'amazon_account'
s.driver = 'aws'
s.requirement do |r|
r.image_id = 'ami-84db39ed'
end
end
...(snip)...
You can use the logical name of specification in your code.
require 'wakame'
process = Wakame::Process.setup(:credential => {:user => 'your_name'},
:spec_name => 'aws_fedora_core_8')
process.fork {
print "Running code on the remote fedora core 8!\n"
}
require 'wakame'
credential = {:user => 'your_name'}
instance = Wakame::SyncRpc('instance')
instance.create_instances(credential, 'aws_fedora_core_8')
require 'rubygems'
require 'wakame'
require 'rational'
credential = { :user => 'yam' }
process = Wakame::Process.setup( :credential => credential,
:spec_name => 'unknown'
)
queue = Wakame::Queue.setup
# How many compute?
dist = 30
challange = 1000000
dist.times { |no|
process.fork(no, challange, queue) { |no, challange, queue|
hit = 0
challange.times {
x = rand
y = rand
hit += 1 if x*x+y*y<1.0
}
queue.push [no, Rational(hit, challange)]
}
}
print "Process were distributed. Waiting results...\n"
rat = 0
dist.times { |i|
data = queue.pop
print "Arrival result #{i+1}/#{dist} from node number. #{data[0]} -> #{data[1]}\n"
rat += data[1]
}
print "Final result. PI = #{(rat * Rational(4, dist)).to_f}\n"