[Backgroundrb-devel] Arity?

Walter McGinnis walter at katipo.co.nz
Thu Dec 27 23:20:20 EST 2007


First off, nice improvements hemant!  Thanks for all the hard work.  I  
just whipped up a new worker for a scheduled job that sends digest  
emails.  Very smooth.

However, moving some of my old backgroundrb into new backgroundrb  
isn't going quite as smoothly.  I have a import worker that takes a  
number of parameters and then is started dynamically.  Here's the a  
snippet of the worker code:

class PastPerfect4ImporterWorker < BackgrounDRb::MetaWorker
   set_worker_name :past_perfect4_importer_worker
   set_no_auto_load true

   # importer has the version of methods that will work in the context
   # of backgroundrb
   include Importer

   def create(args = nil)
     @successful = false
     @last_related_topic = nil
     @last_related_topic_pp4_objectid = nil
     @import_field_to_extended_field_map = Hash.new

     @attributions = Hash.new

     logger.info('PastPerfect4ImporterWorker started')

     @results = { :do_work_time => Time.now.to_s,
       :done_with_do_work => false,
       :records_processed => 0 }


   def do_work(args = nil)
       logger.debug("in worker")

I get to the create method's logger message, but not the first do_work  
logger call.

Here's the "ask_work" call:

MiddleMan.new_worker(:worker => @worker_type, :job_key => :importer)
     MiddleMan.ask_work(:worker => @worker_type,
                         :job_key => :importer,
                         :worker_method => :do_work,
                         :data => {
                           :zoom_class => @zoom_class,
                           :import_topic_type => @import_topic_type,
                           :import_type => @import_type,
                           :import_dir_path => @import_dir_path,
                           :import_parent_dir_for_image_dirs =>  
                           :params => params,
                           :import_request => import_request,
                           :default_attribution => @default_attribution,
                           :contributing_user =>  
@contributing_user.id })

I know that @worker_type is set correctly because of the log.

And in the log I get:

PastPerfect4ImporterWorker started
past_perfect4_importer_worker started
Schedules for worker loaded
do_work {:zoom_class=>"StillImage", ... :default_attribution=>"Some  
jerk wrote this.", :import_type=>"past_perfect4"}
Arity of method is -1

That seems to be the end of the road for the worker.  It just stalls  
there from what I can tell.  What does Arity mean?

Any clues?  I suspect it's something small I'm missing.

Also, I replaced this on line 210 of server/meta_worker.rb:

       logger.info "#{user_input[:worker_method]} #{user_input[:data]}"

with this:

       logger.info "#{user_input[:worker_method]}  

for nicer debugging formatting.  Seems like it might be a nice  

Walter McGinnis

Kete Project Lead
Katipo Communications, Ltd.

More information about the Backgroundrb-devel mailing list