nucliadb 6.7.1.post4824__py3-none-any.whl → 6.7.1.post4830__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 +6 -0
- nucliadb/ingest/settings.py +4 -0
- nucliadb/reader/api/v1/resource.py +1 -1
- nucliadb/reader/api/v1/services.py +2 -2
- {nucliadb-6.7.1.post4824.dist-info → nucliadb-6.7.1.post4830.dist-info}/METADATA +6 -6
- {nucliadb-6.7.1.post4824.dist-info → nucliadb-6.7.1.post4830.dist-info}/RECORD +9 -9
- {nucliadb-6.7.1.post4824.dist-info → nucliadb-6.7.1.post4830.dist-info}/WHEEL +0 -0
- {nucliadb-6.7.1.post4824.dist-info → nucliadb-6.7.1.post4830.dist-info}/entry_points.txt +0 -0
- {nucliadb-6.7.1.post4824.dist-info → nucliadb-6.7.1.post4830.dist-info}/top_level.txt +0 -0
nucliadb/common/maindb/pg.py
CHANGED
|
@@ -30,6 +30,7 @@ import psycopg_pool
|
|
|
30
30
|
|
|
31
31
|
from nucliadb.common.maindb.driver import DEFAULT_SCAN_LIMIT, Driver, Transaction
|
|
32
32
|
from nucliadb.common.maindb.exceptions import ConflictError
|
|
33
|
+
from nucliadb.ingest.settings import settings
|
|
33
34
|
from nucliadb_telemetry import metrics
|
|
34
35
|
|
|
35
36
|
RETRIABLE_EXCEPTIONS = (
|
|
@@ -69,11 +70,14 @@ POOL_METRICS_GAUGES = {
|
|
|
69
70
|
class DataLayer:
|
|
70
71
|
def __init__(self, connection: psycopg.AsyncConnection):
|
|
71
72
|
self.connection = connection
|
|
73
|
+
self.log_on_select_for_update = settings.driver_pg_log_on_select_for_update
|
|
72
74
|
|
|
73
75
|
async def get(self, key: str, select_for_update: bool = False) -> Optional[bytes]:
|
|
74
76
|
with pg_observer({"type": "get"}):
|
|
75
77
|
statement = "SELECT value FROM resources WHERE key = %s"
|
|
76
78
|
if select_for_update:
|
|
79
|
+
if self.log_on_select_for_update:
|
|
80
|
+
logger.warning(f"SELECT FOR UPDATE on key={key}")
|
|
77
81
|
statement += " FOR UPDATE"
|
|
78
82
|
async with self.connection.cursor() as cur:
|
|
79
83
|
await cur.execute(statement, (key,))
|
|
@@ -117,6 +121,8 @@ class DataLayer:
|
|
|
117
121
|
async with self.connection.cursor() as cur:
|
|
118
122
|
statement = "SELECT key, value FROM resources WHERE key = ANY(%s)"
|
|
119
123
|
if select_for_update:
|
|
124
|
+
if self.log_on_select_for_update:
|
|
125
|
+
logger.warning(f"SELECT FOR UPDATE on keys={keys}")
|
|
120
126
|
statement += " FOR UPDATE"
|
|
121
127
|
await cur.execute(statement, (keys,))
|
|
122
128
|
records = {record[0]: record[1] for record in await cur.fetchall()}
|
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
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nucliadb
|
|
3
|
-
Version: 6.7.1.
|
|
3
|
+
Version: 6.7.1.post4830
|
|
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.post4830
|
|
23
|
+
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.7.1.post4830
|
|
24
|
+
Requires-Dist: nucliadb-protos>=6.7.1.post4830
|
|
25
|
+
Requires-Dist: nucliadb-models>=6.7.1.post4830
|
|
26
|
+
Requires-Dist: nidx-protos>=6.7.1.post4830
|
|
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
|
|
@@ -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.post4830.dist-info/METADATA,sha256=fhhCkNwUYSbJMsYCujmYd-6euRbfYMBx_t8FcNuldhE,4158
|
|
380
|
+
nucliadb-6.7.1.post4830.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
381
|
+
nucliadb-6.7.1.post4830.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
|
|
382
|
+
nucliadb-6.7.1.post4830.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
|
|
383
|
+
nucliadb-6.7.1.post4830.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|