Class: Tumugi::DAGResultReporter

Inherits:
Object
  • Object
show all
Includes:
Mixin::Listable
Defined in:
lib/tumugi/dag_result_reporter.rb

Instance Method Summary collapse

Methods included from Mixin::Listable

#list

Instance Method Details

#show(dag) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/tumugi/dag_result_reporter.rb', line 9

def show(dag)
  headings = ['Task', 'Requires', 'Parameters', 'State']
  Terminal::Table.new title: "Workflow Result", headings: headings do |t|
    dag.tsort.map.with_index do |task, index|
      proxy = task.class.merged_parameter_proxy
      requires = list(task.requires).map do |r|
        r.id
      end
      params = proxy.params.map do |name, _|
        "#{name}=#{truncate(task.send(name.to_sym).to_s, 25)}"
      end
      t << :separator if index != 0
      t << [ task.id, requires.join("\n"), params.join("\n"), task.state ]
    end
  end
end