Displaying 20 results from an estimated 29 matches for "foo_work".
Did you mean:
footwork
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...
2007 Dec 22
1
Backgroundrb Question
If I have a worker and everything set up and I call:
MiddleMan.ask_status(:worker => :foo_worker)
MiddleMan.ask_status(:worker => :foo_worker)
MiddleMan.ask_status(:worker => :foo_worker)
three times in quick succession. Will the tasks be queued up and
executed as the previous one finishes? Or is this going to ignore the 2
bottom requests? How does this work?
Do I absolutely need to...
2008 May 28
1
nil.send_request = Incorrect worker name?
...nil object when you didn''t expect it!
The error occurred while evaluating nil.send_request
/usr/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/packet_master.rb:44:in `ask_worker''
Here''s what I''m doing in my rails console.
MiddleMan.new_worker(:worker => :foo_worker, :job_key => ''1'')
worker = MiddleMan.worker(:worker => :foo_worker, :job_key => ''1'')
worker.bar()
Querying all workers shows the foo_worker_1 is there..
>> pp MiddleMan.query_all_workers
{:type=>:all_worker_status}
{:log_worker=>nil,
:f...
2008 Jan 04
1
Updates and Fixes on Trunk
...ch of the issues
that we talked about since last couple of days.
1. Use configuration option :debug_log: false to disable
backgroundrb_debug.log.
2. As shown below, use lazy_load option to disable aggressive loading
of models ( and somewhat stupid too).
3. MiddleMan.delete_worker(:worker => :foo_worker) will now ABORT the
worker, it won''t wait for tasks to finish. I am still skeptic about
the behavior, but since that was the behavior in older version, I am
continuing it.
4. Get information about all running workers:
>> MiddleMan.all_worker_info
=> [{:worker=>:log_worker,...
2007 Nov 14
7
BackgrounDRb version 1.0RC1 available now
...up
Installation with piston:
piston import
http://svn.devjavu.com/backgroundrb/branches/version10/ backgroundrb
=== Configuration
Use rake task for initial configuration:
* Cron style scheduling and config
| :backgroundrb:
| :ip: localhost
| :port: 11006
|
| :schedules:
| :foo_worker:
| :worker_method: foobar
| :trigger_args: */5 * * * * * *
* Normal Unix scheduler
| :backgroundrb:
| :ip: localhost
| :port: 11006
| :schedules:
| :foo_worker:
| :start: <%= Time.now + 5.seconds %>
| :end: <%= Time.now + 10.minutes %>
|...
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...
2006 Oct 17
2
accessing args in worker
If, in the controller, I start a worker and pass in an argument like this:
session[:job_key] = MiddleMan.new_worker(:class => :foo_worker,
:args => {:emrec_id => @emrec.id})
How do I access the value in the worker? I can''t seem to figure it out ;-p
Thanks!
Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermai...
2007 Nov 02
10
pre-release version of backgroundrb available now from svn
...supported. Although,
We can do that, but in most situations, passing ''id'' of object is
enough i thought. Also, you may encounter some bugs when you are
passing large objects around.
I will try to explain meat of a sample worker:
class FooWorker < MetaWorker
set_worker_name :foo_worker
attr_accessor :count
def worker_init
puts "Starting Foo Worker"
add_periodic_timer(4) { increment_status}
end
def process_request p_data
p p_data
end
def increment_status
@count ||= 0
@count += 1
register_status(@count)
end
end
First, I intend to...
2006 Oct 17
6
Session access interfers with other model access
...cess commented
out as below, the Emrec record gets deleted. If I uncomment those lines,
the Emrec record is _not_ deleted. Any idea what I''m doing wrong?
Thanks,
Bill
In my controller...
@session_id = session.session_id
session[:job_key] = MiddleMan.new_worker(:class => :foo_worker,
:args => {:emrec_id =>
@emrec.id,
:session_id =>
@session_id})
In my worker...
def do_work(args)
@time_remaining = 7
@emrec_id = args[:emrec_id]
#@session_rec = Se...
2006 Jul 13
4
Update
...n worker classes.
These are workers that only have one instance of the class in the
whole drb server. Even if you call new_worker more then once with the
same :class and it is a singleton worker, it will just return the one
worker instance. Use like this:
MiddleMan.new_worker(:class => :foo_worker,
:args => "Bar",
:job_key => :singleton_worker,
:singleton => true)
Cheers-
-Ezra
2008 Jan 22
1
Newbie question on Scheduling
I''ve scheduled cron jobs etc before, but I''m curious as to how to layout a
worker properly. Here''s a basic example of what one of my workers looks
like:
class FooWorker < BackgrounDRb::MetaWorker
set_worker_name :foo_worker
def create(args = nil)
logger.info("Starting test: #{Time.now.strftime("%T")}")
run_test
logger.info("Finished test: #{Time.now.strftime("%T")}")
exit
end
def run_test
logger.info("aaaa")
sleep(30)
logger.info("bbbb")
end
end
I''...
2007 Dec 17
11
BackgrounDRb release 1.0 available now
...register_status() to
register status of your worker. Just because
you are doing some processing won''t mean that your worker will
block. It can still receive requests from rails.
- Now, you can schedule multiple methods with their own triggers.
| :schedules:
| :foo_worker:
| :foobar:
| :trigger_args: */5 * * * * * *
| :data: Hello World
| :barbar:
| :trigger_args: */10 * * * * * *
- Inside each worker, you can start tcp server or connect to a
external server. Two important methods available in all workers are:
start_s...
2006 Aug 23
5
Singleton-like Worker
Hello there,
I need a Worker Class to be Singleton-like, that means there must be at
maximum one Instance at a time. When a new Request is made to create another
worker of this type, it should return and wait for the other instance to be
destroyed.
what i need to do: i have a worker who needs to do sth with java and
openoffice, and it seems when i have more tha one worker simultaneously,
2008 May 04
12
best approach to managing workers and getting status
Hi,
I am using backgroundrb to process audio files from a rails
controller. Currently a new worker gets created every time the method
is called on the worker, using this code:
@job_key = MiddleMan.new_worker(:worker
=> :audio_file_worker, :job_key => Time.now.to_i)
MiddleMan.worker(:audio_file_worker,
@job_key).make_new_audio_file(params[:release_id])
I need to create the new
2006 Dec 13
4
Unintended thread forked in autostart
...ss
class FooWorker < BackgrounDRb:Rails
repeat_every 2.minutes
first_run Time.now
def do_work
puts Time.now.to_s + "Start processing....."
do_some_task()
puts Time.now.to_s + "Finish processing"
end
- In background.yml
autostart:
1:
class: foo_worker
arg: ''''
Result is....
--- First time---
Start processing
Finish processing
--- Second time ---
Start processing
Start processing
Finish processing
Finish processing
regards.
--
--------------------------------------
Kenichi Sugihara
--------------------...
2006 May 15
10
BackgrounDRb background task runner and Application Wide Context Store
...into the RAILS_ROOT/lib/workers/ directory.
You can then use your worker class in rails like this:
# in a controller
# start new worker and put the job_key into the session so you can
# get the status of your job later.
def background_task
session[:job_key] = MiddleMan.new_worker(:class => :foo_worker,
:args => {:baz =>
''hello!'', :qux => ''another arg!})
end
def task_progress
if request.xhr?
progress = MiddleMan.get_worker(session[:job_key]).progress
render :update do |page|
page.replace_html(...
2006 Jul 09
5
where do uncaught exceptions printouts go?
Hi,
I have a worker, which should have thrown an uncaught exception and dumped the stack in the do_work
method, however I saw no dump or indication of any error in any of the logs.
This makes it very hard to debug, where does stdout and or stderr go? How canb I know if it gets
some kind of error? (in this case not being able to find a class).
Thanks
--
Jim Morris, http://blog.wolfman.com
2008 Jan 10
8
Worker suicide
I have a worker which wants to delete itself after it finishes its
work- how can it do that?
Best Regards,
Danny Burkes
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.
2008 Sep 24
1
Clearing cached results
I''m trying to figure out how to clear the for a worker from my
controller.
In my aysnc_xxx process I set cache[key]. However, I don''t see an easy
way to clear the cache from a controller with invoking something on
the worker.
What I was looking for was something like
MiddleMan(:worker_name, :worker_key_name).cache[key]=
Is there something like that and I''m just