backups = [[x, re.match('.*(\d\d\d\d-\d\d-\d\d).*', x)] for x in backups]
backups = [[x[0], strptime(x[1].groups()[0], '%Y-%m-%d')] for x in backups]
-keep = backups[:3]
-backups = backups[3:]
+keep = backups[:2]
+backups = backups[2:]
monthlys = {}
for x in backups:
month = (x[1].tm_year, x[1].tm_mon)
if month not in monthlys:
monthlys[month] = x
- if len(monthlys) > 4:
+ if len(monthlys) > 3:
break
keep.extend(monthlys.values())
while True:
try:
next = queue.get(timeout=3)
+ print "Consuming", next
#print next[0] + ':',
log = db.Backup.get_by(db=next[0])
if not log:
p1.wait()
err = p0.stderr.read()
except Exception, e:
+ print "Error on", next
+ print e
err = str(e)
if len(err):
log.dump_errnum = p0.returncode
db.session.flush()
#print 'Done'
except (KeyboardInterrupt, SystemExit):
+ print "Got exit request"
break
except Empty:
+ print "No queue."
if finished:
+ print "Done!"
break
t_consumer = threading.Thread(target=consumer)