3bdf0e45 by 周伟奇

fix bug

1 parent fc8f7e0d
......@@ -7,6 +7,7 @@ import asyncio
import aiohttp
import difflib
import requests
import traceback
from collections import Counter
from datetime import datetime, date
from django.utils import timezone
......@@ -93,7 +94,7 @@ class Command(BaseCommand, LoggerMixin):
self.edms.download(pdf_path, doc.metadata_version_id)
except Exception as e:
self.cronjob_log.warn('{0} [edms download failed] [times={1}] [pdf_path={2}] '
'[error={3}]'.format(self.log_base, times, pdf_path, e))
'[error={3}]'.format(self.log_base, times, pdf_path, traceback.format_exc()))
edms_exc = str(e)
else:
break
......@@ -398,13 +399,13 @@ class Command(BaseCommand, LoggerMixin):
except EDMSException as e:
doc.status = DocStatus.PROCESS_FAILED.value
doc.save()
self.cronjob_log.error('{0} [process failed (edms download)] [task={1}] [err={2}]'.format(
self.log_base, task_str, e))
self.cronjob_log.error('{0} [process failed (edms download)] [task={1}] [error={2}]'.format(
self.log_base, task_str, traceback.format_exc()))
except Exception as e:
doc.status = DocStatus.PROCESS_FAILED.value
doc.save()
self.cronjob_log.error('{0} [process failed (pdf to img)] [task={1}] [err={2}]'.format(
self.log_base, task_str, e))
self.cronjob_log.error('{0} [process failed (pdf to img)] [task={1}] [error={2}]'.format(
self.log_base, task_str, traceback.format_exc()))
def img_2_ocr_1(self, img_queue, todo_count_dict, res_dict, finish_queue, lock, url):
while True:
......@@ -432,7 +433,7 @@ class Command(BaseCommand, LoggerMixin):
raise OCR1Exception('ocr_1 status code: {0}'.format(ocr_1_response.status_code))
except Exception as e:
self.cronjob_log.warn('{0} [ocr_1 failed] [times={1}] [img_path={2}] [error={3}]'.format(
self.log_base, times, img_path, e))
self.log_base, times, img_path, traceback.format_exc()))
else:
ocr_1_res = ocr_1_response.json()
end_time = time.time()
......@@ -525,7 +526,7 @@ class Command(BaseCommand, LoggerMixin):
except Exception as e:
self.cronjob_log.warn(
'{0} [ocr_2 failed] [times={1}] [img_path={2}] [error={3}]'.format(
self.log_base, times, img_path, e))
self.log_base, times, img_path, traceback.format_exc()))
else:
ocr_2_res = json.loads(ocr_2_response.text)
end_time = time.time()
......@@ -591,8 +592,8 @@ class Command(BaseCommand, LoggerMixin):
doc, _ = self.get_doc_object(task_str)
doc.status = DocStatus.PROCESS_FAILED.value
doc.save()
self.cronjob_log.error('{0} [process failed (res to wb)] [task={1}] [err={2}]'.format(
self.log_base, task_str, e))
self.cronjob_log.error('{0} [process failed (res to wb)] [task={1}] [error={2}]'.format(
self.log_base, task_str, traceback.format_exc()))
else:
try:
# 5.上传至EDMS
......@@ -602,7 +603,7 @@ class Command(BaseCommand, LoggerMixin):
except Exception as e:
self.cronjob_log.warn(
'{0} [edms upload failed] [times={1}] [task={2}] [error={3}]'.format(
self.log_base, times, task_str, e))
self.log_base, times, task_str, traceback.format_exc()))
edms_exc = str(e)
else:
break
......@@ -616,8 +617,8 @@ class Command(BaseCommand, LoggerMixin):
if hasattr(doc, field):
setattr(doc, field, count)
doc.save()
self.cronjob_log.error('{0} [process failed (edms upload)] [task={1}] [err={2}]'.format(
self.log_base, task_str, e))
self.cronjob_log.error('{0} [process failed (edms upload)] [task={1}] [error={2}]'.format(
self.log_base, task_str, traceback.format_exc()))
write_zip_file(img_save_path, os.path.join(doc_data_path, '{0}_img.zip'.format(doc.id)))
else:
......
......@@ -161,13 +161,13 @@ class BSWorkbook(Workbook):
if max_find_count == 0:
return round(random.uniform(75, 80), 2)
elif max_find_count == 1:
return round(random.uniform(80, 85))
return round(random.uniform(80, 85), 2)
elif max_find_count == 2:
return round(random.uniform(85, 90))
return round(random.uniform(85, 90), 2)
elif max_find_count == 3:
return round(random.uniform(90, 95))
return round(random.uniform(90, 95), 2)
else:
return round(random.uniform(95, 100))
return round(random.uniform(95, 100), 2)
@staticmethod
def month_split(dti, date_list, date_statistics):
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!