diff --git a/server/lib/python/cartodb_services/cartodb_services/geocoder.py b/server/lib/python/cartodb_services/cartodb_services/geocoder.py index cea8ef4..c6043e4 100644 --- a/server/lib/python/cartodb_services/cartodb_services/geocoder.py +++ b/server/lib/python/cartodb_services/cartodb_services/geocoder.py @@ -91,10 +91,8 @@ class StreetPointBulkGeocoder: if len(street_geocoder_searches) > self.MAX_BATCH_SIZE: raise Exception("Batch size can't be larger than {}".format(self.MAX_BATCH_SIZE)) if self._should_use_batch(street_geocoder_searches): - self._logger.debug('--> Batch geocode') return self._batch_geocode(street_geocoder_searches) else: - self._logger.debug('--> Serial geocode') return self._serial_geocode(street_geocoder_searches) def _batch_geocode(self, street_geocoder_searches): diff --git a/server/lib/python/cartodb_services/cartodb_services/google/bulk_geocoder.py b/server/lib/python/cartodb_services/cartodb_services/google/bulk_geocoder.py index 42a60d9..0e1ab1f 100644 --- a/server/lib/python/cartodb_services/cartodb_services/google/bulk_geocoder.py +++ b/server/lib/python/cartodb_services/cartodb_services/google/bulk_geocoder.py @@ -26,7 +26,6 @@ class GoogleMapsBulkGeocoder(GoogleMapsGeocoder, StreetPointBulkGeocoder): for search in searches: (cartodb_id, street, city, state, country) = search lng_lat, metadata = self.geocode_meta(street, city, state, country) - self._logger.debug('--> lng_lat: {}. metadata: {}'.format(lng_lat, metadata)) results.append((cartodb_id, lng_lat, metadata)) return results @@ -35,7 +34,6 @@ class GoogleMapsBulkGeocoder(GoogleMapsGeocoder, StreetPointBulkGeocoder): pool = Pool(processes=self.PARALLEL_PROCESSES) for search in searches: (cartodb_id, street, city, state, country) = search - self._logger.debug('async geocoding --> {}'.format(search)) address = compose_address(street, city, state, country) if address: components = self._build_optional_parameters(city, state, country) diff --git a/server/lib/python/cartodb_services/cartodb_services/google/geocoder.py b/server/lib/python/cartodb_services/cartodb_services/google/geocoder.py index 74d8f53..44b678c 100644 --- a/server/lib/python/cartodb_services/cartodb_services/google/geocoder.py +++ b/server/lib/python/cartodb_services/cartodb_services/google/geocoder.py @@ -63,7 +63,6 @@ class GoogleMapsGeocoder(): def _process_results(self, results): if results: - self._logger.debug('--> results: {}'.format(results[0])) return [ self._extract_lng_lat_from_result(results[0]), self._extract_metadata_from_result(results[0]) diff --git a/server/lib/python/cartodb_services/cartodb_services/here/bulk_geocoder.py b/server/lib/python/cartodb_services/cartodb_services/here/bulk_geocoder.py index 68c4766..51b9ec9 100644 --- a/server/lib/python/cartodb_services/cartodb_services/here/bulk_geocoder.py +++ b/server/lib/python/cartodb_services/cartodb_services/here/bulk_geocoder.py @@ -47,7 +47,6 @@ class HereMapsBulkGeocoder(HereMapsGeocoder, StreetPointBulkGeocoder): def _batch_geocode(self, searches): request_id = self._send_batch(self._searches_to_csv(searches)) - self._logger.debug('--> Sent batch {}'.format(request_id)) last_processed = 0 stalled_retries = 0 @@ -55,26 +54,19 @@ class HereMapsBulkGeocoder(HereMapsGeocoder, StreetPointBulkGeocoder): while True: job_info = self._job_status(request_id) if job_info.processed_count == last_processed: - self._logger.debug('--> no progress ({})'.format(last_processed)) stalled_retries += 1 if stalled_retries > self.MAX_STALLED_RETRIES: raise Exception('Too many retries for job {}'.format(request_id)) else: - self._logger.debug('--> progress ({} != {})'.format(job_info.processed_count, last_processed)) stalled_retries = 0 last_processed = job_info.processed_count - self._logger.debug('--> Job poll check ({}): {}'.format( - stalled_retries, job_info)) if job_info.status in self.JOB_FINAL_STATES: break else: time.sleep(self.BATCH_RETRY_SLEEP_S) - self._logger.debug('--> Job complete: {}'.format(job_info)) - results = self._download_results(request_id) - self._logger.debug('--> Results: {} rows; {}'.format(len(results), results)) return results diff --git a/server/lib/python/cartodb_services/cartodb_services/here/geocoder.py b/server/lib/python/cartodb_services/cartodb_services/here/geocoder.py index 6031c97..f52d2d7 100644 --- a/server/lib/python/cartodb_services/cartodb_services/here/geocoder.py +++ b/server/lib/python/cartodb_services/cartodb_services/here/geocoder.py @@ -99,7 +99,6 @@ class HereMapsGeocoder(Traceable): try: response = self._perform_request(params) result = response['Response']['View'][0]['Result'][0] - self._logger.debug('--> Result: {}'.format(result)) return [self._extract_lng_lat_from_result(result), self._extract_metadata_from_result(result)] except IndexError: diff --git a/server/lib/python/cartodb_services/cartodb_services/mapbox/bulk_geocoder.py b/server/lib/python/cartodb_services/cartodb_services/mapbox/bulk_geocoder.py index 3ddd457..2563d43 100644 --- a/server/lib/python/cartodb_services/cartodb_services/mapbox/bulk_geocoder.py +++ b/server/lib/python/cartodb_services/cartodb_services/mapbox/bulk_geocoder.py @@ -28,7 +28,6 @@ class MapboxBulkGeocoder(MapboxGeocoder, StreetPointBulkGeocoder): results = [] for search in searches: elements = self._encoded_elements(search) - self._logger.debug('--> Sending serial search: {}'.format(search)) result = self.geocode_meta(*elements) results.append((search[0], result[0], result[1])) @@ -52,13 +51,10 @@ class MapboxBulkGeocoder(MapboxGeocoder, StreetPointBulkGeocoder): free = ', '.join([elem for elem in elements if elem]) frees.append(free) - self._logger.debug('--> sending free search: {}'.format(frees)) full_results = self.geocode_free_text_meta(frees) results = [] - self._logger.debug('--> searches: {}; xy: {}'.format(searches, full_results)) for s, r in zip(searches, full_results): results.append((s[0], r[0], r[1])) - self._logger.debug('--> results: {}'.format(results)) return results def _country_code(self, country): diff --git a/server/lib/python/cartodb_services/cartodb_services/mapbox/geocoder.py b/server/lib/python/cartodb_services/cartodb_services/mapbox/geocoder.py index 1fc8b4e..0e3cd11 100644 --- a/server/lib/python/cartodb_services/cartodb_services/mapbox/geocoder.py +++ b/server/lib/python/cartodb_services/cartodb_services/mapbox/geocoder.py @@ -53,7 +53,6 @@ class MapboxGeocoder(Traceable): def _parse_geocoder_response(self, response): json_response = json.loads(response) - self._logger.debug('--> json response: {}'.format(json_response)) if json_response: if type(json_response) != list: @@ -154,7 +153,6 @@ class MapboxGeocoder(Traceable): try: free_search = ';'.join([self._escape(fs) for fs in free_searches]) - self._logger.debug('--> free search: {}, country: {}'.format(free_search, country)) response = self._geocoder.forward(address=free_search.decode('utf-8'), country=country) diff --git a/server/lib/python/cartodb_services/cartodb_services/tomtom/bulk_geocoder.py b/server/lib/python/cartodb_services/cartodb_services/tomtom/bulk_geocoder.py index c8ad803..8fc2e92 100644 --- a/server/lib/python/cartodb_services/cartodb_services/tomtom/bulk_geocoder.py +++ b/server/lib/python/cartodb_services/cartodb_services/tomtom/bulk_geocoder.py @@ -37,10 +37,8 @@ class TomTomBulkGeocoder(TomTomGeocoder, StreetPointBulkGeocoder): city = city.encode('utf-8') if city else None state = state.encode('utf-8') if state else None country = country.encode('utf-8') if country else None - self._logger.debug('--> Sending serial search: {}'.format(search)) result = self.geocode_meta(searchtext=address, city=city, state_province=state, country=country) - self._logger.debug('--> result sent') results.append((search_id, result[0], result[1])) return results @@ -50,12 +48,10 @@ class TomTomBulkGeocoder(TomTomGeocoder, StreetPointBulkGeocoder): results = [] for s, r in zip(searches, full_results): results.append((s[0], r[0], r[1])) - self._logger.debug('--> results: {}'.format(results)) return results def _send_batch(self, searches): body = {'batchItems': [{'query': self._query(s)} for s in searches]} - self._logger.debug('--> {}; Body: {}'.format(self.BATCH_URL, body)) request_params = { 'key': self._apikey } @@ -63,9 +59,7 @@ class TomTomBulkGeocoder(TomTomGeocoder, StreetPointBulkGeocoder): allow_redirects=False, params=request_params, timeout=(self.connect_timeout, self.read_timeout)) - self._logger.debug('--> response: {}'.format(response.status_code)) if response.status_code == 303: - self._logger.debug(response.headers) return response.headers['Location'] else: msg = "Error sending batch: {}; Headers: {}".format( @@ -78,14 +72,12 @@ class TomTomBulkGeocoder(TomTomGeocoder, StreetPointBulkGeocoder): while True: response = self.session.get(self.BASE_URL + location) if response.status_code == 200: - self._logger.debug('--> Results ready {}'.format(location)) return self._parse_results(response.json()) elif response.status_code == 202: stalled_retries += 1 if stalled_retries > self.MAX_STALLED_RETRIES: raise Exception('Too many retries for job {}'.format(location)) location = response.headers['Location'] - self._logger.debug('--> Waiting for {}'.format(location)) time.sleep(self.BATCH_RETRY_SLEEP_S) else: msg = "Error downloading batch: {}; Headers: {}".format(