def retry_channel(self): with self._lock: if 'channel' not in self._in_retry or not self._in_retry['channel']: log.err("Channel Closed! retry creating it ...") self._in_retry['channel'] = True d = defer.maybeDeferred(self.ready, self._conn) d.addErrback(self.failed)
def retry_channel(self): with self._lock: if 'channel' not in self._in_retry or not self._in_retry['channel']: log.err("Channel Closed! retry creating it ...") self._in_retry['channel'] = True d = defer.maybeDeferred(self.ready, self._conn) d.addErrback(self.failed)
def retry_connect(self): with self._lock: if 'connection' not in self._in_retry or not self._in_retry['connection']: self.conn_retry_interval += 2 log.err("Connection Closed! retry connecting in %s seconds..." % self.conn_retry_interval) self._in_retry['connection'] = True d = task.deferLater(reactor, self.conn_retry_interval, self.do_connect) d.addErrback(self.failed)
def failed(self, failure): if failure.check(ChannelClosed): self.retry_connect() elif failure.check(ConnectionClosed) or failure.check(ConnectionRefusedError): self.retry_connect() else: log.err("Unhandled failure in Amqp Service....") failure.printTraceback() reactor.stop()
def job_failed_retry(self, message, job_id): # TODO add retry max number to prevent dogpile effect self.job_results[job_id] = ('RETRY', message) if job_id not in self.retry_counter: self.retry_counter[job_id] = 0 else: self.retry_counter[job_id] += 1 log.err(message)
def failed(self, failure): if failure.check(ChannelClosed): self.retry_connect() elif failure.check(ConnectionClosed) or failure.check( ConnectionRefusedError): self.retry_connect() else: log.err("Unhandled failure in Amqp Service....") failure.printTraceback() reactor.stop()
def job_failed_retry(self, message, job_id): # TODO add retry max number to prevent dogpile effect self.job_results[job_id] = ('RETRY', message) if job_id not in self.retry_counter: self.retry_counter[job_id] = 0 else: self.retry_counter[job_id] += 1 log.err(message)
def check_storage_path(self): if not os.path.exists(self.storage_path): try: os.makedirs(self.storage_path) except OSError as e: if e.errno == 13: log.err("Can't create storage directory: access denied") else: raise e reactor.callFromThread(self.stop)
def check_storage_path(self): if not os.path.exists(self.storage_path): try: os.makedirs(self.storage_path) except OSError as e: if e.errno == 13: log.err("Can't create storage directory: access denied") else: raise e reactor.callFromThread(self.stop)
def retry_connect(self): with self._lock: if 'connection' not in self._in_retry or not self._in_retry[ 'connection']: self.conn_retry_interval += 2 log.err( "Connection Closed! retry connecting in %s seconds..." % self.conn_retry_interval) self._in_retry['connection'] = True d = task.deferLater(reactor, self.conn_retry_interval, self.do_connect) d.addErrback(self.failed)
def job_failed(self, message, job_id): self.job_results[job_id] = ('FAILED', message) log.err(message)
def failed(self, why): ex = why.value log.err(ex.message)
def failed(self, why): ex = why.value log.err(ex.message)
def commit(self): try: self.conn.commit() except Exception as e: log.err(e.message)
def job_failed(self, message, job_id): self.job_results[job_id] = ('FAILED', message) log.err(message)
def commit(self): try: self.conn.commit() except Exception as e: log.err(e.message)