backgroundrb

Backgroundrb scheduled task ending

I have a backroundrb scheduled task that takes quite a long time to run. However it seems that the process is ending after only 2.5 minutes. My background.yml file: :schedules: :named_worker: :task_name: :trigger_args: 0 0 12 * * * * :data: input_data I have zero activity on the server when the process is running. (...

Where is the correct place to initialize the DRb service within a Rails application?

I'm using DRb within a Rails application to offload an expensive task outside the Rails process. Before initializing the client stub with DRbObject.new it is necessary to initialize the DRb service with DRb.start_service. Doing this in model or controller appears to leave threads in an uncertain state. When I exit mongrel it says: Reap...

backgroundrb thread_pool.defer method logger output goes to where?

It seems like due to the threading issue logger.warn (thats what I tested) doesn't generate any output? my code is similar to this: def deliver(args) logger.info "delivery start" thread_pool.defer(:deliver_deferred, args) logger.info "delivery end" end def deliver_deferred(args) logger.warn "whatsoever" end Any idea? ...

Best rails solution for a mailer that runs every minute

Hello, I have an application that checks a database every minute for any emails that are supposed to be sent out at that time. I was thinking about making this a rake task that would be run by a cron job every minute. Would there be a better solution to this? From what I have read, this isn't ideal because rake has to load the entire ra...

How do I code a rake task to trigger a BackgrounDRb task?

I have a BackgrounDRb worker set up to run its 'sync' method every 15 minutes. Then, say, I want to run the method once just now. I was trying to wrap that in a rake task as follows: namespace :mytasks do task :sync do |t| worker = MiddleMan.worker(:my_worker) worker.async_sync end end But this doesn't work. It bails out w...

How to prevent backgroundrb from starting multiple copies of the same task?

Say, I have a worker that's set up to run every 15 minutes using the cron scheduling feature of backgroundrb. Then, say, if a single instance of the worker takes longer than 15 minutes to run, I don't want a second worker to be started in paraller by backgroundrb. How do I achieve that? ...

How to recover cancelled (taken) jobs in case of BackgroundRB crash?

The problem: we have jobs that run from a few seconds to a few minutes in BackgroundRB from a Rails app. But, what happens when we deploy new code and restart BackgroundRB when it's performing a task? BackgroundRB does not seem to pick up any 'taken' tasks and I have not been able to find anything that can recover these tasks. Can anyo...

using Kernel#fork for backgrounding processes, pros? cons?

I'd like some thoughts on whether using fork{} to 'background' a process from a rails app is such a good idea or not... From what I gather fork{my_method; Process#setsid} does in fact do what it's supposed to do. 1) creates another processes with a different PID 2) doesn't interrupt the calling process (e.g. it continues w/o waiting f...

Rails backgroundRB plugin need to schedule it and queue to database for persistancy.

Hi, I'm trying to do the following: Run a Worker and a method within it every 15 minutes Have a log of the job last runtime, in the database table bdrd_job_queue. What I've done: I have a schedule every 15 minutes in my backgroundRB.yml file The method call has a persistent_job.finish! call, but it's not working, because the persi...

Can I disable some BackgroundRb workers during tests ?

I have a BackgroundRb worker in charge of dispatching some emails. How should I tell this worker not to run during tests? Does the framework include some configuration parameter or stub worker I could use? MiddleMan.worker(:emails_worker).async_send_mails(:arg => {:emails => emails}) ...

How to pass more than one argument to a worker at backgroundrd

Hello! I'm trying to pass a list of arguments to a backgroundrb in documentation it says: MiddleMan.worker(:billing_worker).async_charge_customer(:arg => current_customer.id) but it only works for just one argument, I tried these but none worked for me args => [1,2,3] args => {:t=>"t", :r=> "r"} any ideas how to solve this?? ...

Long running tasks in Rails

I have a controller that generates HTML, XML, and CSV reports. The queries used for these reports take over a minute to return their result. What is the best approach to run these tasks in the background and then return the result to the user? I have looked into Backgroundrb. Is there anything more basic for my needs? ...

Sending and receiving IM messages via controller in Rails

Hi, I need a way to handle XMPP communication in my Rails app. My requirements are: Keep an instance of XMPP client running and logged in as one specific user (my bot user) Trigger an event from a controller to send a message and wait for a reply. The message is sent to another machine equipped with a bot so that the reply is sup...

Is there an easy way to have backgroundrb started with server?

Is there an easy way to have backgroundrb started (restarted) when the server reboots? Ex. What if your hosting use mongrel cluster and you have no access to it (except start/stop) One of solution i found on forums is code snippet in backgroundrb plugin with check for PID exist (if not exist start with exec or system) etc. Just your id...