Module: RRRSpec::TasksetEstimation

Defined in:
lib/rrrspec/redis_models.rb

Class Method Summary collapse

Class Method Details

.estimate_secs(taskset_class) ⇒ Object

Public: Return the cache on the estimated execution time of the specs.

Returns a hash of spec_file to estimate_sec



1017
1018
1019
1020
1021
1022
1023
1024
# File 'lib/rrrspec/redis_models.rb', line 1017

def self.estimate_secs(taskset_class)
  h = RRRSpec.redis.hgetall(RRRSpec.make_key('rrrspec', 'estimate_sec', taskset_class))
  estimate_secs = {}
  h.each do |spec_file, estimate_sec|
    estimate_secs[spec_file] = estimate_sec.to_i
  end
  return estimate_secs
end

.update_estimate_secs(taskset_class, estimation) ⇒ Object

Public: Update the estimation.

The estimation argument should be a hash like => 20.



1029
1030
1031
1032
1033
# File 'lib/rrrspec/redis_models.rb', line 1029

def self.update_estimate_secs(taskset_class, estimation)
  return if estimation.empty?
  key = RRRSpec.make_key('rrrspec', 'estimate_sec', taskset_class)
  RRRSpec.redis.hmset(key, *estimation.to_a.flatten)
end