Class: Lemans::CLI::ProgressReporter
- Inherits:
-
Object
- Object
- Lemans::CLI::ProgressReporter
- 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 status names get a short verb here and keep their full name in the board and the result.
{ 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
-
#initialize(shell:, tasks:) ⇒ ProgressReporter
constructor
A new instance of ProgressReporter.
- #record(event, data = nil) ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(shell:, tasks:) ⇒ ProgressReporter
Returns a new instance of ProgressReporter.
23 24 25 26 |
# File 'lib/lemans/cli/progress_reporter.rb', line 23 def initialize(shell:, tasks:) @shell = shell @task_width = (tasks.map(&:length) + [ 4 ]).max end |
Instance Method Details
#record(event, data = nil) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/lemans/cli/progress_reporter.rb', line 30 def record(event, data = nil) case event when :started then started(data) when :finished then finished(data) when :interrupted @shell.say_status :interrupt, "abandoning in-flight trial(s)", :yellow end end |
#start ⇒ Object
28 |
# File 'lib/lemans/cli/progress_reporter.rb', line 28 def start = self |
#stop ⇒ Object
39 |
# File 'lib/lemans/cli/progress_reporter.rb', line 39 def stop; end |