Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to sync_folder_to_container speed, feature and verbose logging #355

Merged
merged 3 commits into from
Apr 25, 2014

Conversation

mlilius
Copy link
Contributor

@mlilius mlilius commented Apr 18, 2014

This is my first open source code submission so please let me know if I am doing anything wrong. Which it looks like I did. This is my second attempt.

I added two features to sync_folder_to_container.

  1. Instead of downloading the data for each object it downloads a list and uses that to compare the md5 against. This speeds things up a lot.
  2. I added the ability to specify a prefix to be used during the sync. This allows you to sync a folder into just a part of the container instead of the entire container. This also lets you do an incremental sync if your files to be synced are in different folders.

I added verbose logging to sync_folder_to_container while I was in there. #250

Added the ability to specify a prefix to be added to the object name during checking and uploading during a sync

Sped up sync_folder_to_container by having it pull down a list of objects all at once to use to compare against instead of checking once for each file.
prefix="imgFolder") it will upload the files to the
container/imgFolder/... instead of just container/...

Set `log_level` to > 0 to print what is going on. Log level 1 logs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the idea of visibility into the process. I would suggest using the existing pyrax logging:

logger = logging.getLogger("pyrax")

I also think that a better name for this parameter would be 'verbose', drop the different levels, and make it default to False. If someone is interested in the progress of the sync, having the one extra line of output isn't prohibitive.

@EdLeafe
Copy link
Contributor

EdLeafe commented Apr 19, 2014

I've added some comments on your code. In general I think this looks like an excellent addition to pyrax. Thanks for working on this!

…h the existing prarameter called prefix which I restored.

Changed to use the python logging method instead of using print statements.

Renamed log_level to verbose and changed it to a simple boolean variable.
@mlilius
Copy link
Contributor Author

mlilius commented Apr 22, 2014

Thanks for the review and tips. I have made the recommended changes.

@EdLeafe EdLeafe merged commit 6346edc into pycontribs:working Apr 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants