Displaying 6 results from an estimated 6 matches for "done_with_do_work".
2007 Jan 23
1
Getting results from a dead worker. example?
...from the documentation it seems that it is
possible to do this).
I pasted my simple test below. If anyone could point out what i
should be doing differently i''d be very grateful.
My test worker:
class TestWorker < BackgrounDRb::Worker::RailsBase
def do_work(args)
results[:done_with_do_work] = true
self.delete
end
end
TestWorker.register
My rake task:
task :tester => :environment do
k=MiddleMan.new_worker(
:class => :test_worker
)
sleep 1 # the worker will die during this pause
# next line gives a nil object error
puts "done_with_do_work=#{MiddleMan.wo...
2007 Jun 25
3
one more "uninitialized constant" problem
...tingWorker < BackgrounDRb::Worker::RailsBase
def do_work(args)
# This method is called in it''s own new thread when you
# call new worker. args is set to :args
logger.info(''TestingWorker do work'')
results[:do_work_time] = Time.now_to_s
results[:done_with_do_work] || = true
end
end
And this is the code that I have in RAILS_ROOT/app/controllers/mytest2_controller.rb
class Mytest2Controller < ApplicationController
def new
key = MiddleMan.new_worker(:class => :testing_worker)
worker = MiddleMan.worker(key)
#worker.other_method...
2007 Dec 28
2
Arity?
...false
@last_related_topic = nil
@last_related_topic_pp4_objectid = nil
@import_field_to_extended_field_map = Hash.new
@attributions = Hash.new
logger.info(''PastPerfect4ImporterWorker started'')
@results = { :do_work_time => Time.now.to_s,
:done_with_do_work => false,
:records_processed => 0 }
register_status(@results)
end
def do_work(args = nil)
begin
logger.debug("in worker")
...
I get to the create method''s logger message, but not the first do_work
logger call.
Here''s the "as...
2006 Nov 20
2
schedule support on latest svn, a question
...+ 10.minutes
:repeat_interval: 1.minute
Under lib/workers I have the following class:
class DocumentSorterWorker < BackgrounDRb::Worker::RailsBase
def do_work(args)
logger.info(''DocumentSorterWorker do work'')
results[:do_work_time] = Time.now.to_s
results[:done_with_do_work] ||= true
end
end
DocumentSorterWorker.register
Basically does nothing but log that it''s running.
After running "script/server run" this is what I have in
backgroundrb_server.log:
20061120-17:04:52 (31960) port: 2000
20061120-17:04:52 (31960) worker_dir: /home/ed/Documents/...
2007 May 26
0
New worker not being created
...> ./script/generate worker example
>
> my example worker:
>
> class ExampleWorker < BackgrounDRb::Worker::RailsBase
>
> def do_work(args)
> logger.info(''ExampleWorker do work'')
> results[:do_work_time] = Time.now.to_s
> results[:done_with_do_work] ||= true
> end
>
> def other_method
> logger.info(''other_method in ExampleWorker called'')
> results[:extra_data] = "Just a plain old string"
> end
>
> end
> ExampleWorker.register
>
> Then in a controller, I have:
>...
2007 May 09
0
Neophyte needs help!
...the example in the
documentation):
#####################################################################
class ExampleWorker < BackgrounDRb::Worker::RailsBase
def do_work(args)
logger.info(''ExampleWorker do work'')
results[:do_work_time] = Time.now.to_s
results[:done_with_do_work] ||= true
end
def other_method
logger.info(''other_method in ExampleWorker called'')
results[:extra_data] = "Just a plain old string"
end
def arg_method(arg)
end
end
ExampleWorker.register
###############################################################...