示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 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()
示例#5
0
    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)
示例#6
0
 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()
示例#7
0
    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)
示例#8
0
    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)
示例#9
0
    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)
示例#10
0
 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)
示例#11
0
 def job_failed(self, message, job_id):
     self.job_results[job_id] = ('FAILED', message)
     log.err(message)
示例#12
0
 def failed(self, why):
     ex = why.value
     log.err(ex.message)
示例#13
0
 def failed(self, why):
     ex = why.value
     log.err(ex.message)
示例#14
0
 def commit(self):
     try:
         self.conn.commit()
     except Exception as e:
         log.err(e.message)
示例#15
0
 def job_failed(self, message, job_id):
     self.job_results[job_id] = ('FAILED', message)
     log.err(message)
示例#16
0
 def commit(self):
     try:
         self.conn.commit()
     except Exception as e:
         log.err(e.message)