view scripts/log.rb @ 2069:26aa08c9a1de draft default tip

cuda example fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 12 Feb 2017 10:04:55 +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 '}'