ezmobius / nanite

self assembling fabric of ruby daemons
Apache License 2.0
735 stars 64 forks source link

Gracefully stopping agents & Timeouts #16

Open taazza opened 14 years ago

taazza commented 14 years ago

Two questions

  1. When a nanite agent timeouts - Is there a way to detect it with code? Also sometimes the agents come back alive after a long running task. We want to strike a balance between number of agents vs timeouts. Any suggestions/ideas?
  2. Also is there an inbuilt way to gracefully stop agents? Something like nanite-agent --token "test" stop --force-after 60 seconds

I did read an email from mattmatt a while ago. Thoughts?

roidrage commented 14 years ago
  1. There's callbacks available for timeout, register and unregister in the mapper, the RDoc for Mapper#start has all the info available.
  2. Planned feature for me, since we need something similar. I'd like to get some Unix-y stuff like Unicorn has into Nanite so that you can gracefully shutdown and bring up new agents in the meantime.
taazza commented 14 years ago

Regarding the first issue is this functionality available outside of the mapper? That would be ideal. How does the nanite-admin get a hold of it?

Just curious how do you deal with creating new agents to scale? Time-outs impacts that decision for us big time.

roidrage commented 14 years ago

That functionality is only available in the mapper. If you need to react on it with some other means I'd say the best way is to fire off a new request to a management agent.

taazza commented 14 years ago

I am assuming management agent is a different agent that you have only for triggering off processes/agents. Could you pls elaborate? Right now we are using only the mapper & the general purpose agents to take care of tasks.

roidrage commented 14 years ago

A management agent is an agent that you implement, its only difference from your other agents could be that it fires up new agents on your systems. Imagine a setup where each machine runs a management agent and a couple of working agents. You can push a task to the management agent whenever you want to fire up new working agents or to kill some of them. It's nothing Nanite offers at the moment, but I thought about it and it sure would be a nice feature to have. Until then, that'd be my idea of automating the process.

taazza commented 14 years ago

We have been exactly thinking around these lines! Would be a great nanite feature. I guess you have to get the mapper to listen to hook and fire off a request to this agent (& hope & pray that this agent is running ;)). Right now the array issue is the one thats killing us. Will have to get that fixes before we get to this one. I will keep you posted.