Class: Workling::Remote::Runners::BackgroundjobRunner

Inherits:
Base
  • Object
show all
Defined in:
lib/workling/remote/runners/backgroundjob_runner.rb

Instance Method Summary collapse

Methods inherited from Base

#dispatch!, #logger

Constructor Details

#initializeBackgroundjobRunner

Returns a new instance of BackgroundjobRunner.



14
15
16
17
# File 'lib/workling/remote/runners/backgroundjob_runner.rb', line 14

def initialize
  BackgroundjobRunner.routing = 
    Workling::Routing::ClassAndMethodRouting.new
end

Instance Method Details

#run(clazz, method, options = {}) ⇒ Object

passes the job to bj by serializing the options to xml and passing them to

./script/bj_invoker.rb, which in turn routes the deserialized args to the
appropriate worker.


22
23
24
25
26
27
28
29
30
31
# File 'lib/workling/remote/runners/backgroundjob_runner.rb', line 22

def run(clazz, method, options = {})
  stdin = @@routing.queue_for(clazz, method) + 
          " " + 
          options.to_xml(:indent => 0, :skip_instruct => true)
          
  Bj.submit "./script/runner ./script/bj_invoker.rb", 
    :stdin => stdin
  
  return nil # that means nothing!
end