ecometrica / grandfatherson Goto Github PK
View Code? Open in Web Editor NEWGrandfather-father-son backup rotation calculator
License: BSD 3-Clause "New" or "Revised" License
Grandfather-father-son backup rotation calculator
License: BSD 3-Clause "New" or "Revised" License
Hi,
First, thanks for developing this grandfatherson! I use it as a requirement of my project: bakthat, I there is an issue with the firstweekday
keyword argument, here is an example: http://nbviewer.ipython.org/5553570
With first firstweekday=grandfatherson.MONDAY
:
('Monday', datetime.datetime(2013, 3, 4, 0, 8, 4, 4437)),
('Saturday', datetime.datetime(2013, 3, 9, 0, 8, 4, 4437)),
('Saturday', datetime.datetime(2013, 3, 16, 0, 8, 4, 4437)),
('Saturday', datetime.datetime(2013, 3, 23, 0, 8, 4, 4437)),
('Saturday', datetime.datetime(2013, 3, 30, 0, 8, 4, 4437)),
('Saturday', datetime.datetime(2013, 4, 6, 0, 8, 4, 4437)),
('Saturday', datetime.datetime(2013, 4, 13, 0, 8, 4, 4437)),
('Saturday', datetime.datetime(2013, 4, 20, 0, 8, 4, 4437)),
('Saturday', datetime.datetime(2013, 4, 27, 0, 8, 4, 4437)),
('Saturday', datetime.datetime(2013, 5, 4, 0, 8, 4, 4437)),
Only the first weekly backup is kept on Monday, Saturday for the others.
Thanks!
When using Python 3 instead of Python 2.7 the following error appears when invoking the grandfatherson.dates_to_delete function:
File "/usr/local/lib/python3.4/dist-packages/grandfatherson/__init__.py", line 220, in dates_to_delete
firstweekday=firstweekday, now=now)
File "/usr/local/lib/python3.4/dist-packages/grandfatherson/__init__.py", line 204, in dates_to_keep
firstweekday=firstweekday, now=now)
File "/usr/local/lib/python3.4/dist-packages/grandfatherson/__init__.py", line 172, in to_keep
filters.Minutes.filter(datetimes, number=minutes, now=now) |
File "/usr/local/lib/python3.4/dist-packages/grandfatherson/filters.py", line 55, in filter
if number < 0 or not isinstance(number, (int, long)):
NameError: name 'long' is not defined
The current recommendation when migrating from Python 2.7 to Python 3 is to use an int instead of a long.
In #6 I recommended documenting a data loss case that might be surprising: If your backups are interrupted, a pruning tool based on grandfatherson
could delete more backups than you might like because days:3
deletes backups older than 3 days ago and does NOT attempt to keep 3 days worth of backups.
That data loss case can be avoided by changing the default value of 'now' to match the most recent timestamp of the backups.
If that change were made, an interruption in daily backups being made would still result in days:3
retaining the most recent 3 days of backups that were successful.
I understand that data retention rules also call for making sure that backups are eventually deleted, but it seems better for defaults to err on the side of "data retention" then data loss!
For the case where daily backups are being made and the pruning tool runs after the daily backups, there would no difference in the result.
When your backups fail to run for some reason might be exactly the time that you want to preserve older backups in the series and not keep pruning the list smaller and smaller while backups are offline.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.