Module: CI::Queue

Extended by:
Queue
Included in:
Queue
Defined in:
lib/ci/queue.rb,
lib/ci/queue/file.rb,
lib/ci/queue/grind.rb,
lib/ci/queue/redis.rb,
lib/ci/queue/bisect.rb,
lib/ci/queue/common.rb,
lib/ci/queue/static.rb,
lib/ci/queue/version.rb,
lib/ci/queue/redis/base.rb,
lib/ci/queue/redis/grind.rb,
lib/ci/queue/redis/retry.rb,
lib/ci/queue/build_record.rb,
lib/ci/queue/redis/worker.rb,
lib/ci/queue/configuration.rb,
lib/ci/queue/output_helpers.rb,
lib/ci/queue/circuit_breaker.rb,
lib/ci/queue/redis/supervisor.rb,
lib/ci/queue/redis/build_record.rb,
lib/ci/queue/redis/grind_record.rb,
lib/ci/queue/redis/grind_supervisor.rb,
lib/ci/queue/redis/test_time_record.rb

Defined Under Namespace

Modules: CircuitBreaker, Common, OutputHelpers, Redis, Warnings Classes: Bisect, BuildRecord, Configuration, File, Grind, Static

Constant Summary collapse

VERSION =
'0.40.0'
DEV_SCRIPTS_ROOT =
::File.expand_path('../../../../../redis', __FILE__)
RELEASE_SCRIPTS_ROOT =
::File.expand_path('../redis', __FILE__)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#requeueableObject

Returns the value of attribute requeueable.



21
22
23
# File 'lib/ci/queue.rb', line 21

def requeueable
  @requeueable
end

#shufflerObject

Returns the value of attribute shuffler.



21
22
23
# File 'lib/ci/queue.rb', line 21

def shuffler
  @shuffler
end

Instance Method Details

#from_uri(url, config) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ci/queue.rb', line 39

def from_uri(url, config)
  uri = URI(url)
  implementation = case uri.scheme
  when 'list'
    Static
  when 'file', nil
    File
  when 'redis', 'rediss'
    require 'ci/queue/redis'
    Redis
  else
    raise ArgumentError, "Don't know how to handle #{uri.scheme} URLs"
  end
  implementation.from_uri(uri, config)
end

#requeueable?(test_result) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/ci/queue.rb', line 27

def requeueable?(test_result)
  requeueable.nil? || requeueable.call(test_result)
end

#shuffle(tests, random) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/ci/queue.rb', line 31

def shuffle(tests, random)
  if shuffler
    shuffler.call(tests, random)
  else
    tests.sort.shuffle(random: random)
  end
end