Showing posts with label backgroundrb. Show all posts
Showing posts with label backgroundrb. Show all posts

Monday, August 24, 2009

Using BackgrounDRb

Since I'm having so many issues with BackgrounDRb, I thought I should write down how I'm solving issues - I expect some other people are also experiencing! ;)
I'm assuming that you have already installed it, but if not I wrote up some basic notes here.

Monitoring the task queue


# script/console
# MiddleMan.all_worker_info

This will show you what workers are available, and what if they are currently running.


From Code


#!/usr/bin/env ruby

RAILS_ROOT = '.'

#load required rails and backgroundrb files
require File.dirname(__FILE__) + '/../config/boot'
require File.dirname(__FILE__) + '/../config/environment'
require 'erb'
$LOAD_PATH << "#{RAILS_ROOT}/vendor/plugins/backgroundrb/lib" require "#{RAILS_ROOT}/vendor/plugins/backgroundrb/lib/backgroundrb.rb" class BackgroundMonitor def test begin puts "Raw data:" puts MiddleMan.all_worker_info puts puts "Individual:" puts MiddleMan.all_worker_info.values.flatten.select { |w| puts w[:worker] puts " key = #{w[:worker_key]}" puts " status = #{w[:status]}" } rescue puts "Some kind of problem occurred..." end end end monitor = BackgroundMonitor.new monitor.test

Sunday, August 23, 2009

Installing BackgrounDRb

BackgrounDRb is a job scheduling library for the ruby programming language.

I had a right old ding dong with it when trying to install it into a rails app I'm working on, what with the documentation being a little out of date (I think) plus there being a load of confusing page on the net. In the end what worked for me was:

# sudo gem install chronic packet
# cd rails_app
# script/plugin install http://svn.devjavu.com/backgroundrb/trunk
# rake backgroundrb:setup
# rake db:migrate

So far this has worked for me...