diff --git a/tr_sys/tr_ars/api.py b/tr_sys/tr_ars/api.py index 1bc57dc4..8b2837b0 100644 --- a/tr_sys/tr_ars/api.py +++ b/tr_sys/tr_ars/api.py @@ -440,10 +440,10 @@ def message(req, key): mesg.code = code mesg.data = data mesg.save() - logger.info("pre async call for agent %s" % agent_name) if agent_name.startswith('ara-'): + logger.info("pre async call for agent %s" % agent_name) utils.merge_and_post_process.apply_async((parent_pk,message_to_merge['message'],agent_name)) - logger.info("post async call for agent %s" % agent_name) + logger.info("post async call for agent %s" % agent_name) # create child message if this one already has results diff --git a/tr_sys/tr_ars/tasks.py b/tr_sys/tr_ars/tasks.py index de829f5f..b9b286ce 100644 --- a/tr_sys/tr_ars/tasks.py +++ b/tr_sys/tr_ars/tasks.py @@ -162,15 +162,15 @@ def send_message(actor_dict, mesg_dict, timeout=300): agent_name = str(mesg.actor.agent.name) if mesg.code == 200 and results is not None and len(results)>0: - logger.info("pre async call for agent %s" % agent_name) if agent_name.startswith('ara-'): + logger.info("pre async call for agent %s" % agent_name) # logging.debug("Merge starting for "+str(mesg.pk)) # new_merged = utils.merge_received(parent_pk,message_to_merge['message'], agent_name) # logging.debug("Merge complete for "+str(new_merged.pk)) # utils.post_process(new_merged.data,new_merged.pk, agent_name) # logging.debug("Post processing done for "+str(new_merged.pk)) utils.merge_and_post_process.apply_async((parent_pk,message_to_merge['message'],agent_name)) - logger.info("post async call for agent %s" % agent_name) + logger.info("post async call for agent %s" % agent_name) else: logging.debug("Skipping merge and post for "+str(mesg.pk)+ " because the contributing message is in state: "+str(mesg.code)) diff --git a/tr_sys/tr_ars/utils.py b/tr_sys/tr_ars/utils.py index 4e4c84ba..e42cba2c 100644 --- a/tr_sys/tr_ars/utils.py +++ b/tr_sys/tr_ars/utils.py @@ -282,7 +282,8 @@ def mergeMessages(messageList,pk): def mergeMessagesRecursive(mergedMessage,messageList,pk): #need to clean things up and average our normalized scores now that they're all in - logging.info(f'Merging : {pk} recursively. Currently {str(len(messageList))} messages left in the queue') + logging.info(f'Merging new pk: {pk} recursively. Currently {str(len(messageList))} messages left in the queue') + logging.info(f'Current messages list in the queue: {messageList}') if len(messageList)==0: try: results = mergedMessage.getResults() @@ -295,8 +296,6 @@ def mergeMessagesRecursive(mergedMessage,messageList,pk): ns = result["normalized_score"] if isinstance(ns,list) and len(ns)>0: result["normalized_score"]= sum(ns) / len(ns) - else: - logging.info("ns type is: %s" % type(ns)) else: logging.info('there is no normalized_score in result.keys()') except Exception as e: @@ -1147,7 +1146,7 @@ def merge(pk,merged_pk): def merge_received(parent_pk,message_to_merge, agent_name, counter=0): parent = Message.objects.get(pk=parent_pk) current_merged_pk=parent.merged_version_id - logging.info("Beginning merge for agent %s with pk: %s" %(agent_name,str(current_merged_pk))) + logging.info("Beginning merge for agent %s with current_pk: %s" %(agent_name,str(current_merged_pk))) #to_merge_message= Message.objects.get(pk=pk_to_merge) #to_merge_message_dict=get_safe(to_merge_message.to_dict(),"fields","data","message") t_to_merge_message=TranslatorMessage(message_to_merge) @@ -1200,7 +1199,7 @@ def merge_received(parent_pk,message_to_merge, agent_name, counter=0): else: parent.merged_versions_list.append(pk_infores_merge) parent.save() - logging.info("returning new_merged_message to be post processed") + logging.info("returning new_merged_message to be post processed with pk: %s" % str(new_merged_message.pk)) return new_merged_message except Exception as e: logging.exception("problem with merging for %s :" % agent_name)