module Taskinator

:nocov:

:nocov:

Constants

DEFAULTS
LICENSE
NAME
VERSION

Attributes

queue_adapter[R]

the queue adapter to use supported adapters include :delayed_job, :redis and :sidekiq NOTE: ensure that the respective gem is included

queue_config[R]

configuration, usually a hash, which will be passed to the configured queue adapter

Public Class Methods

configure() { |self| ... } click to toggle source

Configuration for Taskinator client, use like:

Taskinator.configure do |config|
  config.redis = { :namespace => 'myapp', :pool_size => 1, :url => 'redis://myhost:8877/0' }
  config.queue_config = { :process_queue => 'processes', :task_queue => 'tasks' }
end
# File lib/taskinator.rb, line 66
def configure
  yield self if block_given?
end
generate_uuid() click to toggle source
# File lib/taskinator.rb, line 54
def generate_uuid
  SecureRandom.uuid
end
instrumenter() click to toggle source

set the instrumenter to use. can be ActiveSupport::Notifications

# File lib/taskinator.rb, line 129
def instrumenter
  @instrumenter ||= NoOpInstrumenter.new
end
instrumenter=(value) click to toggle source
# File lib/taskinator.rb, line 132
def instrumenter=(value)
  @instrumenter = value
end
logger() click to toggle source
# File lib/taskinator.rb, line 83
def logger
  Taskinator::Logging.logger
end
logger=(log) click to toggle source
# File lib/taskinator.rb, line 87
def logger=(log)
  Taskinator::Logging.logger = log
end
options() click to toggle source
# File lib/taskinator.rb, line 47
def options
  @options ||= DEFAULTS.dup
end
options=(opts) click to toggle source
# File lib/taskinator.rb, line 50
def options=(opts)
  @options = opts
end
queue() click to toggle source
# File lib/taskinator.rb, line 119
def queue
  @queue ||= begin
    adapter = self.queue_adapter || :resque
    config = queue_config || {}
    Taskinator::Queues.create_adapter(adapter, config)
  end
end
queue_adapter=(adapter) click to toggle source
# File lib/taskinator.rb, line 105
def queue_adapter=(adapter)
  @queue_adapter = adapter
  @queue = nil
end
queue_config=(config) click to toggle source
# File lib/taskinator.rb, line 114
def queue_config=(config)
  @queue_config = config
  @queue = nil
end
redis(&block) click to toggle source
# File lib/taskinator.rb, line 70
def redis(&block)
  raise ArgumentError, "requires a block" unless block_given?
  redis_pool.with(&block)
end
redis=(hash) click to toggle source
# File lib/taskinator.rb, line 79
def redis=(hash)
  @redis = Taskinator::RedisConnection.create(hash)
end
redis_pool() click to toggle source
# File lib/taskinator.rb, line 75
def redis_pool
  @redis ||= Taskinator::RedisConnection.create
end
statsd_client() click to toggle source
# File lib/taskinator.rb, line 91
def statsd_client
  Taskinator::LogStats.client
end
statsd_client=(client) click to toggle source
# File lib/taskinator.rb, line 95
def statsd_client=(client)
  Taskinator::LogStats.client = client
end