From 24ffdeb1eccecdc90385a76bd16c594bf8b48fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20Schl=C3=BCter?= Date: Sun, 18 Jan 2015 11:22:07 +0100 Subject: [PATCH] Add niceness and log output to the geocoding --- locator.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/locator.py b/locator.py index 3f06c6a..feaa56d 100644 --- a/locator.py +++ b/locator.py @@ -2,7 +2,11 @@ import time from models import * from analyze import * -for article in Article.select().limit(5): +print("Start geocoding...") +start_time = time.time() +articles = Article.select() + +for article in articles: potential = get_potential_places(article.place, article.description) places = improve_potential_places(potential) @@ -19,4 +23,7 @@ for article in Article.select().limit(5): location["match"] = query Location.create(**location) - # time.sleep(1) + time.sleep(1) + +time_taken = time.time() - start_time +print("Geocoded {} articles in {} seconds".format(articles.count(), time_taken))