Module: EQ
- Extended by:
- SingleForwardable
- Defined in:
- lib/eq.rb,
lib/eq-web.rb,
lib/eq/job.rb,
lib/eq/error.rb,
lib/eq/logging.rb,
lib/eq/version.rb
Defined Under Namespace
Modules: Logging, Queueing, Scheduling, Web, Working
Classes: ConfigurationError, Error, Job
Constant Summary
collapse
- DEFAULT_CONFIG =
{
queue: 'sequel',
sequel: 'sqlite:/',
job_timeout: 5, worker_pool_size: Celluloid.cores, worker_delay: 0
}.freeze
- VERSION =
'0.1.0'
Class Method Summary
collapse
Class Method Details
.alive? ⇒ Boolean
52
53
54
55
56
57
|
# File 'lib/eq.rb', line 52
def alive?
alive = false
alive &= queue.alive? if queue
alive &= worker.alive? if worker
alive
end
|
.boot(just = nil) ⇒ Object
this boots queuing and working optional: to use another queuing or working subsystem just do require ‘eq/working’ or require ‘eq/queueing’ instead of require ‘eq/all’
37
|
# File 'lib/eq.rb', line 37
def boot just=nil; manage :boot, just; end
|
.config {|@config| ... } ⇒ Object
28
29
30
31
32
|
# File 'lib/eq.rb', line 28
def config
@config ||= OpenStruct.new DEFAULT_CONFIG
yield @config if block_given?
@config
end
|
.logger ⇒ Object
59
|
# File 'lib/eq.rb', line 59
def logger; Celluloid.logger; end
|
.manage(action, just = nil) ⇒ Object
67
68
69
70
71
72
|
# File 'lib/eq.rb', line 67
def manage action, just=nil
what = just ? just.to_s : "queue work schedul"
EQ::Queueing.send(action) if what =~ /queue/ && queueing_loaded?
EQ::Working.send(action) if what =~ /work/ && working_loaded?
EQ::Scheduling.send(action) if what =~ /schedu/ && working_loaded?
end
|
.queue ⇒ Object
40
|
# File 'lib/eq.rb', line 40
def queue; EQ::Queueing.queue if queueing_loaded?; end
|
.queueing_loaded? ⇒ Boolean
61
|
# File 'lib/eq.rb', line 61
def queueing_loaded?; defined? EQ::Queueing; end
|
.scheduling_loaded? ⇒ Boolean
63
|
# File 'lib/eq.rb', line 63
def scheduling_loaded?; defined? EQ::Scheduling; end
|
.shutdown(just = nil) ⇒ Object
38
|
# File 'lib/eq.rb', line 38
def shutdown just=nil; manage :shutdown, just; end
|
.worker ⇒ Object
41
|
# File 'lib/eq.rb', line 41
def worker; EQ::Working.worker if working_loaded?; end
|
.working_loaded? ⇒ Boolean
62
|
# File 'lib/eq.rb', line 62
def working_loaded?; defined? EQ::Working; end
|