b39c34cf by 周伟奇

add log

1 parent 1bd26cf0
...@@ -910,13 +910,16 @@ class Command(BaseCommand, LoggerMixin): ...@@ -910,13 +910,16 @@ class Command(BaseCommand, LoggerMixin):
910 old_res_str = getattr(res_obj, field) 910 old_res_str = getattr(res_obj, field)
911 if old_res_str is None: 911 if old_res_str is None:
912 last_res_str = json.dumps(license_list) 912 last_res_str = json.dumps(license_list)
913 else 913 else:
914 old_res_list = json.loads(old_res_str) 914 old_res_list = json.loads(old_res_str)
915 old_res_list.extend(license_list) 915 old_res_list.extend(license_list)
916 last_res_str = json.dumps(old_res_list) 916 last_res_str = json.dumps(old_res_list)
917 setattr(res_obj, field, last_res_str) 917 setattr(res_obj, field, last_res_str)
918 res_obj.save() 918 res_obj.save()
919 919
920 self.online_log.info('{0} [ocr result save success] [task={1}] [res_id={2}]'.format(
921 self.log_base, task_str, res_obj.id))
922
920 # 触发比对 923 # 触发比对
921 # compare.apply_async((doc.application_id, business_type, None, ocr_res_id), queue='queue_compare') 924 # compare.apply_async((doc.application_id, business_type, None, ocr_res_id), queue='queue_compare')
922 finally: 925 finally:
...@@ -926,6 +929,7 @@ class Command(BaseCommand, LoggerMixin): ...@@ -926,6 +929,7 @@ class Command(BaseCommand, LoggerMixin):
926 shutil.rmtree(img_save_path, ignore_errors=True) 929 shutil.rmtree(img_save_path, ignore_errors=True)
927 pdf_path = os.path.join(doc_data_path, '{0}.pdf'.format(doc_id_str)) 930 pdf_path = os.path.join(doc_data_path, '{0}.pdf'.format(doc_id_str))
928 os.remove(pdf_path) 931 os.remove(pdf_path)
932 self.online_log.info('{0} [pdf & img remove] [task={1}]'.format(self.log_base, task_str))
929 except Exception as e: 933 except Exception as e:
930 self.online_log.error('{0} [process error (pdf & img remove)] [task={1}] [error={2}]'.format( 934 self.online_log.error('{0} [process error (pdf & img remove)] [task={1}] [error={2}]'.format(
931 self.log_base, task_str, traceback.format_exc())) 935 self.log_base, task_str, traceback.format_exc()))
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!