Hi,
Thanks for the help getting the new backgroundrb working, things are
working fabulously now.
I have two questions:
1) I have a few basic methods I need available on all my workers in
order to communicate properly with my application... it seems to make
the most sense right now to subclass BackgrounDRb::MetaWorker, or make
a mixin module, because I'm actually extending some of the base
methods as well (like the exit method, which I have extended to update
status information in a central queue monitor). Is there a proper
place to put in custom code that extends BackgrounDrb, so that it is
automatically loaded by the server before the workers are instantiated
(sort of like an environment.rb)?
2) I have one application server that runs Rails and does all the
user interface, but several (10+) servers running backgroundrb to do
all the heavy lifting (we do a lot of hi-res image processing,
requires many CPU's). I have a central monitor that monitors what
servers are available to run which tasks, and load balances the tasks
across all the available backgroundrb servers, instantiating a
MiddleMan for the correct server and then sending the job request to
that server. Needless to say, this process is going a lot easier with
the new version, except for one catch. With the old backgroundrb, I
was able to connect to an arbitrary server like this:
thisMiddleMan = DRbObject.new(nil, "druby://#{server_name}:22223");
Now this doesn't work. So, I took a look at
BackgrounDRb::WorkerProxy, and it seems like it can only connect to
the server listed in the config file. Is there supposed to be a way
to manage multiple backgroundrb servers? I've read the manual, it's
not in there. My solution so far is to subclass WorkerProxy, with a
new init method that takes the host and port as parameters:
class BackgrounDRb::CustomProxy < BackgrounDRb::WorkerProxy
def self.init(ip, port)
@@config = BackgrounDRb::Config.read_config("#{BACKGROUNDRB_ROOT}/
config/backgroundrb.yml")
@@server_ip = ip
@@server_port = port
new
end
end
But this doesn't seem very elegant to me, I worry about future
software updates... Is there a clean method for doing this or is this
just not supported (yet)?
Thanks for any insight, really appreciate it!
--
Steve
_______________________________________________
Backgroundrb-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/backgroundrb-devel