From fd0617acca065ae3df8db6d002ad2c3aba35c04b Mon Sep 17 00:00:00 2001 From: Clint Armstrong Date: Thu, 2 Jul 2015 15:30:57 -0400 Subject: [PATCH] Do not allow the master to join twice If the poller master doesn't complete in time and ends up with overlapping jobs, neither job will ever complete because both running jobs will think they are the master and wait for the remaining node to exit. --- poller-wrapper.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/poller-wrapper.py b/poller-wrapper.py index 02efa825d8..d9b5420115 100755 --- a/poller-wrapper.py +++ b/poller-wrapper.py @@ -133,6 +133,9 @@ if ('distributed_poller' in config and import uuid memc = memcache.Client([config['distributed_poller_memcached_host'] + ':' + str(config['distributed_poller_memcached_port'])]) + if str(memc.get("poller.master")) == config['distributed_poller_name']: + print "This sytem is already joined as the poller master." + sys.exit(2) if memc_alive(): if memc.get("poller.master") is None: print "Registered as Master" @@ -148,7 +151,7 @@ if ('distributed_poller' in config and print "Could not connect to memcached, disabling distributed poller." distpoll = False IsNode = False - except: + except ImportError: print "ERROR: missing memcache python module:" print "On deb systems: apt-get install python-memcache" print "On other systems: easy_install python-memcached"