Skip to content

axsh/wakame-os

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wakame-os

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)

Example: Running a remote code


  require 'wakame'
  process = Wakame::Process.setup(:credential => {:user => 'your_name'})
  
  process.fork {
    print "Running code on the remote!\n"
  }

Example: Launch a new instance


  require 'wakame'
  credential = {:user => 'your_name'}
  
  instance = Wakame::SyncRpc('instance')
  instance.create_instances(credential)

Example: Configure instances & launch

You can build “the Hybrid-cloud,” and use it in your code.
Difinition of specification have a logical name.

config/cloud_catalog.rb


...(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)...

fork_sample.rb

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"
  }

instance_sample.rb


  require 'wakame'
  credential = {:user => 'your_name'}
  
  instance = Wakame::SyncRpc('instance')
  instance.create_instances(credential, 'aws_fedora_core_8')

Example: PI calc


  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"

About

Cluster Level Infrastructure Operating System

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages