search for: set_worker_name

Displaying 20 results from an estimated 40 matches for "set_worker_name".

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
...rom 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_email recipie...
2008 Jan 13
3
right usage of bdrb
...ndrb.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 => import_worker, :worker...
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: :schedules: :e...
2008 Jun 27
2
Tests failing when using ''reload_on_schedule true''
...ll 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
...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 attachment was scrubb...
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 code: worker...
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.error "MscWo...
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(:percent_complete =&g...
2007 Dec 19
6
thread_pooling sleeping
...k_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 user_id, :progress,...
2008 Jun 04
0
Large requests break BackgrounDRb
...llo, 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(args) @payload...
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") end end...
2007 Oct 31
4
How you want BackgrounDrb to behave
...some feedback from you guys. So, please reply back. The code has changed significantly and its no longer using DRB. But I will keep the name BackgroundRb. Ok, in new API, a worker looks like this: require "net/smtp" require "guid" class NewsletterWorker < Packet::Worker set_worker_name :newsletter_worker def worker_init puts "starting the worker" end def receive_data p_data end # this is where a request from rails will be received. so implement this method # if you want to trigger your workers from rails. def receive_internal_data p_data self.sen...
2008 Jan 03
1
Thread_pool bug?
...ool (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.find(job_id)...
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[:temppath]...
2008 Jan 13
2
{worker} after :end-time worker freaks out
...s: :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 with ./script/backgr...
2007 Dec 13
1
Possible Bug & Question
...things and occassionally I''d lose Result hashes or the workers wouldn''t get created at all, so with the new version I''m trying to use only one worker and report individual correlations through a results hash, like so: def CorrelatorWorker < BackgrounDRb::MetaWorker set_worker_name :correlator_worker def create(arg) @results = Hash.new end def correlate(user_id) # This stuff takes awhile... @results[user_id] = progress register_status(@results) end end So in my code I can say MiddleMan.ask_status(:worker=>:correlator_worker)[user_id] to find the progress of cor...
2008 Mar 18
1
Polling is REALLY slow
...e. Plus, I can schedule things better this way. My first thought was to create a worker that polled for records with the correct state, but it doesn''t work as expected. Here is what I have with error checking, etc. removed: class RequestQueuePollerWorker < BackgrounDRb::MetaWorker set_worker_name :request_queue_poller_worker QUEUE_SLEEP_TIME = 30 # seconds def create(args = nil) @running = true self.poll_queue end def build_all_matches(args = nil) thread_pool.defer(args) do |args| requests = Request.find_active(:all) requests.each { |request| request.q...
2007 Dec 15
10
1) Error 2) sending request to a specific worker
...r = MiddleMan.new_worker(:worker => :xmpp_worker, :job_key => :my_key) MiddleMan.ask_work(:worker => :xmpp_worker, :worker_method => :login, :data => "test") render(:partial=>''window'') end end class XmppWorker < BackgrounDRb::MetaWorker set_worker_name :xmpp_worker set_no_auto_load true def create(args = nil) end def login end end Can someone helps me ? 2) I am creating a worker with a key : MiddleMan.new_worker(:worker => :xmpp_worker, :job_key => :my_key) Is it possible to use this key in a request to send work to a specifi...
2007 Nov 02
10
pre-release version of backgroundrb available now from svn
...d 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) end end First, I...