Mercurial > hg > Members > nobuyasu > jungle_benchmark
changeset 6:593786973c04
Maked distributed directory
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 11 Jan 2014 03:13:11 +0900 |
parents | b05db511fcdf |
children | 867cd5f213d3 |
files | distributed/get_node_name.rb distributed/nodes.txt distributed/test_get_node_name.rb get_node_name.rb nodes.txt test_get_node_name.rb |
diffstat | 6 files changed, 22 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/distributed/get_node_name.rb Sat Jan 11 03:13:11 2014 +0900 @@ -0,0 +1,14 @@ +module GetNodeName + def get_node_name(filename) + f = open(filename,"r") + nodes = [] + f.each { |line| nodes.push(line) } + hostname = `hostname` + mynum = 0 + if /[0-9]+/ =~ hostname then + num = $&.to_i + end + nodenum = mynum % nodes.size + return nodes[nodenum] + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/distributed/nodes.txt Sat Jan 11 03:13:11 2014 +0900 @@ -0,0 +1,2 @@ +bldsv12.cr.ie.u-ryukyu.ac.jp +bldsv10.cr.ie.u-ryukyu.ac.jp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/distributed/test_get_node_name.rb Sat Jan 11 03:13:11 2014 +0900 @@ -0,0 +1,6 @@ +#!/usr/bin/ruby + +require './get_node_name.rb' +include GetNodeName + +puts get_node_name("nodes.txt")
--- a/get_node_name.rb Sat Jan 11 02:56:20 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -module GetNodeName - def get_node_name(filename) - f = open(filename,"r") - nodes = [] - f.each { |line| nodes.push(line) } - hostname = `hostname` - mynum = 0 - if /[0-9]+/ =~ hostname then - num = $&.to_i - end - nodenum = mynum % nodes.size - return nodes[nodenum] - end -end