Sha256: 90015bc963df36ea80cb44e264108312c5ae20a94fc8a9d5c5ba3b87d2477a3e

Contents?: true

Size: 980 Bytes

Versions: 13

Compression:

Stored size: 980 Bytes

Contents

require 'cute'

# This example tests two libraries for the execution of commands over several machines.
# These two  libraries use two different approaches: 1) SSH, 1) TakTuk.
# This example uses Grid'5000 but it can be used with any set of machines that can be accessed through SSH.

g5k = Cute::G5K::API.new()
# We reuse a job if there is one available.
if g5k.get_my_jobs("grenoble").empty? then
  job = g5k.reserve(:nodes => 5, :site => 'grenoble', :walltime => '00:30:00')
else
  job =g5k.get_my_jobs("grenoble").first
end

nodes = job["assigned_nodes"]

results = {}

# please change user by your Grid'5000 user.
Net::SSH::Multi.start do |session|

  nodes.each{ |node| session.use "user@#{node}" }
  session.exec 'hostname'
  session.loop
  results = session.exec! 'df'
  session.exec 'uptime'
end

puts results

Cute::TakTuk.start(nodes,:user => "user" ) do |tak|

  results = tak.exec!("hostname")
  tak.loop()
  tak.exec("df")
  tak.exec("uname -r")

end


puts results

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ruby-cute-0.24 examples/g5k_exp1.rb
ruby-cute-0.13 examples/g5k_exp1.rb
ruby-cute-0.12 examples/g5k_exp1.rb
ruby-cute-0.11 examples/g5k_exp1.rb
ruby-cute-0.10 examples/g5k_exp1.rb
ruby-cute-0.9 examples/g5k_exp1.rb
ruby-cute-0.8 examples/g5k_exp1.rb
ruby-cute-0.7 examples/g5k_exp1.rb
ruby-cute-0.6 examples/g5k_exp1.rb
ruby-cute-0.5 examples/g5k_exp1.rb
ruby-cute-0.4 examples/g5k_exp1.rb
ruby-cute-0.3 examples/g5k_exp1.rb
ruby-cute-0.0.2 examples/g5k_exp1.rb