nucliadb 6.3.5.post4028__py3-none-any.whl → 6.3.5.post4032__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,6 +21,8 @@ import contextlib
21
21
  import logging
22
22
  from typing import Optional
23
23
 
24
+ import backoff
25
+
24
26
  from nucliadb.common.cache import (
25
27
  delete_extracted_text_cache,
26
28
  delete_resource_cache,
@@ -94,13 +96,30 @@ async def get_field_extracted_text(field: Field) -> Optional[ExtractedText]:
94
96
  return extracted_text
95
97
 
96
98
  cache.metrics.ops.inc({"type": "miss"})
97
- extracted_text = await field.get_extracted_text()
99
+ extracted_text = await field_get_extracted_text(field)
98
100
  if extracted_text is not None:
99
101
  # Only cache if we actually have extracted text
100
102
  cache.set(key, extracted_text)
101
103
  return extracted_text
102
104
 
103
105
 
106
+ @backoff.on_exception(backoff.expo, (Exception,), jitter=backoff.random_jitter, max_tries=3)
107
+ async def field_get_extracted_text(field: Field) -> Optional[ExtractedText]:
108
+ try:
109
+ return await field.get_extracted_text()
110
+ except Exception:
111
+ logger.warning(
112
+ "Error getting extracted text for field. Retrying",
113
+ exc_info=True,
114
+ extra={
115
+ "kbid": field.kbid,
116
+ "resource_id": field.resource.uuid,
117
+ "field": f"{field.type}/{field.id}",
118
+ },
119
+ )
120
+ raise
121
+
122
+
104
123
  async def get_extracted_text_from_field_id(kbid: str, field: FieldId) -> Optional[ExtractedText]:
105
124
  rid = field.rid
106
125
  orm_resource = await get_resource(kbid, rid)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb
3
- Version: 6.3.5.post4028
3
+ Version: 6.3.5.post4032
4
4
  Summary: NucliaDB
5
5
  Author-email: Nuclia <nucliadb@nuclia.com>
6
6
  License: AGPL
@@ -20,11 +20,11 @@ Classifier: Programming Language :: Python :: 3.12
20
20
  Classifier: Programming Language :: Python :: 3 :: Only
21
21
  Requires-Python: <4,>=3.9
22
22
  Description-Content-Type: text/markdown
23
- Requires-Dist: nucliadb-telemetry[all]>=6.3.5.post4028
24
- Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.3.5.post4028
25
- Requires-Dist: nucliadb-protos>=6.3.5.post4028
26
- Requires-Dist: nucliadb-models>=6.3.5.post4028
27
- Requires-Dist: nidx-protos>=6.3.5.post4028
23
+ Requires-Dist: nucliadb-telemetry[all]>=6.3.5.post4032
24
+ Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.3.5.post4032
25
+ Requires-Dist: nucliadb-protos>=6.3.5.post4032
26
+ Requires-Dist: nucliadb-models>=6.3.5.post4032
27
+ Requires-Dist: nidx-protos>=6.3.5.post4032
28
28
  Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
29
29
  Requires-Dist: nuclia-models>=0.24.2
30
30
  Requires-Dist: uvicorn[standard]
@@ -228,7 +228,7 @@ nucliadb/search/api/v1/resource/utils.py,sha256=-NjZqAQtFEXKpIh8ui5S26ItnJ5rzmmG
228
228
  nucliadb/search/requesters/__init__.py,sha256=itSI7dtTwFP55YMX4iK7JzdMHS5CQVUiB1XzQu4UBh8,833
229
229
  nucliadb/search/requesters/utils.py,sha256=cQZ4-NftiMljoWQ7-Zl7nWfr6u_FY8u_wc9kTvKQcAg,6999
230
230
  nucliadb/search/search/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
231
- nucliadb/search/search/cache.py,sha256=s5wfWq40I4HOLtsKxe3Q5vanL9-3J5T8e0G3yvQ7OKg,4817
231
+ nucliadb/search/search/cache.py,sha256=F7rT0X-bp02Qh-heNo1tRhXG3iqTkL41F1wA_HIZdoM,5404
232
232
  nucliadb/search/search/cut.py,sha256=ytY0_GY7ocNjfxTb4aosxEp4ZfhQNDP--JkhEMGD298,1153
233
233
  nucliadb/search/search/exceptions.py,sha256=klGLgAGGrXcSGix_W6418ZBMqDchAIGjN77ofkOScEI,1039
234
234
  nucliadb/search/search/fetch.py,sha256=XJHIFnZmXM_8Kb37lb4lg1GYG7cZ1plT-qAIb_QziX4,6184
@@ -361,8 +361,8 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
361
361
  nucliadb/writer/tus/s3.py,sha256=vF0NkFTXiXhXq3bCVXXVV-ED38ECVoUeeYViP8uMqcU,8357
362
362
  nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
363
363
  nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
364
- nucliadb-6.3.5.post4028.dist-info/METADATA,sha256=NyLX9AFnvAlxlLdbQgkb4cFrs8TUUicC_KhBcLaWLCs,4301
365
- nucliadb-6.3.5.post4028.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
366
- nucliadb-6.3.5.post4028.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
367
- nucliadb-6.3.5.post4028.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
368
- nucliadb-6.3.5.post4028.dist-info/RECORD,,
364
+ nucliadb-6.3.5.post4032.dist-info/METADATA,sha256=hbwiwOO_3khU7Rm8IyIFwpmCR3KwiILVV-agkTKmNgA,4301
365
+ nucliadb-6.3.5.post4032.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
366
+ nucliadb-6.3.5.post4032.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
367
+ nucliadb-6.3.5.post4032.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
368
+ nucliadb-6.3.5.post4032.dist-info/RECORD,,