Displaying 20 results from an estimated 1200 matches similar to: "Instantiating middleman and worker from inside a model?"
2006 Dec 18
3
Creating another database connection for large mysql import?
I''m using backgroundrb to periodically download a large file via ftp from a
remote location and then import it into the database. To perform the
import, I was using the following:
ActiveRecord::Base.connection.execute(%{load data infile ...;})
although on a file with 2.5 million records, this can take 5 minutes, which
seems to tie up my rails application while this executes (even
2006 Nov 05
5
backgroundrb preview
Hi Ezra/skaar,
Wow man, the exercise was worth it. The connection closed problem with
socket as i mentioned in my earlier mails...completely disappeared,
and now i can connect only once to the socket and keep reading..till
end of its days.
Literally impossible with older release of backgroundrb.
This could also potentially solve the issues people were having with
ActiveRecord.
As i said
2007 Mar 07
10
MiddleMan.worker blocks?
Hello -
I am observing that calls to MiddleMan.worker return only after the worker
has completed its work. This puzzles me, and I presume that I am doing
something wrong. Can anyone make suggestions?
Snippets from my code are:
class ReportController < SecurityController
...
def create_xml_report(report,start_time)
constraints = get_constraints(report,start_time,false)
2007 Apr 04
6
Exception when doing DRb remote calls from a BackgrounDRb worker
Hello,
I am trying to make DRb calls to a external server from a backgrounDRb
worker, but I''m getting always the next exception when I make the remote
call.
> ERROR:
> drbunix:///tmp/backgroundrb.11175/experimenter_worker_3e899de945f0803a82cd257cfac316d0_0_0.0738904928422051
> - #<Errno::ENOENT: No such file or directory -
>
2006 Nov 20
4
Production RAILS_ENV / DB Selection
Hey all,
I''m having some issues moving a project that incorporates Backgroundrb onto
a staging server... For some reason (surely of my own doing), my RailsBase
workers are insisting on using trying to access my development DB instead of
my "production" DB.
When I try to load a model object from within a worker, I get the following:
20061120-21:54:28 (26296)
2006 Jul 05
5
''m having trouble with BackgrounDrb
Hi. I thought that BackgrounDrb was the perfect solution for my long
running report production tasks.
But I can''t seem to get anything useful back out of it.
I set up a simple test worker that just does
class TestWorker < BackgrounDRb::Rails
attr_reader :pupil
def do_work(args)
@progress=0
@pupil=Pupil.find(3)
sleep rand*10
@progress=100
end
when I try to
2006 Jul 19
1
Testing worker classes
Hi,
Does it make sense to test a worker class by calling
Middleman.new_worker? Or should I just be testing the functionality in
the do_work method, with, say, a mock object. This seems like a really
ugly DRY violation: you''d need to keep the code in the mock and the
real worker in sync.
That''s the philosophical half of my question. In fact, until someone
tells me why I
2007 Jan 22
7
Yet Another Problem with BackgroundRB
Hi!
My cron-based worker is being indeed invoked by backgroundRB at
correct times. But... After several runs it can no longer find DB
columns! The same query, which was running OK an hour ago starts to
throw MySQL error about unkown column in where clause. If I restart
backgroundrb it works for some time but stops working after several
invocations.
Has anyone epxerienced the similar beahviour?
2007 Jan 22
1
MiddleMan behavior
i found some questions and answers on mailing lists but there is still a
problem - when i want to create new worker from within a worker -
::BackgrounDRb::MiddleMan.new_worker(:class => :second_worker, :args =>
{:id=>2, :text=>"slave"}) works
but when i want to get reference to that object:
::BackgrounDRb::MiddleMan.worker(@second)
yields:
NoMethodError: undefined
2006 Dec 15
1
:job_key acting weird?
Hi all
I''m experiencing something strange with a :job_key, it took me a very
long time to find out a worker wasn''t doing it''s job because of the
name of my job_key. The first one I tried was :make_kohier, and with
that name (and lot''s of other ones) I can''t get the worker to work. I
do get my key in return, but the job doesn''t start
2009 Feb 16
1
MiddleMan.new_worker => nil
I''ve been checking out all the async gems and plugins for Rails, and
decided to give BackgroundRb a shot. Unfortunately, I''ve not even been
able to get past the initial stages.
Whenever I call MiddleMan.new_worker, it invariably returns nil. The
log file remains empty.
I''ve only tried this from the console so far. If I can''t even do this
successfully,
2006 Dec 07
2
backgrounDRb problems with results and MiddleMan
Hi there,
I''ve been experimenting with implementing BackgroundDRb in my rails app but
am running into some problems.
The primary problem I''m getting is in cleaning up worker threads, or getting
any kind of response out of worker threads.
If try using the response function/hash in my Worker the worker will not
execute reporting that response is an unknown variable or function.
2006 Sep 05
2
question about passing array of AR objects to worker
got a wierd problem maybe someone can help with.
whenever i try to pass an array or AR objects to my worker, i end up
with a DRb object in the worker...here''s an example
class SearchWorker < BackgrounDRb::Rails
attr_reader :resources
def do_work(resources)
logger.info resources.inspect
end
end
class SearchController < ApplicationController
def start_search
2006 Jul 07
1
uninitialized constant MiddleMan
I just updated backgroundrb to the latest version, and now I get this:
uninitialized constant MiddleMan
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/
active_support/dependencies.rb:123:in `const_missing''
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/
active_support/dependencies.rb:131:in `const_missing''
2006 Jul 19
1
A couple of problems
Hi Ezra,
Thanks for the great work on BackgrounDRb. I have come across a
couple of problems.
1. I wanted to define a simple class in the worker file to wrap up and
pass back some data to my controller. It seems that if I create the
class either inside or outside of my worker class (in the same file)
it gets wrapper by a DRb::DRbUknown object and therefore cannot be
accessed from my controller.
2006 Jun 09
2
T1 passthrough/middleman
Is it possible to act as a middle man on a T1 line?
My installation currently has an aging Inter-Tel Axxess box with a T1
coming in (16 in, 8 out). Rather than adding and replacing phones and
cards as they die, I would like to slowly migrate to a asterisk SIP
installation.
I want to take the incoming T1 line, use any available outgoing lines
for outgoing SIP, intercept any incoming lines and
2007 Apr 05
4
backgrounddrb problem..
i''m having some problems getting a simple example going with
backgrounDRB.
after i set my worker to work i try to get back the result like this:
w = MiddleMan.worker(key)
w.items comes back as DRb::DRbUnknown (i have items as attr_reader in
my worker and access it inside there with @items). the result is
actually activerecord results in an array. when i change it so my
worker puts
2006 Jul 07
4
Problems with ActiveRecord in workers
Hi *,
are there some special settings except of "load_rails: true" to make
ActiveRecord models accessible within my workers?
I''ve just installed the latest version of this great plugin, but I keep
getting
undefined method [] for #<DRb::DRbUnknown:0x12345> (line 105 in
backgroundrb.rb)
when one of the arguments for the worker is an ActiveRecord object.
I assume that
2006 Jun 15
5
Cannot invoke ActiveRecord subclass accessors in DRb worker
Hi there,
I''m trying to create a worker to do some asynchronous web client work
and update the data model with its results. It seems, however, that
every call I make to an ActiveRecord subclass causes the whole thing
to block. At least I think it''s blocked. Right now I''m just using
debug log output.
Is there a decent way to debug/test workers I can try?
Is there any
2006 Dec 08
3
Thread Pool Size?
Hi All,
It might be lack of sleep, but I am struggling to accurately limit our pool
size. It seems like I can specify it on the server with the -s command
line option and also on the client via the YAML pool_size. Is that right?
Which one wins?
Our problem is that we are getting about 40 threads on each backgroundrb box
and it''s flooring our db and each bgrb box.
We want around 8.