some tweaks: easier retry, better maths

This commit is contained in:
Ryan Tucker 2009-12-30 09:35:15 -05:00
parent f942a2763f
commit 5fe7494f15

View file

@ -125,7 +125,7 @@ class SlowFile:
logger.debug('Target %i bytes/second (%i kilobits/second), delay factor %.2f, block len %i' % (targetspeed, targetspeed*8/1024, self.delayfactor, len))
try:
newkbits = int(open('/home/rtucker/Dropbox/Semaphores/BackupPC_archiveHost_s3.maxspeed', 'r').readline())
newspeed = (newkbits/float(8))*1024
newspeed = int((newkbits/float(8))*1024)
if newspeed != self.speed:
self.delayfactor = 1
self.speed = newspeed
@ -259,6 +259,10 @@ else:
fileglob = '%s/%s.%i.tar' % (outLoc, host, bkupNum)
cmd += '> %s' % fileglob
# is there already evidence of this having been done before?
if glob.glob(fileglob):
logging.info('Evidence of failed execution run prior! Finishing it.')
else:
logging.debug('Executing %s' % cmd)
returncode = os.system(cmd)
@ -270,9 +274,10 @@ if returncode != 0:
logging.info('Beginning post-processing of %i files from %s #%i' % (len(glob.glob(fileglob)), host, bkupNum))
for i in sorted(glob.glob(fileglob)):
if secrets.gpgsymmetrickey:
if secrets.gpgsymmetrickey and not i.endswith('.gpg'):
sendfile = encrypt_file(i, secrets.gpgsymmetrickey, compPath)
else:
# either encryption is off, or the file is already encrypted
sendfile = i
retry_count = 0