Empty vs missing count detail
This commit is contained in:
parent
3a5360c96c
commit
d060ab3d41
@ -39,7 +39,7 @@ def run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, org
|
|||||||
|
|
||||||
logger = Logger(logger_config)
|
logger = Logger(logger_config)
|
||||||
|
|
||||||
success_count, failed_count = 0, 0
|
success_count, failed_count, empty_count = 0, 0, 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
searches = json.loads(searches_string)
|
searches = json.loads(searches_string)
|
||||||
@ -54,16 +54,9 @@ def run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, org
|
|||||||
a_failed_one = None
|
a_failed_one = None
|
||||||
if not geocode_results == EMPTY_BATCH_RESPONSE:
|
if not geocode_results == EMPTY_BATCH_RESPONSE:
|
||||||
for result in geocode_results:
|
for result in geocode_results:
|
||||||
if len(result) > 2:
|
metadata = result[2] if len(result) > 2 else {}
|
||||||
metadata = result[2]
|
|
||||||
else:
|
|
||||||
logger.warning('Geocoding without metadata',
|
|
||||||
data={"username": username, "orgname": orgname})
|
|
||||||
metadata = {}
|
|
||||||
|
|
||||||
if metadata.get('error', None):
|
if metadata.get('error', None):
|
||||||
logger.warning('Geocoding error',
|
|
||||||
data={"username": username, "orgname": orgname, "error": metadata['error']})
|
|
||||||
results.append([result[0], None, json.dumps(metadata)])
|
results.append([result[0], None, json.dumps(metadata)])
|
||||||
a_failed_one = result
|
a_failed_one = result
|
||||||
failed_count += 1
|
failed_count += 1
|
||||||
@ -74,18 +67,25 @@ def run_street_point_geocoder(plpy, GD, geocoder, service_manager, username, org
|
|||||||
success_count += 1
|
success_count += 1
|
||||||
else:
|
else:
|
||||||
results.append([result[0], None, json.dumps(metadata)])
|
results.append([result[0], None, json.dumps(metadata)])
|
||||||
|
empty_count += 1
|
||||||
|
|
||||||
empty_count = len(searches) - success_count - failed_count
|
missing_count = len(searches) - success_count - failed_count - empty_count
|
||||||
logger.debug("--> Success: {}; empty: {}; failed: {}".format(success_count, empty_count, failed_count))
|
|
||||||
|
logger.debug("--> Success: {}; empty: {}; missing: {}, failed: {}".
|
||||||
|
format(success_count, empty_count, missing_count, failed_count))
|
||||||
if a_failed_one:
|
if a_failed_one:
|
||||||
logger.warning("failed geocoding",
|
logger.warning("failed geocoding",
|
||||||
data={
|
data={
|
||||||
"username": username,
|
"username": username,
|
||||||
"orgname": orgname,
|
"orgname": orgname,
|
||||||
"failed": str(a_failed_one)
|
"failed": str(a_failed_one),
|
||||||
|
"success_count": success_count,
|
||||||
|
"empty_count": empty_count,
|
||||||
|
"missing_count": missing_count,
|
||||||
|
"failed_count": failed_count
|
||||||
})
|
})
|
||||||
service_manager.quota_service.increment_success_service_use(success_count)
|
service_manager.quota_service.increment_success_service_use(success_count)
|
||||||
service_manager.quota_service.increment_empty_service_use(empty_count)
|
service_manager.quota_service.increment_empty_service_use(empty_count + missing_count)
|
||||||
service_manager.quota_service.increment_failed_service_use(failed_count)
|
service_manager.quota_service.increment_failed_service_use(failed_count)
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
Loading…
Reference in New Issue
Block a user