96178db6 by 周伟奇

add max img count

1 parent 23c4a341
......@@ -613,6 +613,26 @@ class Command(BaseCommand, LoggerMixin):
self.online_log.warn('{0} [pdf to img failed (pdf img empty)] [task={1}]'.format(
self.log_base, task_str))
raise Exception('pdf img empty')
elif img_count >= max_img_count:
self.online_log.info('{0} [too many pdf image] [task={1}] [img_count={2}]'.format(
self.log_base, task_str, img_count))
try:
report_table = HILOCRReport if business_type == consts.HIL_PREFIX else AFCOCRReport
report_table.objects.create(
case_number=doc.application_id,
request_team=RequestTeam.get_value(doc.document_scheme, 0),
request_trigger=RequestTrigger.get_value(doc.data_source, 0),
input_file=doc.document_name,
transaction_start=doc.start_time,
transaction_end=time.time(),
successful_at_this_level=False,
failure_reason=FailureReason.IMG_LIMIT.value,
process_name=ProcessName.ALL.value,
)
except Exception as e:
self.online_log.error('{0} [process error (report db save)] [error={1}]'.format(
self.log_base, traceback.format_exc()))
else:
with lock:
todo_count_dict[task_str] = img_count
......
......@@ -41,6 +41,7 @@ class FailureReason(NamedEnum):
PDF = (0, 'PDF处理失败')
EXCEL = (1, '构建excel失败')
EDMS = (2, 'EDMS上传失败')
IMG_LIMIT = (3, 'PDF图片过多')
class ProcessName(NamedEnum):
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!