view scripts/log.rb @ 1492:73f4bfaeaf99 draft

fix select cpu type
author Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
date Tue, 14 Aug 2012 16:04:12 +0900
parents 9b0908cb7553
children
line wrap: on
line source

require 'yaml'
log_file = ARGV[0]

puts 'digraph log {'
puts 'node [shape = record];'
YAML.load_documents(open(log_file)) do |doc|
  print doc['task_id'].to_s
  print '['
  print 'label = "{'
  print doc['task_id'].to_s + '|'
  print 'cmd:\ ' + doc['cmd'].to_s + '\l' + '\n'
  print 'create:\ ' + doc['create_time'].to_s + '\l' + '\n'
  print 'execute:\ ' + doc['execute_time'].to_s + '\l' + '\n'
  print 'finish:\ ' + doc['finish_time'].to_s + '\l' + '\n'
  print '}"];' + "\n"
end

YAML.load_documents(open(log_file)) do |doc|
  if doc['wait_for'] != nil then
    doc['wait_for'].each do |task|
      puts task['task_id'].to_s + ' -> ' + doc['task_id'].to_s
    end
  end

end

puts '}'