Class: Wakame::Command::ActionStatus

Inherits:
Object
  • Object
show all
Includes:
Wakame::Command
Defined in:
lib/wakame/command/action_status.rb

Instance Method Summary collapse

Methods included from Wakame::Command

included, #options=, #params

Instance Method Details

#runObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/wakame/command/action_status.rb', line 5

def run
  walk_subactions = proc { |a, level|
    res = a.dump_attrs
    unless a.subactions.empty?
      res[:subactions] = a.subactions.collect { |s|
        walk_subactions.call(s, level + 1)
      }
    end
    res
  }

  Wakame::StatusDB.barrier {
    result = {}

    master.action_manager.active_jobs.each { |id, v|
      result[id]={}
      (v.keys - [:root_action]).each { |k|
        result[id][k]=v[k]
      }
      result[id][:root_action] = walk_subactions.call(v[:root_action], 0)

    }
    @status = result
    @status
  }
end