module RRRSpec::ArbiterQueue

Constants

ARBITER_QUEUE_KEY

Public Class Methods

cancel(taskset) click to toggle source

Public: Cancel the taskset.

# File lib/rrrspec/redis_models.rb, line 17
def self.cancel(taskset)
  RRRSpec.redis.rpush(ARBITER_QUEUE_KEY, "cancel\t#{taskset.key}")
end
check(taskset) click to toggle source

Public: Check if there is no tasks left in the taskset.

# File lib/rrrspec/redis_models.rb, line 27
def self.check(taskset)
  RRRSpec.redis.rpush(ARBITER_QUEUE_KEY, "check\t#{taskset.key}")
end
dequeue() click to toggle source

Public: Dequeue the task.

Returns [command_name, arg]

# File lib/rrrspec/redis_models.rb, line 39
def self.dequeue
  _, line = RRRSpec.redis.blpop(ARBITER_QUEUE_KEY, 0)
  command, arg = line.split("\t", 2)
  case command
  when 'cancel', 'check', 'fail'
    arg = Taskset.new(arg)
  when 'trial'
    arg = Trial.new(arg)
  else
    raise 'Unknown command'
  end
  return command, arg
end
fail(taskset) click to toggle source

Public: Mark taskset failed

# File lib/rrrspec/redis_models.rb, line 22
def self.fail(taskset)
  RRRSpec.redis.rpush(ARBITER_QUEUE_KEY, "fail\t#{taskset.key}")
end
trial(trial) click to toggle source

Public: Update the status of the task based on the result of the trial.

# File lib/rrrspec/redis_models.rb, line 32
def self.trial(trial)
  RRRSpec.redis.rpush(ARBITER_QUEUE_KEY, "trial\t#{trial.key}")
end