On Thu, Feb 10, 2011 at 08:31:20AM -0800, Eric wrote:
>
> I am sure that this is covered inside the documentation some place but
> I cant find it. How do you properly shut down a worker. We are running
> with ruotekit and a fsstorage. Our worker is running inside rake job.
> 
> When we deploy a new build we want to stop and start the worker along
> with the web server but short of killing the pid that the worker is
> running on, I  don't see how we would tell the worker to "give up". I
> thought Routekit.engine.shutdown would do it but it does not seem to
> have any effect on the worker.

Hello Eric,

sorry it's not covered by the documentation.

To ensure a proper shutdown of a worker you could add to its script something 
like

---8<---
Signal.trap('TERM') do
  puts "worker shutdown"
  $worker.context.shutdown
  exit 0
end
--->8---

Now if you need a way to shutdown all the workers at once, please tell me.

With a quick glance, I see two variants.

A : a message (much like a launch message) is passed to the storage that tells 
the workers to shutdown. Works with workers scattered across multiple hosts.

The issue with A is that the message should remain until all workers are shut 
down, it then has to be removed.

B : at startup, workers registers their pid in the storage, you can then fetch 
the pid list and kill them. Only works with works in the same system.

Maybe a C is worth exploring : workers register with an id and at shutdown 
time, 1 shutdown message per worker is emitted so that only the target workers 
gets shut down.

A could be leveraged to pause the engine, "shutdown flag" is on, "pause flag" 
is on, ... The flag has to be lowered at some point...


Am I going too far ? How can we refine that.


Best regards,

-- 
John Mettraux - http://jmettraux.wordpress.com

-- 
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en

Reply via email to