Skip to content

Commit

Permalink
Fix vpoller-worker management methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dnaeon committed Sep 3, 2014
1 parent f1b418b commit 4da1c01
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/vpoller/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def __init__(self, config_file, num_workers=0):
self.zpoller = None
self.mgmt_socket = None
self.mgmt_methods = {
'status': status,
'shutdown': shutdown,
'status': self.status,
'shutdown': self.shutdown,
}
self.config_defaults = {
'mgmt': 'tcp://*:10000',
Expand Down Expand Up @@ -98,9 +98,15 @@ def shutdown(self):
"""
Set the exit flag for shutting down
Usually this method is intended to be called through the management interface
"""
msg = 'Shutdown time has arrived, stopping vPoller Worker'
logging.info(msg)
self.time_to_die.set()

return { 'success': 0, 'msg': msg }

def load_config(self):
"""
Loads the vPoller Worker Manager configuration settings
Expand Down Expand Up @@ -207,7 +213,7 @@ def process_mgmt_msg(self, msg):
return { 'success': 1, 'msg': 'Unknown method received' }

method = msg['method']
result = self.mgmt_methods[method]
result = self.mgmt_methods[method]()

return result

Expand All @@ -227,7 +233,7 @@ def status(self):
'proxy': self.config.get('proxy'),
'mgmt': self.config.get('mgmt'),
'db': self.config.get('db'),
'workers': .len(self.workers),
'workers': len(self.workers),
'uname': ' '.join(os.uname()),
}
}
Expand Down

0 comments on commit 4da1c01

Please sign in to comment.