Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

None type error #524

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions tr_sys/tr_ars/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,11 @@ def mergeMessagesRecursive(mergedMessage,messageList,pk):
if len(messageList)==0:
try:
results = mergedMessage.getResults()
logging.info('the type of results for mergedMessage.getResults class %s' % (type(results)))
if results is not None:
logging.info(f'Averaing normalized scores for {pk}')
try:
results = results.getRaw()
logging.info('the type of results for results.getRaw class %s' % (type(results)))
for result in results:
logging.info('result.keys are: %s' % (result.keys()))
if "normalized_score" in result.keys():
ns = result["normalized_score"]
if isinstance(ns,list) and len(ns)>0:
Expand Down Expand Up @@ -606,8 +603,8 @@ def merge_and_post_process(parent_pk,message_to_merge, agent_name):
merged = merge_received(parent_pk,message_to_merge, agent_name)
post_process(merged.data,merged.id, agent_name)
except Exception as e:
logging.debug("Problem with merger or post processing for agent %s pk: %s " % (agent_name, (parent_pk)))
logging.exception("error in merger or post processing")
logging.info("Problem with merger or post processing for agent %s pk: %s " % (agent_name, (parent_pk)))
merged.status='E'
merged.code = 422
merged.save()
Expand Down Expand Up @@ -1181,6 +1178,7 @@ def merge_received(parent_pk,message_to_merge, agent_name, counter=0):


merged_dict = merged.to_dict()
logging.info('the keys for merged_dict are %s' % merged_dict.keys())
new_merged_message.data=merged_dict
new_merged_message.status='R'
new_merged_message.code=202
Expand All @@ -1200,8 +1198,8 @@ def merge_received(parent_pk,message_to_merge, agent_name, counter=0):
parent.save()
return new_merged_message
except Exception as e:
logging.exception("problem with merging for %s :" % agent_name)
raise e
logging.exception("problem with merging for %s :" % agent_name)
#If anything goes wrong, we at least need to unlock the semaphore
#TODO make some actual proper Exception handling here.
parent.merge_semaphore=False
Expand Down