search for: metaworker

Displaying 20 results from an estimated 51 matches for "metaworker".

2008 Jan 13
3
right usage of bdrb
...---- backgroundrb.yml - - - - - - - :backgroundrb: :ip: 0.0.0.0 :port: 11006 :environment: production :schedules: :syndication_worker: :checksyndicate: :trigger_args: 0 5 * * * * * - - - - - - - syndication_worker.rb - - - - - - - class SyndicationWorker < BackgrounDRb::MetaWorker set_worker_name :syndication_worker def create(args = nil) # this method is called, when worker is loaded for the first time end def checksyndicate syndications = # all Syndication in this hour syndications.each do |syndication| MiddleMan.ask_work(:worker => imp...
2008 May 19
0
uninitialized constant BackgrounDRb::MetaWorker (NameError)
...he Backgroundrb server. After doing this: $ ./script/backgroundrb/start I am getting following error: ??????????????????????????????? vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:263:in `load_missing_constant'': uninitialized constant BackgrounDRb::MetaWorker (NameError) from /home/shashank/atul/live_apps/7_qlubb/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:452:in `const_missing'' from ./script/backgroundrb/../../config/../lib/workers/mailreceiver_worker.rb:3 ??????????????????????????- Here is my worker...
2008 Jan 18
8
Query All Worker
What does the method query_all_workers() do? There is no documentation on what this method returns (1.0.1 version). Orion -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20080118/9f9b8112/attachment.html
2008 May 03
2
backgroundrb / actionmailer / sendmail
...send emails from a backgroundrb worker and the email doesn''t send. I get no log messages in the sendmail log or the system log, nothing in the backgroundrb logs at all, nothing in the production log. Below is my code for each component worker: class QuizReviewerWorker < BackgrounDRb::MetaWorker set_worker_name :quiz_review_sender def create(args = nil) end def send_review_emails mail = Notifier.create_test_email status = Notifier.deliver(mail) logger.info ''test mail:'' + mail.body end end mailer: class Notifier < ActionMailer::Base def test...
2008 Jan 28
4
Scheduling same worker/method at different times with different args
I need to run the same worker''s method twice per day with different arguments. Unfortunately, only the second entry in the schedule is firing. I created an experimental worker to verify this: Worker: class ExperimentWorker < BackgrounDRb::MetaWorker set_worker_name :experiment_worker def create(args = nil) # this method is called, when worker is loaded for the first time end def experiment(args = {}) logger.info "#{Time.now} - Experiment fired at #{args[:repeat_second]} second mark." end end In backgroundrb.yml...
2008 Jun 27
2
Tests failing when using ''reload_on_schedule true''
..., my tests will no longer run with the following exception: Starting ferret DRb server.../Users/revelation/projects/revelation-project/config/../lib/workers/alert_worker.rb:3: undefined method `reload_on_schedule'' for AlertWorker:Class (NoMethodError) class AlertWorker < BackgrounDRb::MetaWorker set_worker_name :alert_worker reload_on_schedule true ... end Anyone else seen this? Thanks! dan
2008 Jun 04
2
Handling exceptions
...uld want that worker to just silently fail and be optimistic that it was an edge case that won''t happen every time the worker is invoked. As of now, I''ve just added some basic exception handling to log the error for future inspection like so: class EmailWorker < BackgrounDRb::MetaWorker set_worker_name :email_worker def run(data = nil) do_stuff rescue Exception => ex logger.info ex end end Is this generally the practice for doing exception handling within workers or is there another approach? Regards, Aaron -------------- next part -------------- An HTML att...
2007 Nov 02
10
pre-release version of backgroundrb available now from svn
...f ActiveRecord objects is not supported. Although, We can do that, but in most situations, passing ''id'' of object is enough i thought. Also, you may encounter some bugs when you are passing large objects around. I will try to explain meat of a sample worker: class FooWorker < MetaWorker set_worker_name :foo_worker attr_accessor :count def worker_init puts "Starting Foo Worker" add_periodic_timer(4) { increment_status} end def process_request p_data p p_data end def increment_status @count ||= 0 @count += 1 register_status(@count)...
2008 Apr 04
5
First call to worker method doesn''t work
I have a worker as follows: class SampleWorker < BackgrounDRb::MetaWorker set_worker_name :sample_worker def create(args = nil) # this method is called, when worker is loaded for the first time end def my_method # Deliver test e-mail message Notifications.deliver_message(1, "DM") end end I have a rails controller that calls the following...
2007 Dec 21
7
Using my models
I''m working on upgrading my app to the latest version of backgroundrb. Everything went find until I tried to execute my tasks. Here is my simple worker for testing: class MscWorker < BackgrounDRb::MetaWorker set_worker_name :msc_worker def create(args = nil) # this method is called, when worker is loaded for the first time end # Send a message to everyone def send_message_to_all(args = nil) Message.send_to_everyone(args[:sender], args[:subject], args[:body], false) rescue logger...
2008 Mar 19
2
problem with worker status
Hi, I have a page were users can start jobs that may take several hours to run. BackgrounDrb is perfect for me and seems to be working well most of the time but some times I have the following problem: My worker is set up like this: class UploadWorker < BackgrounDRb::MetaWorker set_worker_name :upload_worker set_no_auto_load(true) def create(args = nil ) file = args[:file] sample_id = args[:sample_id] @user_id = args[:user_id] @submission_time = Time.now percent_complete = 0 total_count = get_total_count(file) register_status(:pe...
2007 Dec 19
6
thread_pooling sleeping
...MiddleMan.ask_work(:worker => :foo_worker, :worker_method => :perform_task, :data => { :user_id = current_user.id }) end def check_job @status = MiddleMan.ask_status(:worker => :foo_worker)[current_user.id] end My worker is something like: class FooWorker < BackgrounDRb::MetaWorker set_worker_name :foo_worker def create(args=nil) @mutex = Mutex.new @mutex.synchronize do @statuses = {} register_status(@statuses) end end def do_task(some_user_id) thread_pool.defer(some_user_id) do |user_id| user = User.find user_id save_status us...
2008 Jun 04
0
Large requests break BackgrounDRb
Hello, I think I may have discovered a bug in BackgrounDRb. It seems that when the data being requested is large (via send_request), say in the range of 64k+, it crashes or at least incapacitates BackgrounDRb. For example, take these two workers: class SmallWorker < BackgrounDRb::MetaWorker set_worker_name :small_worker set_no_auto_load(true) attr_reader :payload def create(args) @payload = ''s '' * 512 end end class LargeWorker < BackgrounDRb::MetaWorker set_worker_name :large_worker set_no_auto_load(true) attr_reader :payload def create(...
2007 Dec 20
1
mocking a few things in the test helper
When using the provided bdrb_test_helper, I was getting some undefined methods (register_status, thread_pool, etc) in unit tests. The README says to go ahead and stub out methods that need it, and send the patch to the list, so here it is (attached). Also, the MetaWorker initialize method was written as "initializes", causing the @logger never to be set, causing undefined method errors reported as nil.info and nil.debug (nil being the ''logger'' method). - Jason L. -- My Rails and Linux Blog: http://offtheline.net -------------- next p...
2008 Jan 22
1
Newbie question on Scheduling
I''ve scheduled cron jobs etc before, but I''m curious as to how to layout a worker properly. Here''s a basic example of what one of my workers looks like: class FooWorker < BackgrounDRb::MetaWorker set_worker_name :foo_worker def create(args = nil) logger.info("Starting test: #{Time.now.strftime("%T")}") run_test logger.info("Finished test: #{Time.now.strftime("%T")}") exit end def run_test logger.info("aaaa") sleep(30) logger.info("bbbb&...
2008 May 21
2
Schedule write errors?
My BackgrounDRb server intermittently bails out with the following exception in the middle of a long running task running on a Worker sub classed from BackgrounDRb::MetaWorker (the point at which it raises this exception is different each time it runs) /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/packet_core.rb:145:in `schedule_write'': You have a nil object when you didn''t expect it! (NoMethodError) The error occurred while evaluating nil.i...
2008 Jan 03
1
Thread_pool bug?
...the thread_pool (sorry for the dup, I didn''t see the first go through). To try and track things down, I made a change based on a suggestion found in the archives. I moved my import contacts worker to its own file and set the pool_size to 1. class ImportContactsWorker < BackgrounDRb::MetaWorker set_worker_name :import_contacts_worker pool_size(1) def create(args = nil) # Restart any import jobs that didn''t complete or start ImportJob.process_all_ready end def import_contacts(args = nil) thread_pool.defer(args) do |job_id| begin job = ImportJob....
2008 May 04
3
Rails Configuration in Workers
I override some Rails'' configuration options in my project, like: config.database_configuration_file = "#{RAILS_ROOT}/local/config/ database.yml" But they aren''t picked up in BackgroundRB because Rails ActiveRecord is just initialized directly in MasterWorker#load_rails_env: db_config_file = YAML.load(ERB.new(IO.read("#{RAILS_HOME}/
2008 Jan 17
2
Inconsistent Model creation behavior
Hi, I have a relatively simple Worker: (I added the line numbers to the email, they are not in the worker) ##################################################################################### class ImagetestWorker < BackgrounDRb::MetaWorker set_worker_name :imagetest_worker def create(args = nil) end def save_image(args) @newbook = Book.new @newbook.comment = "hello" @newbook.save 14 @newerimage = Image.new 15 @newerimage.user_id = args[:user_id] 16 @newerimage.uploaded_data = args...
2008 Jan 13
2
{worker} after :end-time worker freaks out
...ment :schedules: :mytest_worker: :doit: :trigger_args: :start: <%= Time.now + 1.seconds %> :end: <%= Time.now + 1.minute %> :repeat_interval: <%= 10.seconds %> - - - - - - mytest_worker.rb - - - - - - class MytestWorker < BackgrounDRb::MetaWorker set_worker_name :mytest_worker def create(args = nil) # this method is called, when worker is loaded for the first time @counter=0 end def doit @counter += 1 logger.debug("mytest: doit #{@counter} - #{Time.now}") end end - - - - - - After i start bdrb w...