Class: Space::Architect::CLI::Architect::Research::Status

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/space_architect/cli/research.rb

Instance Method Summary collapse

Instance Method Details

#call(space: nil, **opts) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/space_architect/cli/research.rb', line 36

def call(space: nil, **opts)
  setup_terminal(**opts.slice(:color, :colors))
  handle_errors do
    render(store.find(space)) do |sp|
      supervisor = Space::Architect::Research::Supervisor.new(space: sp)
      entries = supervisor.status
      if entries.empty?
        terminal.say "No research runs registered"
      else
        rows = entries.map do |e|
          run = e[:run]
          [run.id, run.pid.to_s, e[:state].to_s, run.model, e[:tail].last.to_s.slice(0, 60)]
        end
        terminal.say terminal.table(%w[ID PID State Model LastLine], rows)
      end
      CLI.record_outcome(Outcome.new(exit_code: 0))
    end
  end
end