Coder Social home page Coder Social logo

grandfatherson's People

Contributors

rory-geoghegan-ecometrica avatar sfllaw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grandfatherson's Issues

Issue with first week day

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!

Suggestions for README improvements

  • It could be clarified whether calculations are inclusive or exclusive of the current date of 'now'. The answer appears to be inclusive. It coudl be worth mentioning that this means that this tool should run after daily snapshotting happens.
  • It could also be clarified that "days:3" does NOT mean the "the 3 most recent daily backups", it means "backups from the 3 most recent days". If you have 3 three daily backups but none in the last 3 days, this tool would select all your backups for deletion and leave you with zero. There's no problem as long as the backups are running fine. But if you are backups get stalled and your pruning script does not, you'll slowing eat through your backups.

NameError: name 'long' is not defined When Using Python 3

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.

Suggestion: change default value of 'now' to prevent data loss

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.