Questions tagged [backgroundrb]

BackgrounDRb is a Ruby job server and scheduler

BackgrounDRb is a Ruby job server and scheduler.

Its main intent is to be used with Ruby on Rails applications for offloading long-running tasks. Since a Rails application blocks while serving a request it is best to move long-running tasks off into a background process that is divorced from http request/response cycle.

http://backgroundrb.rubyforge.org/

17 questions
7
votes
3 answers

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…
jsharpe
  • 2,546
  • 3
  • 26
  • 42
6
votes
4 answers

Best rails solution for a mailer that runs every minute

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…
vrish88
  • 20,047
  • 8
  • 38
  • 56
2
votes
1 answer

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…
William Yeung
  • 10,368
  • 9
  • 36
  • 42
2
votes
0 answers

Command not found error for starting backgroundrb

Getting error while starting the backgroundrb job. command: sanjaya:-/Documents/proj_location $ sudo ./script/backgroundrb start error: sudo: ./script/backgroundrb: command not found Searched through Internet but not getting any feasible…
sanjaya s
  • 19
  • 4
2
votes
1 answer

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…
Max Caceres
  • 1,976
  • 3
  • 18
  • 18
2
votes
2 answers

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

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…
AndreDurao
  • 5,600
  • 7
  • 41
  • 61
2
votes
2 answers

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 * * * * …
salt.racer
  • 21,903
  • 14
  • 44
  • 51
1
vote
1 answer

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 =…
eploko
  • 5,347
  • 2
  • 28
  • 23
1
vote
1 answer

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…
Trevor
  • 6,659
  • 5
  • 35
  • 68
0
votes
1 answer

Rails 3 - psych.rb - couldn't parse YAML

While integrating backgroundrb-rails3 I get the following error, ~/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:148:in `parse': couldn't parse YAML at line 8 column 22 (Psych::SyntaxError) from…
nkm
  • 5,844
  • 2
  • 24
  • 38
0
votes
1 answer

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…
eploko
  • 5,347
  • 2
  • 28
  • 23
0
votes
2 answers

Need help designing my first Rails app! (involves Twitter, databases, background processes)

Firstly let me mention that I'm new to web-frameworks. I have to write my first web-app for a Uni project. I spent two weeks learning Grails and Django. Started working with Rails yesterday and loved it. So I've decided to go with it and discard…
0
votes
1 answer

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…
u24s
  • 43
  • 1
  • 4
0
votes
1 answer

BackgrounDRB + Ruby script

I "would like" to schedule a ruby script with BackgrounDRb. Is it possible? I read the examples from these two websites, but I didn't find an answer: BackgrounDRb Using BackgrounDRb asynchronously Thank you.
Maurice
  • 2,129
  • 2
  • 25
  • 33
0
votes
1 answer

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…
Julien
  • 1,158
  • 9
  • 19
1
2