g5k-graph 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/g5k-graph +5 -1
  2. data/lib/grid5000/graph.rb +6 -2
  3. metadata +3 -3
@@ -9,7 +9,8 @@ require 'optparse'
9
9
  :resolution => 15,
10
10
  :metrics => ['mem_free', 'cpu_idle', 'bytes_in', 'bytes_out'],
11
11
  :to => (Time.now.to_i/15*15),
12
- :output => File.expand_path("./data")
12
+ :output => File.expand_path("./data"),
13
+ :empty => false
13
14
  }
14
15
 
15
16
  option_parser = OptionParser.new do |opts|
@@ -36,6 +37,9 @@ BANNER
36
37
  opts.on("-o=", "--output=", "Where to write the timeseries data and graphs [default=#{@options[:output]}]") do |v|
37
38
  @options[:output] = File.expand_path(v)
38
39
  end
40
+ opts.on("--empty", "Empty the output directory before writing into it [default=#{@options[:empty].inspect}]") do |v|
41
+ @options[:empty] = true
42
+ end
39
43
  opts.on_tail("-h", "--help", "Show this message") do
40
44
  puts opts
41
45
  exit
@@ -1,6 +1,8 @@
1
+ require 'fileutils'
2
+
1
3
  module Grid5000
2
4
  class Graph
3
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
4
6
 
5
7
  class Error < StandardError; end
6
8
 
@@ -26,6 +28,8 @@ module Grid5000
26
28
  raise(Error, "No nodes given") if nodes.empty?
27
29
 
28
30
  if nodes.all?{|n| n =~ /\.\w+\.grid5000\.fr$/}
31
+ FileUtils.rm_rf options[:output] if options[:empty]
32
+ FileUtils.mkdir_p options[:output]
29
33
  fetch_timeseries
30
34
  graph_timeseries
31
35
  else
@@ -54,7 +58,7 @@ module Grid5000
54
58
  def graph_timeseries
55
59
  Dir.chdir(options[:output]) do |dir|
56
60
  Dir["*.zip"].each do |zip|
57
- system "unzip #{zip}"
61
+ system "unzip -o #{zip}"
58
62
  end
59
63
  commands = {}
60
64
  Dir["*.grid5000.fr/*.xml"].each do |xml|
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: g5k-graph
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Cyril Rohr