Class: CI::Queue::BuildRecord
- Inherits:
-
Object
- Object
- CI::Queue::BuildRecord
- Defined in:
- lib/ci/queue/build_record.rb
Instance Attribute Summary collapse
-
#error_reports ⇒ Object
readonly
Returns the value of attribute error_reports.
Instance Method Summary collapse
- #fetch_stats(stat_names) ⇒ Object
-
#initialize(queue) ⇒ BuildRecord
constructor
A new instance of BuildRecord.
- #progress ⇒ Object
- #queue_exhausted? ⇒ Boolean
- #record_error(id, payload, stats: nil) ⇒ Object
- #record_success(id, stats: nil, skip_flaky_record: false) ⇒ Object
- #report_worker_error(_) ⇒ Object
- #reset_stats(stat_names) ⇒ Object
- #reset_worker_error ⇒ Object
- #worker_errors ⇒ Object
Constructor Details
#initialize(queue) ⇒ BuildRecord
Returns a new instance of BuildRecord.
7 8 9 10 11 |
# File 'lib/ci/queue/build_record.rb', line 7 def initialize(queue) @queue = queue @error_reports = {} @stats = {} end |
Instance Attribute Details
#error_reports ⇒ Object (readonly)
Returns the value of attribute error_reports.
5 6 7 |
# File 'lib/ci/queue/build_record.rb', line 5 def error_reports @error_reports end |
Instance Method Details
#fetch_stats(stat_names) ⇒ Object
31 32 33 |
# File 'lib/ci/queue/build_record.rb', line 31 def fetch_stats(stat_names) stat_names.zip(stats.values_at(*stat_names).map(&:to_f)) end |
#progress ⇒ Object
13 14 15 |
# File 'lib/ci/queue/build_record.rb', line 13 def progress @queue.progress end |
#queue_exhausted? ⇒ Boolean
17 18 19 |
# File 'lib/ci/queue/build_record.rb', line 17 def queue_exhausted? @queue.exhausted? end |
#record_error(id, payload, stats: nil) ⇒ Object
21 22 23 24 |
# File 'lib/ci/queue/build_record.rb', line 21 def record_error(id, payload, stats: nil) error_reports[id] = payload record_stats(stats) end |
#record_success(id, stats: nil, skip_flaky_record: false) ⇒ Object
26 27 28 29 |
# File 'lib/ci/queue/build_record.rb', line 26 def record_success(id, stats: nil, skip_flaky_record: false) error_reports.delete(id) record_stats(stats) end |
#report_worker_error(_) ⇒ Object
39 |
# File 'lib/ci/queue/build_record.rb', line 39 def report_worker_error(_); end |
#reset_stats(stat_names) ⇒ Object
35 36 37 |
# File 'lib/ci/queue/build_record.rb', line 35 def reset_stats(stat_names) stat_names.each { |s| stats.delete(s) } end |
#reset_worker_error ⇒ Object
41 |
# File 'lib/ci/queue/build_record.rb', line 41 def reset_worker_error; end |
#worker_errors ⇒ Object
43 44 45 |
# File 'lib/ci/queue/build_record.rb', line 43 def worker_errors {} end |