nucliadb 6.7.1.post4826__py3-none-any.whl → 6.7.1.post4832__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.
Potentially problematic release.
This version of nucliadb might be problematic. Click here for more details.
- nucliadb/common/maindb/pg.py +4 -4
- nucliadb/ingest/settings.py +4 -0
- nucliadb/reader/api/v1/resource.py +1 -1
- nucliadb/reader/api/v1/services.py +2 -2
- nucliadb/train/nodes.py +4 -4
- nucliadb/train/servicer.py +1 -1
- nucliadb/writer/api/v1/field.py +1 -1
- nucliadb/writer/api/v1/resource.py +1 -1
- {nucliadb-6.7.1.post4826.dist-info → nucliadb-6.7.1.post4832.dist-info}/METADATA +6 -6
- {nucliadb-6.7.1.post4826.dist-info → nucliadb-6.7.1.post4832.dist-info}/RECORD +13 -13
- {nucliadb-6.7.1.post4826.dist-info → nucliadb-6.7.1.post4832.dist-info}/WHEEL +0 -0
- {nucliadb-6.7.1.post4826.dist-info → nucliadb-6.7.1.post4832.dist-info}/entry_points.txt +0 -0
- {nucliadb-6.7.1.post4826.dist-info → nucliadb-6.7.1.post4832.dist-info}/top_level.txt +0 -0
nucliadb/common/maindb/pg.py
CHANGED
|
@@ -21,7 +21,6 @@ from __future__ import annotations
|
|
|
21
21
|
|
|
22
22
|
import asyncio
|
|
23
23
|
import logging
|
|
24
|
-
import os
|
|
25
24
|
from contextlib import asynccontextmanager
|
|
26
25
|
from typing import Any, AsyncGenerator, Optional
|
|
27
26
|
|
|
@@ -31,6 +30,7 @@ import psycopg_pool
|
|
|
31
30
|
|
|
32
31
|
from nucliadb.common.maindb.driver import DEFAULT_SCAN_LIMIT, Driver, Transaction
|
|
33
32
|
from nucliadb.common.maindb.exceptions import ConflictError
|
|
33
|
+
from nucliadb.ingest.settings import settings
|
|
34
34
|
from nucliadb_telemetry import metrics
|
|
35
35
|
|
|
36
36
|
RETRIABLE_EXCEPTIONS = (
|
|
@@ -70,13 +70,13 @@ POOL_METRICS_GAUGES = {
|
|
|
70
70
|
class DataLayer:
|
|
71
71
|
def __init__(self, connection: psycopg.AsyncConnection):
|
|
72
72
|
self.connection = connection
|
|
73
|
-
self.
|
|
73
|
+
self.log_on_select_for_update = settings.driver_pg_log_on_select_for_update
|
|
74
74
|
|
|
75
75
|
async def get(self, key: str, select_for_update: bool = False) -> Optional[bytes]:
|
|
76
76
|
with pg_observer({"type": "get"}):
|
|
77
77
|
statement = "SELECT value FROM resources WHERE key = %s"
|
|
78
78
|
if select_for_update:
|
|
79
|
-
if self.
|
|
79
|
+
if self.log_on_select_for_update:
|
|
80
80
|
logger.warning(f"SELECT FOR UPDATE on key={key}")
|
|
81
81
|
statement += " FOR UPDATE"
|
|
82
82
|
async with self.connection.cursor() as cur:
|
|
@@ -121,7 +121,7 @@ class DataLayer:
|
|
|
121
121
|
async with self.connection.cursor() as cur:
|
|
122
122
|
statement = "SELECT key, value FROM resources WHERE key = ANY(%s)"
|
|
123
123
|
if select_for_update:
|
|
124
|
-
if self.
|
|
124
|
+
if self.log_on_select_for_update:
|
|
125
125
|
logger.warning(f"SELECT FOR UPDATE on keys={keys}")
|
|
126
126
|
statement += " FOR UPDATE"
|
|
127
127
|
await cur.execute(statement, (keys,))
|
nucliadb/ingest/settings.py
CHANGED
|
@@ -61,6 +61,10 @@ class DriverSettings(BaseSettings):
|
|
|
61
61
|
default=1000,
|
|
62
62
|
description="PostgreSQL pool acquire timeout in ms. The maximum time to wait until a connection becomes available.",
|
|
63
63
|
)
|
|
64
|
+
driver_pg_log_on_select_for_update: bool = Field(
|
|
65
|
+
default=False,
|
|
66
|
+
description="If true, log a warning when a SELECT FOR UPDATE is executed. This is useful to detect potential deadlocks.",
|
|
67
|
+
)
|
|
64
68
|
|
|
65
69
|
|
|
66
70
|
# For use during migration from pull v1 to pull v2
|
|
@@ -335,7 +335,7 @@ async def _get_resource_field(
|
|
|
335
335
|
storage = await get_storage(service_name=SERVICE_NAME)
|
|
336
336
|
driver = get_driver()
|
|
337
337
|
pb_field_id = to_proto.field_type_name(field_type)
|
|
338
|
-
async with driver.transaction() as txn:
|
|
338
|
+
async with driver.transaction(read_only=True) as txn:
|
|
339
339
|
kb = ORMKnowledgeBox(txn, storage, kbid)
|
|
340
340
|
|
|
341
341
|
if rid is None:
|
|
@@ -328,7 +328,7 @@ async def processing_status(
|
|
|
328
328
|
@requires(NucliaDBRoles.READER)
|
|
329
329
|
@version(1)
|
|
330
330
|
async def get_search_configuration(request: Request, kbid: str, config_name: str) -> SearchConfiguration:
|
|
331
|
-
async with datamanagers.
|
|
331
|
+
async with datamanagers.with_ro_transaction() as txn:
|
|
332
332
|
if not await datamanagers.kb.exists_kb(txn, kbid=kbid):
|
|
333
333
|
raise HTTPException(status_code=404, detail="Knowledge Box does not exist")
|
|
334
334
|
|
|
@@ -349,7 +349,7 @@ async def get_search_configuration(request: Request, kbid: str, config_name: str
|
|
|
349
349
|
@requires(NucliaDBRoles.READER)
|
|
350
350
|
@version(1)
|
|
351
351
|
async def list_search_configurations(request: Request, kbid: str) -> dict[str, SearchConfiguration]:
|
|
352
|
-
async with datamanagers.
|
|
352
|
+
async with datamanagers.with_ro_transaction() as txn:
|
|
353
353
|
if not await datamanagers.kb.exists_kb(txn, kbid=kbid):
|
|
354
354
|
raise HTTPException(status_code=404, detail="Knowledge Box does not exist")
|
|
355
355
|
|
nucliadb/train/nodes.py
CHANGED
|
@@ -81,7 +81,7 @@ class TrainShardManager(manager.KBShardManager):
|
|
|
81
81
|
return manager
|
|
82
82
|
|
|
83
83
|
async def kb_sentences(self, request: GetSentencesRequest) -> AsyncIterator[TrainSentence]:
|
|
84
|
-
async with self.driver.transaction() as txn:
|
|
84
|
+
async with self.driver.transaction(read_only=True) as txn:
|
|
85
85
|
kb = KnowledgeBox(txn, self.storage, request.kb.uuid)
|
|
86
86
|
if request.uuid != "":
|
|
87
87
|
# Filter by uuid
|
|
@@ -95,7 +95,7 @@ class TrainShardManager(manager.KBShardManager):
|
|
|
95
95
|
yield sentence
|
|
96
96
|
|
|
97
97
|
async def kb_paragraphs(self, request: GetParagraphsRequest) -> AsyncIterator[TrainParagraph]:
|
|
98
|
-
async with self.driver.transaction() as txn:
|
|
98
|
+
async with self.driver.transaction(read_only=True) as txn:
|
|
99
99
|
kb = KnowledgeBox(txn, self.storage, request.kb.uuid)
|
|
100
100
|
if request.uuid != "":
|
|
101
101
|
# Filter by uuid
|
|
@@ -109,7 +109,7 @@ class TrainShardManager(manager.KBShardManager):
|
|
|
109
109
|
yield paragraph
|
|
110
110
|
|
|
111
111
|
async def kb_fields(self, request: GetFieldsRequest) -> AsyncIterator[TrainField]:
|
|
112
|
-
async with self.driver.transaction() as txn:
|
|
112
|
+
async with self.driver.transaction(read_only=True) as txn:
|
|
113
113
|
kb = KnowledgeBox(txn, self.storage, request.kb.uuid)
|
|
114
114
|
if request.uuid != "":
|
|
115
115
|
# Filter by uuid
|
|
@@ -123,7 +123,7 @@ class TrainShardManager(manager.KBShardManager):
|
|
|
123
123
|
yield field
|
|
124
124
|
|
|
125
125
|
async def kb_resources(self, request: GetResourcesRequest) -> AsyncIterator[TrainResource]:
|
|
126
|
-
async with self.driver.transaction() as txn:
|
|
126
|
+
async with self.driver.transaction(read_only=True) as txn:
|
|
127
127
|
kb = KnowledgeBox(txn, self.storage, request.kb.uuid)
|
|
128
128
|
base = KB_RESOURCE_SLUG_BASE.format(kbid=request.kb.uuid)
|
|
129
129
|
async for key in txn.keys(match=base):
|
nucliadb/train/servicer.py
CHANGED
|
@@ -89,7 +89,7 @@ class TrainServicer(train_pb2_grpc.TrainServicer):
|
|
|
89
89
|
) -> GetEntitiesResponse:
|
|
90
90
|
kbid = request.kb.uuid
|
|
91
91
|
response = GetEntitiesResponse()
|
|
92
|
-
async with self.proc.driver.transaction() as txn:
|
|
92
|
+
async with self.proc.driver.transaction(read_only=True) as txn:
|
|
93
93
|
entities_manager = await self.proc.get_kb_entities_manager(txn, kbid)
|
|
94
94
|
if entities_manager is None:
|
|
95
95
|
await txn.abort()
|
nucliadb/writer/api/v1/field.py
CHANGED
|
@@ -572,7 +572,7 @@ async def reprocess_file_field(
|
|
|
572
572
|
storage = await get_storage(service_name=SERVICE_NAME)
|
|
573
573
|
driver = get_driver()
|
|
574
574
|
|
|
575
|
-
async with driver.transaction() as txn:
|
|
575
|
+
async with driver.transaction(read_only=True) as txn:
|
|
576
576
|
kb = KnowledgeBox(txn, storage, kbid)
|
|
577
577
|
|
|
578
578
|
resource = await kb.get(rid)
|
|
@@ -460,7 +460,7 @@ async def _reprocess_resource(
|
|
|
460
460
|
driver = get_driver()
|
|
461
461
|
|
|
462
462
|
writer = BrokerMessage()
|
|
463
|
-
async with driver.transaction() as txn:
|
|
463
|
+
async with driver.transaction(read_only=True) as txn:
|
|
464
464
|
kb = KnowledgeBox(txn, storage, kbid)
|
|
465
465
|
|
|
466
466
|
resource = await kb.get(rid)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nucliadb
|
|
3
|
-
Version: 6.7.1.
|
|
3
|
+
Version: 6.7.1.post4832
|
|
4
4
|
Summary: NucliaDB
|
|
5
5
|
Author-email: Nuclia <nucliadb@nuclia.com>
|
|
6
6
|
License-Expression: AGPL-3.0-or-later
|
|
@@ -19,11 +19,11 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
20
|
Requires-Python: <4,>=3.9
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
|
-
Requires-Dist: nucliadb-telemetry[all]>=6.7.1.
|
|
23
|
-
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.7.1.
|
|
24
|
-
Requires-Dist: nucliadb-protos>=6.7.1.
|
|
25
|
-
Requires-Dist: nucliadb-models>=6.7.1.
|
|
26
|
-
Requires-Dist: nidx-protos>=6.7.1.
|
|
22
|
+
Requires-Dist: nucliadb-telemetry[all]>=6.7.1.post4832
|
|
23
|
+
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.7.1.post4832
|
|
24
|
+
Requires-Dist: nucliadb-protos>=6.7.1.post4832
|
|
25
|
+
Requires-Dist: nucliadb-models>=6.7.1.post4832
|
|
26
|
+
Requires-Dist: nidx-protos>=6.7.1.post4832
|
|
27
27
|
Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
|
|
28
28
|
Requires-Dist: nuclia-models>=0.46.0
|
|
29
29
|
Requires-Dist: uvicorn[standard]
|
|
@@ -117,7 +117,7 @@ nucliadb/common/maindb/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXM
|
|
|
117
117
|
nucliadb/common/maindb/driver.py,sha256=FMRBZgb1lRxOTnr9PHsWs1hLGTswKzkfk6CLzNmFmt8,2633
|
|
118
118
|
nucliadb/common/maindb/exceptions.py,sha256=u6ZSQW6jk5QM_IL5XmQ_dF-vZ-JkuWEqZbNJ-S6FG_g,988
|
|
119
119
|
nucliadb/common/maindb/local.py,sha256=uE9DIQX1yCNHNN8Tx4fPgSiuTtWpQhlfWkMJ8QZPae0,7270
|
|
120
|
-
nucliadb/common/maindb/pg.py,sha256=
|
|
120
|
+
nucliadb/common/maindb/pg.py,sha256=seTWer0fEUz1atRmzWViMidA-rLs7fndmW05XdB07NQ,14025
|
|
121
121
|
nucliadb/common/maindb/utils.py,sha256=zWLs82rWEVhpc1dYvdqTZiAcjZroB6Oo5MQaxMeFuKk,3301
|
|
122
122
|
nucliadb/common/models_utils/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
|
|
123
123
|
nucliadb/common/models_utils/from_proto.py,sha256=1Ut6_f5ofao1numCkr5xgeVWhuVitx1ebggzU8hu0jU,15764
|
|
@@ -136,7 +136,7 @@ nucliadb/ingest/partitions.py,sha256=2NIhMYbNT0TNBL6bX1UMSi7vxFGICstCKEqsB0TXHOE
|
|
|
136
136
|
nucliadb/ingest/processing.py,sha256=IKXMZXIPuuojKQiXR2T5-5NwMvmUnIQIhBXUGgzyFFo,21551
|
|
137
137
|
nucliadb/ingest/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
138
138
|
nucliadb/ingest/serialize.py,sha256=6byE0TIenJK4zOBx-MQI7H_9NaRDTEqKYIossycRbns,16262
|
|
139
|
-
nucliadb/ingest/settings.py,sha256=
|
|
139
|
+
nucliadb/ingest/settings.py,sha256=LskYx8Eefv5qdHkpcsMKHgkaVJuMhC9XnDHRS6s6BAc,3392
|
|
140
140
|
nucliadb/ingest/utils.py,sha256=l1myURu3r8oA11dx3GpHw-gNTUc1AFX8xdPm9Lgl2rA,2275
|
|
141
141
|
nucliadb/ingest/consumer/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
|
|
142
142
|
nucliadb/ingest/consumer/auditing.py,sha256=xK21DIa_ZAiOJVVbnkmT4jgCRGshNGyPyxsqhE6kROE,7204
|
|
@@ -203,9 +203,9 @@ nucliadb/reader/api/v1/download.py,sha256=A4ntoyPbLQskORrVSGnnsMAmCZiQ-Mufi5j2u4
|
|
|
203
203
|
nucliadb/reader/api/v1/export_import.py,sha256=x4VBNDFjnlY1nIt5kdq0eZTB_DeRzGzT8T7uB7wUhNU,6448
|
|
204
204
|
nucliadb/reader/api/v1/knowledgebox.py,sha256=Uu-yPB8KKZt1VaFrFNMMaXOvLsclBJDK9dzZ9lF2ctI,3645
|
|
205
205
|
nucliadb/reader/api/v1/learning_config.py,sha256=t_KqQBBbhpo0m6nQTkYmNdZsLVmW53SLcHMrCWiQMrk,6536
|
|
206
|
-
nucliadb/reader/api/v1/resource.py,sha256=
|
|
206
|
+
nucliadb/reader/api/v1/resource.py,sha256=M6POD3qyPyl4j8eFPNQYc-SSsNwO_FD6vNjtLE0N_8c,14186
|
|
207
207
|
nucliadb/reader/api/v1/router.py,sha256=eyNmEGSP9zHkCIG5XlAXl6sukq950B7gFT3X2peMtIE,1011
|
|
208
|
-
nucliadb/reader/api/v1/services.py,sha256=
|
|
208
|
+
nucliadb/reader/api/v1/services.py,sha256=2IpG-JnASOPrItfcqSkKYkuf6tHy8vS2O9o2_hfXX8w,13449
|
|
209
209
|
nucliadb/reader/api/v1/vectorsets.py,sha256=insTwaykshz442cMKa2VP74wJwvZrIYi0U7M9EM3aCM,1822
|
|
210
210
|
nucliadb/reader/reader/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
|
|
211
211
|
nucliadb/reader/reader/notifications.py,sha256=6yUsPvvSRqayJ2peOtE0JY0v4657P_S5SAm32th0Y88,7809
|
|
@@ -312,11 +312,11 @@ nucliadb/train/app.py,sha256=z6xlGVVVaJmZZmLPIVTgkjD-wIz5b0NYlXAQp7hBHYw,2652
|
|
|
312
312
|
nucliadb/train/generator.py,sha256=H8JLkQ23QQVo4CAdg1ZZh_cncPz7COEfaDu1l-h-0hM,4616
|
|
313
313
|
nucliadb/train/lifecycle.py,sha256=3HadM4GRsYb2m-v4jtdr9C-KBEBx8GlrJDArPYi3SWQ,1960
|
|
314
314
|
nucliadb/train/models.py,sha256=BmgmMjDsu_1Ih5JDAqo6whhume90q0ASJcDP9dkMQm8,1198
|
|
315
|
-
nucliadb/train/nodes.py,sha256=
|
|
315
|
+
nucliadb/train/nodes.py,sha256=jwIMRCYcaMWtjUF_l2cdXG16O9I1zhB4V_6g0bhLCP0,5666
|
|
316
316
|
nucliadb/train/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
317
317
|
nucliadb/train/resource.py,sha256=3qQ_9Zdt5JAbtD-wpmt7OeDGRNKS-fQdKAuIQfznZm0,16219
|
|
318
318
|
nucliadb/train/run.py,sha256=evz6CKVfJOzkbHMoaYz2mTMlKjJnNOb1O8zBBWMpeBw,1400
|
|
319
|
-
nucliadb/train/servicer.py,sha256=
|
|
319
|
+
nucliadb/train/servicer.py,sha256=GLsfIV2T_EK7qKDdanwvCre87HJvl6MdxxQWkE8_DPM,5742
|
|
320
320
|
nucliadb/train/settings.py,sha256=Vz-bQxwxYg6Qhc8Vnap95AwlYyCE1LF7NCPlLBfToXI,1462
|
|
321
321
|
nucliadb/train/types.py,sha256=xyVYy8kHipAWoDb7Pn7dCYQ_efHPzDW_3AXg5M-aV28,1519
|
|
322
322
|
nucliadb/train/upload.py,sha256=fTjH1KEL-0ogf3LV0T6ODO0QdPGwdZShSUtFUCAcUlA,3256
|
|
@@ -352,10 +352,10 @@ nucliadb/writer/api/constants.py,sha256=SCdqGDbEmpdczQdTfbTlpHzVjbLqccPtMQ25MPIF
|
|
|
352
352
|
nucliadb/writer/api/utils.py,sha256=wIQHlU8RQiIGVLI72suvyVIKlCU44Unh0Ae0IiN6Qwo,1313
|
|
353
353
|
nucliadb/writer/api/v1/__init__.py,sha256=akI9A_jloNLb0dU4T5zjfdyvmSAiDeIdjAlzNx74FlU,1128
|
|
354
354
|
nucliadb/writer/api/v1/export_import.py,sha256=v0sU55TtRSqDzwkDgcwv2uSaqKCuQTtGcMpYoHQYBQA,8192
|
|
355
|
-
nucliadb/writer/api/v1/field.py,sha256=
|
|
355
|
+
nucliadb/writer/api/v1/field.py,sha256=cQClcEJ4-ki47lvtNbzgjBphqkGR1XWs7msyFQbz_X0,18977
|
|
356
356
|
nucliadb/writer/api/v1/knowledgebox.py,sha256=PHEYDFa-sN5JrI8-EiVVg5FDOsRuCLT43kyAB4xt-xA,9530
|
|
357
357
|
nucliadb/writer/api/v1/learning_config.py,sha256=mGQmnfFSM2Z9HDnWr8PFoA1MLpFR1JaCDb8B14J8e5k,4140
|
|
358
|
-
nucliadb/writer/api/v1/resource.py,sha256=
|
|
358
|
+
nucliadb/writer/api/v1/resource.py,sha256=Zh7hzoTekgR18FoZirQqpjjCKRI6-lL9w5oZyQr96Ng,20450
|
|
359
359
|
nucliadb/writer/api/v1/router.py,sha256=RjuoWLpZer6Kl2BW_wznpNo6XL3BOpdTGqXZCn3QrrQ,1034
|
|
360
360
|
nucliadb/writer/api/v1/services.py,sha256=3AUjk-SmvqJx76v7y89DZx6oyasojPliGYeniRQjpcU,13337
|
|
361
361
|
nucliadb/writer/api/v1/slug.py,sha256=xlVBDBpRi9bNulpBHZwhyftVvulfE0zFm1XZIWl-AKY,2389
|
|
@@ -376,8 +376,8 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
|
|
|
376
376
|
nucliadb/writer/tus/s3.py,sha256=vu1BGg4VqJ_x2P1u2BxqPKlSfw5orT_a3R-Ln5oPUpU,8483
|
|
377
377
|
nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
|
|
378
378
|
nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
|
|
379
|
-
nucliadb-6.7.1.
|
|
380
|
-
nucliadb-6.7.1.
|
|
381
|
-
nucliadb-6.7.1.
|
|
382
|
-
nucliadb-6.7.1.
|
|
383
|
-
nucliadb-6.7.1.
|
|
379
|
+
nucliadb-6.7.1.post4832.dist-info/METADATA,sha256=sWUMTELJQ2XldEjYtIMvMShev46-QXLaZ2j8LCOzXOg,4158
|
|
380
|
+
nucliadb-6.7.1.post4832.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
381
|
+
nucliadb-6.7.1.post4832.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
|
|
382
|
+
nucliadb-6.7.1.post4832.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
|
|
383
|
+
nucliadb-6.7.1.post4832.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|