adding some more debugging output

This commit is contained in:
Ryan Tucker 2010-01-01 20:11:36 -05:00
parent 0b8a7b89d2
commit c6fc1f1d80

View file

@ -113,6 +113,7 @@ class SlowFile:
else: else:
# we're late; something got slow. # we're late; something got slow.
self.delayfactor += 0.5 self.delayfactor += 0.5
logger.debug('%.2f late (congestion?); setting delayfactor to %.2f' % (starttime - self.lastblocktargettime, self.delayfactor))
if self.delayfactor < 1: if self.delayfactor < 1:
self.delayfactor = 1 self.delayfactor = 1
@ -245,7 +246,7 @@ if secrets.gpgsymmetrickey:
mesg += ', encrypted with secret key' mesg += ', encrypted with secret key'
logging.info(mesg) logging.info(mesg)
sys.stdout.write(mesg + '\n') sys.stdout.write(time.strftime('%d-%H:%M:%S') + ": " + mesg + '\n')
sys.stdout.flush() sys.stdout.flush()
# Prepare the pipeline # Prepare the pipeline
@ -277,11 +278,13 @@ else:
logging.info('Beginning post-processing of %i files from %s #%i' % (len(glob.glob(fileglob)), host, bkupNum)) logging.info('Beginning post-processing of %i files from %s #%i' % (len(glob.glob(fileglob)), host, bkupNum))
for i in sorted(glob.glob(fileglob)): for i in sorted(glob.glob(fileglob)):
sending_start = time.time()
if secrets.gpgsymmetrickey and not i.endswith('.gpg'): if secrets.gpgsymmetrickey and not i.endswith('.gpg'):
sendfile = encrypt_file(i, secrets.gpgsymmetrickey, compPath) sendfile = encrypt_file(i, secrets.gpgsymmetrickey, compPath)
else: else:
# either encryption is off, or the file is already encrypted # either encryption is off, or the file is already encrypted
sendfile = i sendfile = i
encrypt_seconds = time.time() - sending_start()
# create some output so backuppc doesn't time out # create some output so backuppc doesn't time out
sys.stdout.write("%s: Sending %s to S3...\n" % (time.strftime('%d-%H:%M:%S'), sendfile)) sys.stdout.write("%s: Sending %s to S3...\n" % (time.strftime('%d-%H:%M:%S'), sendfile))
@ -304,5 +307,12 @@ for i in sorted(glob.glob(fileglob)):
log.error('Encountered S3 exception %s, retrying in %i seconds (%i/%i)' % (e, sleeptime, retry_count, max_retries)) log.error('Encountered S3 exception %s, retrying in %i seconds (%i/%i)' % (e, sleeptime, retry_count, max_retries))
time.sleep(sleeptime) time.sleep(sleeptime)
size = os.path.getsize(sendfile)
os.unlink(sendfile) os.unlink(sendfile)
sending_seconds = time.time() - sending_start()
bytespersecond = size / (sending_seconds - encrypt_seconds)
sys.stdout.write('%s: File sent. Total time %i seconds, crypto time %i seconds, transfer speed %i bytes/second.\n' % (time.strftime('%d-%H:%M:%S'), sending_seconds, encrypt_seconds, bytespersecond))