We use xp5k to manage the interaction with the Grid resources.
We create a new XP
and define a new job.
Note that resources
are the same as those given in a oarsub
command line.
In [ ]:
require 'xp5k'
myxp = XP5K::XP.new
myxp.define_job({
:resources => ["nodes=3, walltime=1:00:00"],
:site => 'lyon',
:types => ["allow_classic_ssh"],
:name => "iruby notebook" ,
:roles => [XP5K::Role.new({:name => 'mynode', :size => 3})],
:command => "sleep 86400"
})
In [ ]:
myxp.submit
myxp.wait_for_jobs
In [ ]:
require 'xp5k/rake'
h = on roles('mynode'), {:user => 'msimonin'} do
cmd = ['uptime -s']
end
In [ ]:
require 'nyaplot'
require 'time'
now = Time.now.to_i
plot = Nyaplot::Plot.new
df = Nyaplot::DataFrame.new({
host: h.keys
.map{|x| x.split('.').first},
uptime: h.values
.map{|x| x.chomp}
.map{|x| ((now - Time.parse(x).to_f)/60).round(2)}
})
In [ ]:
plot=Nyaplot::Plot.new
plot.add_with_df(df, :bar, :host, :uptime)
plot.configure do
x_label('')
y_label('Uptime (min)')
rotate_x_label(-90)
end
In [ ]:
myxp.clean
In [ ]:
In [ ]: