Mercurial > hg > Game > Cerium
annotate scripts/log.rb @ 2051:b79a250b4f99 draft
FileMapReduce (no compile error)
author | masa |
---|---|
date | Thu, 28 Jan 2016 17:23:45 +0900 |
parents | 9b0908cb7553 |
children |
rev | line source |
---|---|
1431
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 require 'yaml' |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 log_file = ARGV[0] |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 puts 'digraph log {' |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 puts 'node [shape = record];' |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 YAML.load_documents(open(log_file)) do |doc| |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 print doc['task_id'].to_s |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 print '[' |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 print 'label = "{' |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 print doc['task_id'].to_s + '|' |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 print 'cmd:\ ' + doc['cmd'].to_s + '\l' + '\n' |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 print 'create:\ ' + doc['create_time'].to_s + '\l' + '\n' |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 print 'execute:\ ' + doc['execute_time'].to_s + '\l' + '\n' |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 print 'finish:\ ' + doc['finish_time'].to_s + '\l' + '\n' |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 print '}"];' + "\n" |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 end |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 YAML.load_documents(open(log_file)) do |doc| |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19 if doc['wait_for'] != nil then |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 doc['wait_for'].each do |task| |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 puts task['task_id'].to_s + ' -> ' + doc['task_id'].to_s |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
22 end |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 end |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
25 end |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26 |
9b0908cb7553
change to exporting filetype
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27 puts '}' |