Mercurial > hg > Members > nobuyasu > jungle_benchmark
changeset 4:d9d712277bf5
Added get_node_name.rb
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 11 Jan 2014 02:55:56 +0900 |
parents | 5ea96ce6a1c1 |
children | b05db511fcdf |
files | get_node_name.rb nodes.txt test_get_node_num.rb |
diffstat | 3 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/get_node_name.rb Sat Jan 11 02:55:56 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