def run(self):
     try:
         while True:
             self._work()
     except:
         logging.exception("Build Image Thread terminates, commiting suicide")
         suicide.killSelf()
Beispiel #2
0
 def _onConnectionClosed(self, connection, reply_code, reply_text):
     self._channel = None
     if self._closed:
         self._connection.ioloop.stop()
     else:
         _logger.error("Connection closed, committing suicide: %(replyCode)s %(replyText)s", dict(
             replyCode=reply_code, replyText=reply_text))
         suicide.killSelf()
Beispiel #3
0
 def run(self):
     try:
         while True:
             self._work()
     except:
         logging.exception(
             "Build Image Thread terminates, commiting suicide")
         suicide.killSelf()
 def run(self):
     try:
         while True:
             try:
                 self._work()
             except:
                 logging.exception("Handling")
     except:
         logging.exception("Virtual IPC server aborts")
         suicide.killSelf()
         raise
 def _handleWithdrawl(self, moreInfo):
     if self._forceReleaseCallback is None:
         logging.error(
             "Rackattack provider widthdrew allocation: '%(message)s'. No ForceRelease callback is "
             "registered. Commiting suicide", dict(message=moreInfo))
         suicide.killSelf()
     else:
         logging.warning(
             "Rackattack provider widthdrew allocation: '%(message)s'. ForceRelease callback is "
             "registered. Calling...", dict(message=moreInfo))
         self._forceReleaseCallback()
Beispiel #6
0
 def run(self):
     try:
         while True:
             try:
                 self._work()
             except:
                 logging.exception("Handling")
     except:
         logging.exception("Virtual IPC server aborts")
         suicide.killSelf()
         raise
 def _handleWithdrawl(self, moreInfo):
     if self._forceReleaseCallback is None:
         logging.error(
             "Rackattack provider widthdrew allocation: '%(message)s'. No ForceRelease callback is "
             "registered. Commiting suicide", dict(message=moreInfo))
         suicide.killSelf()
     else:
         logging.warning(
             "Rackattack provider widthdrew allocation: '%(message)s'. ForceRelease callback is "
             "registered. Calling...", dict(message=moreInfo))
         self._forceReleaseCallback()
 def run(self):
     try:
         timeout = None
         while True:
             self._event.wait(timeout=timeout)
             self._event.clear()
             with globallock.lock():
                 self._runOne()
                 timeout = self._nextTimeout()
     except:
         logging.exception("Timers thread died")
         suicide.killSelf()
         raise
Beispiel #9
0
 def run(self):
     try:
         timeout = None
         while True:
             self._event.wait(timeout=timeout)
             self._event.clear()
             with globallock.lock:
                 self._runOne()
                 timeout = self._nextTimeout()
     except:
         logging.exception("Timers thread died")
         suicide.killSelf()
         raise
 def _onConnectionClosed(self, connection, reply_code, reply_text):
     self._channel = None
     if self._closed:
         self._connection.ioloop.stop()
     elif self._skipSuicide:
         _logger.error(
             "Connection closed, not commiting suicide: %(replyCode)s %(replyText)s",
             dict(replyCode=reply_code, replyText=reply_text))
     else:
         _logger.error(
             "Connection closed, committing suicide: %(replyCode)s %(replyText)s",
             dict(replyCode=reply_code, replyText=reply_text))
         suicide.killSelf()
Beispiel #11
0
 def _allocationEventBroadcasted(self, event):
     if event.get('event', None) == "changedState":
         self._waitEvent.set()
     elif event.get('event', None) == "providerMessage":
         logging.info("Rackattack provider says: %(message)s", dict(message=event['message']))
     elif event.get('event', None) == "withdrawn":
         if self._forceReleaseCallback is None:
             logging.error(
                 "Rackattack provider widthdrew allocation: '%(message)s'. No ForceRelease callback is "
                 "registered. Commiting suicide", dict(message=event['message']))
             suicide.killSelf()
         else:
             logging.warning(
                 "Rackattack provider widthdrew allocation: '%(message)s'. ForceRelease callback is "
                 "registered. Calling...", dict(message=event['message']))
             self._forceReleaseCallback()
 def run(self):
     self._setupFifos()
     poller = self._generatePoller()
     actions = {self._softReclaimFailedFd: self._handleSoftReclamationFailedMsg,
                self._notifyThreadReadFd: self._handleReclamationRequest}
     self._isReady.set()
     while True:
         events = poller.poll()
         for fd, _ in events:
             action = actions[fd]
             try:
                 action()
             except Exception as e:
                 logging.exception("Error in reclamation-spooler: %(message)s. Commiting suicide.",
                                   dict(message=e.message))
                 suicide.killSelf()
                 raise
Beispiel #13
0
 def run(self):
     _logger.info("Connecting to '%(amqpURL)s'...", dict(amqpURL=self._amqpURL))
     try:
         self._connection = pika.SelectConnection(
             pika.URLParameters(self._amqpURL),
             self._onConnectionOpen,
             stop_ioloop_on_close=False)
     except Exception as ex:
         _logger.exception("Subscribe thread has crashed: %(message)s", dict(message=str(ex)))
         if not self._skipSuicide:
             _logger.info("Commiting suicide...")
             suicide.killSelf()
         raise
     self._wakeUpFromAnotherThread = \
         pikapatchwakeupfromanotherthread.PikaPatchWakeUpFromAnotherThread(_logger, self._connection)
     _logger.debug("Starting pika's IO loop...")
     self._connection.ioloop.start()
 def run(self):
     _logger.info("Connecting to '%(amqpURL)s'...",
                  dict(amqpURL=self._amqpURL))
     try:
         self._connection = pika.SelectConnection(
             pika.URLParameters(self._amqpURL),
             self._onConnectionOpen,
             stop_ioloop_on_close=False)
     except Exception as ex:
         _logger.exception("Subscribe thread has crashed: %(message)s",
                           dict(message=str(ex)))
         if not self._skipSuicide:
             _logger.info("Commiting suicide...")
             suicide.killSelf()
         raise
     self._wakeUpFromAnotherThread = \
         pikapatchwakeupfromanotherthread.PikaPatchWakeUpFromAnotherThread(_logger, self._connection)
     _logger.debug("Starting pika's IO loop...")
     self._connection.ioloop.start()
Beispiel #15
0
 def _eventBroadcasted(self, event):
     if event.get('event', None) == "allocation__changedState" and \
             event.get('allocationID', None) == self._id:
         self._waitEvent.set()
     elif event.get('event', None) == "allocation__providerMessage" and \
             event.get('allocationID', None) == self._id:
         logging.info("Rackattack provider says: %(message)s", dict(message=event['message']))
     elif event.get('event', None) == "allocation__withdrawn" and \
             event.get('allocationID', None) == self._id:
         if self._forceReleaseCallback is None:
             logging.error(
                 "Rackattack provider widthdrew allocation: '%(message)s'. No ForceRelease callback is "
                 "registered. Commiting suicide", dict(message=event['message']))
             suicide.killSelf()
         else:
             logging.warning(
                 "Rackattack provider widthdrew allocation: '%(message)s'. ForceRelease callback is "
                 "registered. Calling...", dict(message=event['message']))
             self._forceReleaseCallback()
Beispiel #16
0
 def run(self):
     RETRIES = 10
     INTERVAL = 10
     for i in xrange(RETRIES):
         logging.info("trying to establish SOL connection to %(hostname)s", dict(
             hostname=self._hostname))
         stdin, self._popen = self._popenSOL()
         try:
             self._popen.wait()
         finally:
             os.close(stdin)
         self._popen = None
         if self._stop:
             logging.info('SOL thread for %(hostname)s exists', dict(hostname=self._hostname))
             return
         logging.error("SOL connection to %(hostname)s is broken", dict(hostname=self._hostname))
         time.sleep(INTERVAL)
     logging.error(
         "All retries to establish SOL connection to %(hostname)s failed, comitting suicide", dict(
             hostname=self._hostname))
     suicide.killSelf()
Beispiel #17
0
 def _connectionToProviderInterruptedDefaultCallback(self):
     if not self._skipSuicide:
         suicide.killSelf()
Beispiel #18
0
 def _connectionToProviderInterruptedDefaultCallback(self):
     if not self._skipSuicide:
         suicide.killSelf()