Add logger for the internal geocoder too

This commit is contained in:
Mario de Frutos
2016-03-08 16:08:56 +01:00
parent c293b55c3c
commit bd2e380225
12 changed files with 58 additions and 44 deletions

View File

@@ -69,8 +69,8 @@ class IsolinesRoutingConfig(ServiceConfig):
def __init__(self, redis_connection, db_conn, username, orgname=None):
super(IsolinesRoutingConfig, self).__init__(redis_connection, username,
orgname)
db_config = ServicesDBConfig(db_conn)
config = self.__get_user_config(username, orgname)
db_config = ServicesDBConfig(db_conn)
filtered_config = {key: config[key] for key in self.ROUTING_CONFIG_KEYS if key in config.keys()}
self.__parse_config(filtered_config, db_config)
@@ -136,9 +136,11 @@ class IsolinesRoutingConfig(ServiceConfig):
class InternalGeocoderConfig(ServiceConfig):
def __init__(self, redis_connection, username, orgname=None):
def __init__(self, redis_connection, db_conn, username, orgname=None):
super(InternalGeocoderConfig, self).__init__(redis_connection,
username, orgname)
db_config = ServicesDBConfig(db_conn)
self._log_path = db_config.geocoder_log_path
@property
def service_type(self):
@@ -156,6 +158,10 @@ class InternalGeocoderConfig(ServiceConfig):
def geocoding_quota(self):
return None
@property
def log_path(self):
return self._log_path
class GeocoderConfig(ServiceConfig):
@@ -289,7 +295,7 @@ class GeocoderConfig(ServiceConfig):
@property
def cost_per_hit(self):
self._cost_per_hit
return self._cost_per_hit
@property
def log_path(self):

View File

@@ -1,4 +0,0 @@
{"geocoder_type": "geocoder_here", "username": "test_user", "processed_rows": 1, "successful_rows": 1, "cost": null, "kind": "high-resolution", "success": true, "processable_rows": 1, "created_at": "2016-03-08T14:51:54.316618", "real_rows": 1, "batched": false, "cache_hits": 0, "organization": "test_org", "used_credits": 0, "failed_rows": 0}
{"geocoder_type": "geocoder_here", "username": "test_user", "processed_rows": 1, "successful_rows": 1, "cost": null, "kind": "high-resolution", "success": true, "processable_rows": 1, "created_at": "2016-03-08T14:51:54.318872", "real_rows": 1, "batched": false, "cache_hits": 0, "organization": "test_org", "used_credits": 0, "failed_rows": 0}
{"geocoder_type": "geocoder_here", "username": "test_user", "processed_rows": 1, "successful_rows": 1, "cost": null, "kind": "high-resolution", "success": true, "processable_rows": 1, "created_at": "2016-03-08T14:51:54.322009", "real_rows": 1, "batched": false, "cache_hits": 0, "organization": null, "used_credits": 0, "failed_rows": 0}
{"geocoder_type": "geocoder_here", "username": "test_user", "processed_rows": 1, "successful_rows": 1, "cost": null, "kind": "high-resolution", "success": true, "processable_rows": 1, "created_at": "2016-03-08T14:51:54.323941", "real_rows": 1, "batched": false, "cache_hits": 0, "organization": null, "used_credits": 0, "failed_rows": 0}

View File

@@ -48,4 +48,4 @@ def _plpy_execute_side_effect(*args, **kwargs):
elif args[0] == "SELECT cartodb.CDB_Conf_GetConf('mapzen_conf') as conf":
return [{'conf': '{"routing_app_key": "app_key"}'}]
elif args[0] == "SELECT cartodb.CDB_Conf_GetConf('logger_conf') as conf":
return [{'conf': '{"geocoder_log_path": "path"}'}]
return [{'conf': '{"geocoder_log_path": "/dev/null"}'}]