Module: Bluth::Handler
- Included in:
- ExampleHandler
- Defined in:
- lib/bluth.rb
Class Method Summary collapse
Instance Method Summary collapse
- #all ⇒ Object
- #create_job(data = {}) ⇒ Object
- #engauge(data = {}, notch = nil) ⇒ Object
- #enqueue(data = {}, q = nil) ⇒ Object
- #generate_id(*args) ⇒ Object
- #prepare ⇒ Object
- #queue(name = nil) ⇒ Object
Class Method Details
Instance Method Details
#all ⇒ Object
257 258 259 260 261 |
# File 'lib/bluth.rb', line 257 def all Bluth::Gob.instances.select do |gob| gob.handler == self end end |
#create_job(data = {}) ⇒ Object
234 235 236 237 238 239 |
# File 'lib/bluth.rb', line 234 def create_job data={} gob = Gob.create generate_id(data), self, data gob.created gob.attempts = 0 gob end |
#engauge(data = {}, notch = nil) ⇒ Object
224 225 226 227 228 229 230 231 232 |
# File 'lib/bluth.rb', line 224 def engauge(data={}, notch=nil) notch ||= Bluth::TimingBelt.notch 1 gob = create_job data gob.notch = notch.name gob.save Familia.ld "ENNOTCHING: #{self} #{gob.jobid.short} to #{notch.rediskey}" if Familia.debug? notch.add gob.jobid gob end |
#enqueue(data = {}, q = nil) ⇒ Object
241 242 243 244 245 246 247 248 249 |
# File 'lib/bluth.rb', line 241 def enqueue(data={}, q=nil) q = self.queue(q) if q.nil? || Symbol === q gob = create_job data gob.current_queue = q.name gob.save Familia.ld "ENQUEUING: #{self} #{gob.jobid.short} to #{q}" if Familia.debug? q << gob.jobid gob end |
#generate_id(*args) ⇒ Object
254 255 256 |
# File 'lib/bluth.rb', line 254 def generate_id(*args) [self, Process.pid, Bluth.sysinfo.hostname, Time.now.to_f, *args].gibbler end |
#prepare ⇒ Object
262 263 |
# File 'lib/bluth.rb', line 262 def prepare end |