Skip to content

Commit

Permalink
CV2-5050 remove some old logs from development work (#464)
Browse files Browse the repository at this point in the history
* CV2-5050 remove some old logs from development work

* Update text_similarity.py
  • Loading branch information
DGaffney authored Oct 29, 2024
1 parent 7ff4a67 commit 3063927
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
1 change: 0 additions & 1 deletion app/main/lib/elastic_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def get_blocked_presto_response(task, model, modality):
obj, temporary = get_object(task, model)
doc_id = obj["doc_id"]
callback_url = Presto.add_item_callback_url(app.config['ALEGRE_HOST'], modality)
app.logger.info(f"Object for {task} of model {model} with id of {doc_id} has requires_encoding value of {requires_encoding(obj)}")
if requires_encoding(obj):
blocked_results = []
for model_key in obj.pop("models", []):
Expand Down
1 change: 0 additions & 1 deletion app/main/lib/media_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ def get_blocked_presto_response(task, model, modality):
callback_url = Presto.add_item_callback_url(app.config['ALEGRE_HOST'], modality)
if task.get("doc_id") is None:
task["doc_id"] = str(uuid.uuid4())
app.logger.error(f"Object for {task} of model {model} with id of {obj.id} has requires_encoding value of {obj.requires_encoding}")
if obj.requires_encoding:
response = get_presto_request_response(modality, callback_url, task)
# Warning: this is a blocking hold to wait until we get a response in
Expand Down
5 changes: 2 additions & 3 deletions app/main/lib/text_similarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def get_model_and_threshold(search_params):
if 'per_model_threshold' in search_params and isinstance(search_params['per_model_threshold'], list) and [e for e in search_params['per_model_threshold'] if e["model"] == model_key]:
threshold = [e for e in search_params['per_model_threshold'] if e["model"] == model_key][0]["value"]
if threshold is None:
app.logger.error(
app.logger.warn(
f"[Alegre Similarity] get_model_and_threshold - no threshold was specified, backing down to default of 0.9 - search_params is {search_params}")
threshold = 0.9
return model_key, threshold
Expand Down Expand Up @@ -193,8 +193,7 @@ def return_sources(results):
May throw an error if source has index and score keys some day, but easy to fix for that,
and should noisily break since it would have other downstream consequences.
"""
#TODO: remove underscore version after dependencies updated https://meedan.atlassian.net/browse/CV2-5546
return [dict(**r["_source"], **{"_id": r["_id"], "id": r["_id"], "index": r["_index"], "_score": r["_score"],"score": r["_score"]}) for r in results]
return [dict(**r["_source"], **{"_id": r["_id"], "id": r["_id"], "index": r["_index"], "score": r["_score"]}) for r in results]

def strip_vectors(results):
for result in results:
Expand Down

0 comments on commit 3063927

Please sign in to comment.