Class: Lemans::CLI::ProgressReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/lemans/cli/progress_reporter.rb

Overview

The pipe renderer: one plain line per event

Constant Summary collapse

STATUS_VERBS =

say_status's verb column is 12 wide; the longer outcome names get a short verb here and keep their full name in the table and result.json.

{
  completed: :completed,
  agent_timeout: :timeout,
  step_limit_reached: :step_limit,
  cost_ceiling_reached: :cost_limit,
  environment_error: :invalid,
  agent_error: :invalid,
  accounting_error: :invalid,
  verifier_error: :invalid,
  harness_crash: :invalid
}.freeze
MAX_DETAIL_CHARS =
200

Instance Method Summary collapse

Constructor Details

#initialize(shell:, task_width:) ⇒ ProgressReporter

Returns a new instance of ProgressReporter.



23
24
25
26
# File 'lib/lemans/cli/progress_reporter.rb', line 23

def initialize(shell:, task_width:)
  @shell = shell
  @task_width = task_width
end

Instance Method Details

#record(event, data) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/lemans/cli/progress_reporter.rb', line 30

def record(event, data)
  case event
  when :started then started(data)
  when :finished then finished(data)
  when :interrupted
    @shell.say_status :interrupt,
                      "waiting for #{data[:in_flight]} in-flight trial(s), ^C again to abandon", :yellow
  end
end

#startObject



28
# File 'lib/lemans/cli/progress_reporter.rb', line 28

def start = self

#stopObject



40
# File 'lib/lemans/cli/progress_reporter.rb', line 40

def stop; end