Kevin Hu commited on
Commit
f895b25
·
1 Parent(s): 8a4bb0c

ignore when save image fail (#2178)

Browse files

### What problem does this PR solve?


### Type of change
- [x] Performance Improvement

Files changed (1) hide show
  1. rag/svr/task_executor.py +13 -8
rag/svr/task_executor.py CHANGED
@@ -206,15 +206,20 @@ def build(row):
206
  docs.append(d)
207
  continue
208
 
209
- output_buffer = BytesIO()
210
- if isinstance(d["image"], bytes):
211
- output_buffer = BytesIO(d["image"])
212
- else:
213
- d["image"].save(output_buffer, format='JPEG')
 
 
 
 
 
 
 
 
214
 
215
- st = timer()
216
- MINIO.put(row["kb_id"], d["_id"], output_buffer.getvalue())
217
- el += timer() - st
218
  d["img_id"] = "{}-{}".format(row["kb_id"], d["_id"])
219
  del d["image"]
220
  docs.append(d)
 
206
  docs.append(d)
207
  continue
208
 
209
+ try:
210
+ output_buffer = BytesIO()
211
+ if isinstance(d["image"], bytes):
212
+ output_buffer = BytesIO(d["image"])
213
+ else:
214
+ d["image"].save(output_buffer, format='JPEG')
215
+
216
+ st = timer()
217
+ MINIO.put(row["kb_id"], d["_id"], output_buffer.getvalue())
218
+ el += timer() - st
219
+ except Exception as e:
220
+ cron_logger.error(str(e))
221
+ traceback.print_exc()
222
 
 
 
 
223
  d["img_id"] = "{}-{}".format(row["kb_id"], d["_id"])
224
  del d["image"]
225
  docs.append(d)