Skip to content

Instantly share code, notes, and snippets.

@shiplunc
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shiplunc/a0116db87a2a2e0b6237 to your computer and use it in GitHub Desktop.
Save shiplunc/a0116db87a2a2e0b6237 to your computer and use it in GitHub Desktop.
Estimated time calculator for Getty Re indexing
# Put this file on scripts folder and run using following command
# sudo DJANGO_SETTINGS_MODULE=theplatform.settings /root/python-env/bin/python estimated-time-for-getty-reindex.py /home/ubuntu/source-72-combine-getty-assetgroups.checkpoint
import sys
import datetime
def print_progress(filename):
with open(filename, 'r') as f:
content = f.read()
(dur, checkpoint_info) = eval(content)
(_, _, checkpoint_id, num_err, num_suc) = checkpoint_info
from theplatform.newscred.models import Source, Image
GETTY_SOURCE = Source.objects.get(name='Getty Images')
remn = Image.objects.filter(source=GETTY_SOURCE, id__lt=checkpoint_id).count()
rdur = dur*remn/(num_err+num_suc)
print "Estimated remaining time to complete: %s" % rdur
def main():
print_progress(sys.argv[1])
if __name__ == '__main__':
main()
@shiplunc
Copy link
Author

The back pop is completed. Content of the checkpoint after completion is

[datetime.timedelta(20, 7796, 861578), ('theplatform.newscred.models.image', 'Image', 4063647L, 10, 34294634)]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment