<br><br><div class="gmail_quote">On Feb 20, 2008 2:39 PM, hemant <<a href="mailto:gethemant@gmail.com">gethemant@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">On Thu, Feb 21, 2008 at 1:02 AM, John Wells <<a href="mailto:lists@sourceillustrated.com">lists@sourceillustrated.com</a>> wrote:<br>><br>><br>> On Feb 20, 2008 2:22 PM, hemant <<a href="mailto:gethemant@gmail.com">gethemant@gmail.com</a>> wrote:<br>
> > But later we changed the code and we thought when you invoke<br>> > delete_worker, your worker should exit immediately and request to kill<br>> > a worker shouldn't be queued.<br>> ><br>> > In current code, apart from executing "delete_worker" another way to<br>
> > kill workers is to call "exit" from inside of a worker. This will give<br>> > you opportunity to do proper cleanup and stuff.<br>> > I am not sure, if this is what you want, but "delete_worker" is like<br>
> > "kill -9 " of unix.<br>> ><br>> > So, if you want to handle graceful exit, call exit from worker code<br>> itself.<br>> ><br>><br>> Thanks for your reply.<br>><br>> So how would I be able to signal to the worker that it should call exit? I<br>
> guess that is the challenge. The worker is involved in a large batch job,<br>> and I need to be able to send a message to it to tell it to kill itself. I<br>> had hacked out an approach using both a database table in which it would<br>
> check for the existence of a certain row, and if there remove and kill<br>> itself, but I wondered if the framework itself provided a better way?<br>><br>> Also, assuming I just continue to use delete_worker in the way I am today,<br>
> is there any way possible to delete the last status the worker reported?<br>><br><br></div></div>Something like this:<br><br>class FooWorker < BackgrounDRb::MetaWorker<br> def some_work(args = nil)<br> # do some job processing from database<br>
exit<br> end<br>end</blockquote><div><br><br>Ok, but when would exit be called here? After all the work is done?<br><br>I guess what I want is a kill -9 functionality, but with the ability to at the very least clear the worker's status...<br>
</div></div>