Class: CI::Queue::BuildRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/ci/queue/build_record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_reportsObject (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

#progressObject



13
14
15
# File 'lib/ci/queue/build_record.rb', line 13

def progress
  @queue.progress
end

#queue_exhausted?Boolean

Returns:

  • (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_errorObject



41
# File 'lib/ci/queue/build_record.rb', line 41

def reset_worker_error; end

#worker_errorsObject



43
44
45
# File 'lib/ci/queue/build_record.rb', line 43

def worker_errors
  {}
end