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



1041
1042
1043
1044
1045
1046
1047
1048
# File 'lib/rrrspec/redis_models.rb', line 1041

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.



1053
1054
1055
1056
1057
# File 'lib/rrrspec/redis_models.rb', line 1053

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