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



1073
1074
1075
1076
1077
1078
1079
1080
# File 'lib/rrrspec/redis_models.rb', line 1073

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.



1085
1086
1087
1088
1089
# File 'lib/rrrspec/redis_models.rb', line 1085

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