Displaying 20 results from an estimated 50 matches for "worker_method".
2008 Jan 22
9
Cannot connect when spawning new workers on demand
...selected_servers = System.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...
2007 Dec 08
3
Multiple Worker Methods on Different Schedules
Quick question: If I want to schedule different worker methods defined in
the same worker to trigger at different times, is this possible? Would the
following scheduler yaml work?
:schedules:
:foo_worker:
:worker_method: method1
:trigger_args: 0 */10 * * * * *
:job_key: some_key_1
:foo_worker:
:worker_method: method2
:trigger_args: 0 */15 * * * * *
:job_key: some_key_2
Would this work? Is there some other way to do it? Would the second method
need to be pulled into a separate worker?
Tha...
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 Mar 13
5
worker starting twice
...5:22 (5595) MbSender 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...
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",
#...
2008 Jan 13
3
right usage of bdrb
...r_name :syndication_worker
def create(args = nil)
# this method is called, when worker is loaded for the first time
end
def checksyndicate
syndications = # all Syndication in this hour
syndications.each do |syndication|
MiddleMan.ask_work(:worker => import_worker, :worker_method =>
import, :data => syndication.id)
end
end
- - - - - - -
import_worker.rb
- - - - - - -
class ImportWorker < BackgrounDRb::MetaWorker
set_worker_name :import_worker
def create(args = nil)
# this method is called, when worker is loaded for the first time
end
def...
2007 Dec 21
7
Using my models
...end
# Send a message to everyone
def send_message_to_all(args = nil)
Message.send_to_everyone(args[:sender], args[:subject], args[:body],
false)
rescue
logger.error "MscWorker - #{err.class}: #{err}"
end
end
Called like so:
MiddleMan.ask_work(:worker => :msc_worker, :worker_method =>
:send_message_to_all, :data => { :sender => sender, :subject => subject,
:body => body })
I get lots of errors starting with this:
/Users/dave/projects/backgroundrb1.0_msc/vendor/plugins/backgroundrb/server/master_worker.rb:31:in
`load'': undefined class/module User (Argu...
2007 May 15
4
Need help with singleton worker
...ke to have the work queued 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...
2008 Jan 13
2
{worker} after :end-time worker freaks out
Hi all,
i was using bdrb a while ago and it wasn''t stable enough in version
0.2.1 for doing the job - it loss jobs or did execute only the first one
invoked and so on.
Now i gave the new version a try and i found a bug at playing around.
When i start a worker_method over the normal Unix scheduler bdrb will
start as much as possible the worker_method after the :end-time is reached.
I verifyed the behavior on two different boxes:
1. Mac OS X 10.5.1
2. Debian Lenny
Both using Rub 1.8.6 an backgroundrb 1.0.
My Test-Files
backgroundrb.yml
- - - - - -
:backgr...
2007 Dec 28
2
Arity?
...sage, but not the first do_work
logger call.
Here''s the "ask_work" call:
MiddleMan.new_worker(:worker => @worker_type, :job_key => :importer)
MiddleMan.ask_work(:worker => @worker_type,
:job_key => :importer,
:worker_method => :do_work,
:data => {
:zoom_class => @zoom_class,
:import_topic_type => @import_topic_type,
:import_type => @import_type,
:import_dir_path => @imp...
2006 Nov 20
2
schedule support on latest svn, a question
I''m running the latest backgroundrb mainly for scheduled tasks support.
As per the documentation I created the backgroundrb_schedules.yml with
the following:
simple_label:
:class: :document_sorter_worker
:worker_method: :do_work
:job: :bleh
:trigger_args:
:start: <%= Time.now + 5.seconds %>
:end: <%= Time.now + 10.minutes
:repeat_interval: 1.minute
Under lib/workers I have the following class:
class DocumentSorterWorker < BackgrounDRb::Worker::RailsBase
def do_work(args)
logge...
2007 Dec 30
3
A newbie question regarding BackgroundRb
...ipts.
Now my backgroundrb.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...
2007 Feb 18
2
backgroundrb launches concurrent instances of same job
...te(?) apart from each other. Should
this be happening if I have repeat interval enabled with a job_key? It
seems like it should wait until the job is finished before launching a new
instance.
--Backgroundrb_schedules.yml--
city_updater:
:class: :city_updater_worker
:job_key: :city_updater
:worker_method: :do_work
:worker_method_args: scheduled workers require some args, so here you
go...
:trigger_args:
:start: <%= Time.now + 5.seconds %>
:repeat_interval: <%= 1.minutes %>
It''s currently launching two instances of city_updater, one minute apart fro
the other....
2008 Feb 02
6
Suspended start of task not suspended
Hi
I thought this should suspend the task by 1 minute, but it starts
immediately:
MiddleMan.ask_work( :worker => :bar_worker, :worker_method
=> :test_method, :trigger_args => { :start => (Time.now + 1.minute)})
Is the start argument not allowed in the new backgroundrb (mine is at
rev HEAD (=314))? What can I do about this?
I really need to suspend starting the task as I want the client to
start the trigger but the task...
2008 Jan 03
7
Delete a busy worker
I thought I could delete a busy worker by calling MiddleMan.delete_worker,
but doesn''t seem to end. I believe this was possible in 0.2, is it not in
1.0?
thanks,
Zach
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20080103/0c701f29/attachment.html
2008 Jan 18
8
Query All Worker
What does the method query_all_workers() do? There is no documentation
on what this method returns (1.0.1 version).
Orion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20080118/9f9b8112/attachment.html
2007 Dec 19
6
thread_pooling sleeping
I''m trying to run a single worker that could perform a periodic task
for a given user.
>From a controller, I imagine something like:
def start_job
MiddleMan.ask_work(:worker => :foo_worker, :worker_method => :perform_task,
:data => { :user_id = current_user.id })
end
def check_job
@status = MiddleMan.ask_status(:worker => :foo_worker)[current_user.id]
end
My worker is something like:
class FooWorker < BackgrounDRb::MetaWorker
set_worker_name :foo_worker
def create(args=ni...
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...
2008 Mar 11
1
Worker logging in test output.
Hi,
I''m trying to silence the information that backgroundrb is putting in to my
test runs. I''m seeing several hundred lines of this during the test runs
(both unit and functional):
{:type=>:all_worker_info}
{:type=>:do_work, :worker=>:xmlrpc_xmpp_worker,
:worker_method=>:register_user,
:data=>{:xmpp_password=>"04ced0eda236a8690ec8ed30af63b3f2d886109c",
:userid=>1151}}
but can''t find where it seems to be coming from. How do I shut it off? I''m
using 1.0.3 on 2.0.2 with the standard testing setup (i.e. no rspec).
Cheers,
T...
2007 Dec 18
5
querying status of worker with job_key
Hi,
Is it possible to start a worker with job_key and then ask_status of that
specific worker with the job_key?
MiddleMan.ask_work(:worker => :auth_worker, :job_key=>''1'',
:worker_method => :auth)
and then
MiddleMan.ask_status(:worker => :auth_worker, :job_key=>''1'')
>From my testing of the new backgroundrb, asking status using job key always
return blank.
Is it possible to do this?
thanks,
- reynard
-------------- next part --------------
An HTML a...