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) ⇒ Object
Constructor Details
#initialize(queue) ⇒ BuildRecord
Returns a new instance of BuildRecord.
6 7 8 9 10 |
# File 'lib/ci/queue/build_record.rb', line 6 def initialize(queue) @queue = queue @error_reports = {} @stats = {} end |
Instance Attribute Details
#error_reports ⇒ Object (readonly)
Returns the value of attribute error_reports.
4 5 6 |
# File 'lib/ci/queue/build_record.rb', line 4 def error_reports @error_reports end |
Instance Method Details
#fetch_stats(stat_names) ⇒ Object
30 31 32 |
# File 'lib/ci/queue/build_record.rb', line 30 def fetch_stats(stat_names) stat_names.zip(stats.values_at(*stat_names).map(&:to_f)) end |
#progress ⇒ Object
12 13 14 |
# File 'lib/ci/queue/build_record.rb', line 12 def progress @queue.progress end |
#queue_exhausted? ⇒ Boolean
16 17 18 |
# File 'lib/ci/queue/build_record.rb', line 16 def queue_exhausted? @queue.exhausted? end |
#record_error(id, payload, stats: nil) ⇒ Object
20 21 22 23 |
# File 'lib/ci/queue/build_record.rb', line 20 def record_error(id, payload, stats: nil) error_reports[id] = payload record_stats(stats) end |
#record_success(id, stats: nil) ⇒ Object
25 26 27 28 |
# File 'lib/ci/queue/build_record.rb', line 25 def record_success(id, stats: nil) error_reports.delete(id) record_stats(stats) end |