[Backgroundrb-devel] Feedback on RC2

hemant kumar gethemant at gmail.com
Thu Dec 6 21:22:34 EST 2007


On Thu, 2007-12-06 at 16:31 -0800, Andy Tyra wrote:
> Hi There,
> 
> Thanks for the help!  I have made some progress.
> 
> It looks like the worker is crashing because it is not getting passed
> the argument that it requires to run.  That would explain why kicking
> this worker off manually worked just fine, but doing so in the
> scheduler did not.  The problem is, I need to be able to pass a
> parameter to this worker's function using the scheduling YML and that
> doesn't seem to be working.  Perhaps you can help troubleshoot? 
> 
> Here is the relevant method from the worker which is named
> ExpireAndRefreshWorker:
> 
>   def execute_report(report_name)
>         myReport = Report.new(report_name)
>         begin
>                 File.delete (File.join(RAILS_ROOT, 'public','reports',
> myReport.const_name + '.html'))
>         rescue
>                 #do nothing
>         end
>         renderController = FakeTest.new
>         renderController.render_report (myReport)
>   end
> 
> As you can see, it takes one parameter, report_name, which should be a
> string.
> 
> Here's the YML I'm trying to use to schedule it:
> 
> :schedules:
>   :expire_and_refresh_worker: 
>     :worker_method: execute_report
>     :data: unfilled_demand
>     :trigger_args: 0 */15 * * * * *
>     :job_key: unfilled_demand_schedule

Thanks Andy.. with new version you were not able to pass arguments from
configuration file and hence the error. But I have fixed this in trunk
and your old code should work as usual.

> 
> And here's the stack trace of the exception that is thrown when the
> schedule triggers:  (Please note that the line numbers in my stack
> trace will not match yours for script/backgroundrb.  I've added some
> additional tasks to this script that add YML scheduling 
> 
> rails-root/vendor/plugins/backgroundrb/server/meta_worker.rb:91:in
> `execute_report': wrong number of arguments (0 for 1) (ArgumentError)
>         from
> rails-root/vendor/plugins/backgroundrb/server/meta_worker.rb:91:in
> `send' 
>         from
> rails-root/vendor/plugins/backgroundrb/server/meta_worker.rb:91:in
> `check_for_timer_events'
>         from
> rails-root/vendor/plugins/backgroundrb/framework/core.rb:129:in
> `start_reactor'
>         from
> rails-root/vendor/plugins/backgroundrb/framework/core.rb:128:in
> `loop' 
>         from
> rails-root/vendor/plugins/backgroundrb/framework/core.rb:128:in
> `start_reactor'
>         from
> rails-root/vendor/plugins/backgroundrb/framework/worker.rb:21:in
> `start_worker'
>         from
> rails-root/vendor/plugins/backgroundrb/framework/packet_master.rb:152:in `fork_and_load' 
>         from
> rails-root/vendor/plugins/backgroundrb/framework/packet_master.rb:111:in `load_workers'
>         from
> rails-root/vendor/plugins/backgroundrb/framework/packet_master.rb:106:in `each'
>         from
> rails-root/vendor/plugins/backgroundrb/framework/packet_master.rb:106:in `load_workers' 
>         from
> rails-root/vendor/plugins/backgroundrb/framework/packet_master.rb:19:in `run'
>         from
> rails-root/vendor/plugins/backgroundrb/server/master_worker.rb:114:in
> `initialize'
>         from script/backgroundrb:73:in `new' 
>         from script/backgroundrb:73
> 
> It appears the parameter specified as :data in the yml is not getting
> passed to the function.  Is there some other way this should be done?
> I don't see it in the doco.  Is it done as :args like in the old
> version? 
> 
> Also, this is unrelated, but I just thought I'd point it out.  The
> following stack trace appears in the logs when stopping backgroundrb:
> 
> rails-root/config/../vendor/plugins/backgroundrb/lib/../framework/nbio.rb:20:in `read_data': Packet::DisconnectError (Packet::DisconnectError) 
>         from
> rails-root/vendor/plugins/backgroundrb/framework/worker.rb:47:in
> `handle_internal_messages'
>         from
> rails-root/vendor/plugins/backgroundrb/framework/core.rb:138:in
> `start_reactor'
>         from
> rails-root/vendor/plugins/backgroundrb/framework/core.rb:136:in
> `each' 
>         from
> rails-root/vendor/plugins/backgroundrb/framework/core.rb:136:in
> `start_reactor'
>         from
> rails-root/vendor/plugins/backgroundrb/framework/core.rb:128:in `loop'
>         from
> rails-root/vendor/plugins/backgroundrb/framework/core.rb:128:in
> `start_reactor' 
>         from
> rails-root/vendor/plugins/backgroundrb/framework/worker.rb:21:in
> `start_worker'
>         from
> rails-root/vendor/plugins/backgroundrb/framework/packet_master.rb:152:in `fork_and_load'
>         from
> rails-root/vendor/plugins/backgroundrb/framework/packet_master.rb:128:in `start_worker' 
>         from
> rails-root/vendor/plugins/backgroundrb/server/master_worker.rb:115:in
> `initialize'
>         from
> rails-root/vendor/plugins/backgroundrb/framework/packet_master.rb:18:in `run'
>         from
> rails-root/vendor/plugins/backgroundrb/server/master_worker.rb:114:in
> `initialize' 
>         from script/backgroundrb:73:in `new'
>         from script/backgroundrb:73
> 
> And, a question.  I think I've figured out where everything is getting
> logged.  Will this version eventually log things like the old version?
> The old version would report when workers stopped and started, when
> schedules were loaded and triggered, etc.  Is there somewhere you'd
> like this sort of thing submitted as a feature request? 

Ok, its not a big deal...We can change so as it logs all such things. 
Thanks for reports.






More information about the Backgroundrb-devel mailing list