view scripts/log.rb @ 1794:3d53b0ca02a2 draft

rename string_args to send_args
author Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
date Wed, 04 Dec 2013 18:01:17 +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 '}'