Displaying 20 results from an estimated 135 matches for "do_work".
2008 Jan 22
9
Cannot connect when spawning new workers on demand
...stem.find_all_by_id(params[:servers])
@selected_servers.each do |svr|
# spawn new process
MiddleMan.new_worker(:worker => :remote_command_worker, :job_key
=> svr.name)
MiddleMan.ask_work(:worker => :remote_command_worker, :job_key =>
svr.name, :worker_method => :do_work, :data => {:svr =>
svr.name, :command =>
MultiComCommand.find_by_id(params[:commando]).command})
end
end
When I select only a few servers, it works just fine! There is no
definable threshold, I''ve had failures with only 4 servers selected and
success with 12 servers selecte...
2007 May 15
4
Need help with singleton worker
...ueued up
for a single named worker instead, running as soon as possible.
Using MiddleMan.schedule_worker() with :job_key does start off a
worker, but I can''t manage to add another task to the same worker and
have it queue up. It''s not just a matter of adding :worker_method =>
:do_work/:worker_method_args => whatever to schedule_worker()..? (see
example below)
Ideally using the same interface for running the first and any subsequent tasks.
Here''s a debug run, which may or may not make any sense.
Task a, b and c were started in 10-20 sec total, d was started aft...
2007 Mar 13
5
worker starting twice
...nder ms1 started
20070313-15:45:22 (5595) MbSender ms2 started
20070313-15:45:22 (5595) Receiver r started
20070313-15:45:30 (5595) MbReceiver mr started.
The relevant chunk of backgroundrb_schedules.yml looks like this:
mb_receiver:
:class: :mb_receiver
:job_key: :mr
:worker_method: :do_work
:args:
:sleep_time: 5
:trigger_args: 0,10,20,30,40,50 * * * * * *
The other workers have identical trigger_args, but don''t exhibit this behavior.
The do_work method just calls another method that loops forever, and I
wrapped that call in an exception handler to see if it...
2007 May 22
4
Recommendations for eternally-running backgroundrb workers?
...ass=> :receiver, :job_key=>:r,
:args=>{:sleep_time=>10})
This strikes me as a really weak way to fire up my workers. I
basically want to automate things so that these will be started by a
script in /etc/rc?.d. It seems like using the backgroundrb scheduler
is not a possibility, since do_work never returns from my workers
(each of them runs in an infinite loop, polling the database
periodically to look for work). So it looks like I need another
startup script, running after the rest of the system is up, that does
one of these things:
- use curl or wget to hit my special worker-startin...
2008 Mar 21
5
State of backgroundrb (dupe?)
Hi, pardon if this is a duplicate mail, I forgot to click the
subscription link the first time around.
I''ve been using backgroundrb for a while now (older version) and I''ve
had so many headaches because of it that I began looking for a
replacement technology. And then I saw the new and shiny backgroundrb
website, looking good!
Initially I used the version maintained by
2007 Jul 17
0
Backgroundrb scheduler seems to stop running
I have two scheduled tasks in my rails app:
background_schedules.yml
mail_sender_1:
:class: :mail_sender_worker
:job_key: :job_key_mail_sender_1
:worker_method: :do_work
:trigger_args:
:start: <%= Time.now + 5.seconds %>
:end: <%= 1.years.from_now %>
:repeat_interval: <%= 60.minutes %>
cleanup_1:
:class: :cleanup_worker
:job_key: :job_key_cleanup_1
:worker_method: :do_work
:trigger_args:
:start: <%= Time.now + 30.minu...
2006 Oct 04
0
do_work and long running rails tasks?
Hi there
I have some long running queries against a nice litte database (20
million new records per day) that I have offloaded to backgroundRB.
The trouble is, that backgroundrb seems to be blockin on Model.find
calls.
Here''s the code
--- worker.rb --
def do_work(args)
@rows = []
@percent = 0
@host = Host.find( args[:id])
ips = @host.ipaddresses
step = 100.0/ips.size
ips.each do |ip|
@percent += step
new_rows = Sysloglog.find(:all,
:limit => 20,...
2006 Aug 01
2
actionmailer cant find template in backgroundrb
Im trying to send mails from a backgroundrb worker and it seems like
ActionView cant find my template. same code works as a rake task.
here my worker:
class StatusMailWorker < BackgrounDRb::Rails
repeat 1.minutes # <-- hehe!
def do_work(args)
[...blah...]
NotificationMailer.create_daily_report(users, rep, items)
end
end
end
its throwing the following error:
No rhtml, rxml, rjs or delegate template found for daily_report -
(ActionView::ActionViewError)
d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/actio...
2007 Dec 30
3
A newbie question regarding BackgroundRb
...ckgroundrb.yml looks like
=======
---
port: "22222"
timer_sleep: 60
load_rails: true
environment: development
host: localhost
database_yml: config/database.yml
acl:
deny: all
allow: localhost 127.0.0.1
order: deny,allow
scheduled_task:
:class: :tx_reaper_worker
:worker_method: :do_work
:trigger_args:
:start: <%= Time.now %>
:repeat_interval: <%= 1.second %
=======
TxReaperWorker is my class which I generated.
=======
class TxReaperWorker < BackgrounDRb::Rails
def do_work(args)
puts "Hello BackgroundRb"
end
end
=======
I started my rails...
2006 Jul 10
2
''uninitialized constant'' error
...:job_key] = MiddleMan.new_worker(:class => :tail_worker, :args => {:baz => ''hello!'', :qux => ''another arg!''})
end
In cookbook\lib\workers\tail_worker.rb
-----------------------------------------------
class TailWorker < BackgrounDRb::Rails
def do_work(args)
puts "Printing from inside TailWorker::do_work()"
end
end
When I issue the request to
http://127.0.0.1:3000/My_Test/longrun
I get the following error:
NameError in My testController#longrun
uninitialized constant TailWorker
I''d appreciate any light thrown on what...
2006 Nov 07
2
start a worker when bdrb starts
I am sure..again I am missing something, but I am trying to start a
worker, when backgroundrb starts and it doesn''t seem to work.
Here is my config/backgroundrb_schedules.yml file:
feed_worker:
class: feed_worker
job_key: feed_worker_key
worker_method: do_work
trigger_args:
repeat_interval: 20.minutes
I even tried this from Rails controller:
# def start_feed_worker
# begin
# MiddleMan.schedule_worker(:class => :feed_worker,
# :args => "foobar",
# :job_key...
2007 Nov 22
0
How to get result from do_work in a worker
Hi guys,
I have a problem that I would some need help with. I have a long-running
task that blocks my server when it''s processing. Now I refactored that into
a backgroundrb worker class that does the processing for the action. Now my
problem is how to retrieve the result for the task when the worker is done
processing since the MiddleMan.new_worker returns just the job_key.
Any ideas
2006 Dec 05
1
worker method not running in background
When i call a worker method my browsers hangs until the task is finished.
The same code works nicely in the background when inside the do_work method.
Does this mean i can only start a task in background via the do_work method
?
Or am i doing something wrong here ?
regards tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20061205/43bae8ef/att...
2007 Mar 05
2
Scheduled workers only run once unless you call self.delete inside the worker
...igger
:trigger_args: 0 * * * * * *
This worker posts an auction to eBay from a queue of auctions every minute.
I was having a problem where the worker would run ok the first time, but
never any subsequent minutes after that. The way I fixed it was adding a
call to self.delete at the end of every do_work() method:
----
class EbayAuctionWorker < BackgrounDRb::Rails
# Set this worker to run every minute.
attr_accessor :progress, :description
def do_work(args)
# This method is called in it''s own new thread when you
# call new worker. args is set to :args
@progress = 0...
2007 Apr 06
2
Best way to start a worker
...r a minute, sends 10 until done - very straightforward.
My question is, what would be the best way to run this? I have assumed a
cron like scheduled worker with a named key, but I don?t know. My worker
looks like this:
class EmailProcessorWorker < BackgrounDRb::Worker::RailsBase
def do_work(args)
queue = EmailQueue.new
queue.process_queue
end
end
EmailProcessorWorker.register
I do all the work in a Rails Model, since I can unit test it outside of
backgroundrb.
Does anyone have a backgroundrb_schedules.yml file I could use as an
example, and should this run somet...
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
2006 Aug 12
1
Multiple args
...l_queue_worker.rb:
================
require File.dirname(__FILE__) + "/../../config/environment.rb"
ActionMailer::Base.template_root =
File.expand_path(File.dirname(__FILE__) + "/../../app/views")
class MailQueueWorker < BackgrounDRb::Rails
attr_accessor :progress
def do_work(args)
@progress = 0
@logger.info("MailQueueWorker: start sending newsletter
#{args[:mailing].title}")
@logger.info( args.to_s )
for member_email in args[:recipents]
Newsletter.deliver_send_mailing(args[:mailing], member_email)
@progress += 100/args[:recipents]....
2006 Jul 14
4
Using BackgrounDRb to replace nested loops?
In response to my Rails Weenie post today[1], someone mentioned that
I try BackgrounDRb to help take the strain off my application.
1: http://rails.techno-weenie.net/question/2006/7/13/nested-loops-
best-way-to-send-messages-to-blog-subscribers
I''ve just tried to install and use BackgrounDRb with my app, but I''m
afraid that I''m not too versed in running processes
2024 Jan 23
1
[PATCH] nouveau: rip out fence irq allow/block sequences.
...0 @@ static const struct dma_fence_ops nouveau_fence_ops_legacy = {
.release = nouveau_fence_release
};
-static bool nouveau_fence_enable_signaling(struct dma_fence *f)
-{
- struct nouveau_fence *fence = from_fence(f);
- struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
- bool ret;
- bool do_work;
-
- if (atomic_inc_return(&fctx->notify_ref) == 0)
- do_work = true;
-
- ret = nouveau_fence_no_signaling(f);
- if (ret)
- set_bit(DMA_FENCE_FLAG_USER_BITS, &fence->base.flags);
- else if (atomic_dec_and_test(&fctx->notify_ref))
- do_work = true;
-
- if (do_work)
- schedul...
2006 Aug 07
4
Memory leak?
...he ENTIRE Rails
environment, because my Image model is an engine plugin. Then, I
have it perform this upon acceptance:
MiddleMan.new_worker :class => :resize_worker, :args => self.id
And here are the contents of ResizeWorker:
class ResizeWorker < BackgrounDRb::Rails
def do_work(args)
image = Image.find(args)
image.resize_all
terminate
end
end
If I run this on a few dozen images simultaneously I watch as top
starts slowly requiring more memory for backgroundrb. Dropping into
script/console tells me two things.
For one, MiddleMan.jobs still has ever...