Example #1
0
 def clientConnectionLost(self, connector, reason):
     if self.closed:
         log.info("Connection to the AMQP broker closed.")
         return
     
     log.error('Connection to AMQP broker lost. Reason {0}'.format(reason))
     super(AMQClientFactory, self).clientConnectionLost(connector, reason)
Example #2
0
 def finish(self, checksum):
     # Wait for the transfer to complete
     yield self.deferred_completed
     
     # @todo: Cleanup queues and make sure the tempfile is removed from the
     #        system
     
     # Close the file and move it to the final destination
     fh, temppath = self.tempfile
     
     # Remove references to allow garbage collecting the file handler
     del self.tempfile
     
     # Close the file handler
     fh.close()
     
     # Move the file to the final destination in another thread to avoid to
     # block the reactor if the move operation acts on different disks
     yield threads.deferToThread(os.rename, temppath, self.path)
     
     self.duration = time.time() - self.start_time
     error = self.checksum.hexdigest() != checksum
     
     if error:
         log.error("Transfer with key '{0}' failed".format(self.transfer_key))
         log.debug(" - Checksums:     source {0}".format(checksum))
         log.debug("                  receiv {0}".format(self.checksum.hexdigest()))
     else:
         log.info("Transfer with key '{0}' successfully completed".format(self.transfer_key))
         log.debug(" - Checksum:      {0}".format(checksum))
     
     log.debug(" - Duration:      {0:.1f} s".format(self.duration))
     log.debug(" - Average speed: {0}/s".format(sizeof_fmt(self.size / self.duration)))
     
     if error:
         raise InvalidChecksum(self.transfer_key)
Example #3
0
 def _discard_destination(self, failure, dest):
     del self.destinations[dest]
     log.error("Destination %s discarded, error follows" % dest)
     log.error(failure)
Example #4
0
 def clientConnectionFailed(self, connector, reason):
     log.error('Connection to AMQP broker failed. Reason {0}'.format(reason))
     super(AMQClientFactory, self).clientConnectionFailed(connector, reason)
Example #5
0
 def queue_error(self, failure):
     log.error("Queue error!")
     log.error(failure)
Example #6
0
 def processing_error(self, failure):
     log.error("An error occurred while processing a message!")
     log.error(failure)