Class: Horde

Inherits:
Object
  • Object
show all
Includes:
SemanticLogger::Loggable
Defined in:
lib/parallel_minion/horde.rb

Overview

A Horde is way to manage a group of Minions

Horde supports the following features for minions

  • Limit the number of Minions in the Horde to prevent overloading the system

  • Queue up requests for Minions when the lmit is reached

  • Optionally block submitting work for Minions when the queued up requests reach a specified number

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Horde

Create a new Horde of Minions

Parameters

:description
  Description for this task that the Minion is performing
  Put in the log file along with the time take to complete the task

:capacity
  Maximum number of Minions active in this Horde at any time
  Default: 10

:max_queue_size
  Maximum number of queued up requests before blocking
  new requests for work
  Default: -1 (unlimited)


39
40
# File 'lib/parallel_minion/horde.rb', line 39

def initialize(params={})
end

Instance Attribute Details

#capacityObject (readonly)

Returns the maximum number of Minions active in this Horde at any time



17
18
19
# File 'lib/parallel_minion/horde.rb', line 17

def capacity
  @capacity
end

#descriptionObject (readonly)

Returns the description for this Horde



14
15
16
# File 'lib/parallel_minion/horde.rb', line 14

def description
  @description
end

#max_queue_sizeObject (readonly)

Returns the maximum number of queued up requests before blocking new requests for work



21
22
23
# File 'lib/parallel_minion/horde.rb', line 21

def max_queue_size
  @max_queue_size
end