view distributed/get_node_list.rb @ 13:e3fe67fee803

adde hello_post.rb
author Nobuyasu
date Mon, 20 Jan 2014 17:01:44 +0900
parents 223af50e60d5
children d6d3b7180e6d
line wrap: on
line source

module GetNodeList
  def get_node_list(filename)
    f = open(filename,"r")
    nodes = []
    f.each { |line| 
      if /.+jp/ =~ line then
        nodes.push(line.chomp) 
      end
    }
    hostname = `hostname`
    mynum = 0
    if /[0-9]+/ =~ hostname then
      mynum = $&.to_i
    end
    nodes = nodes.rotate(mynum)
    return nodes
  end
end