nucliadb 6.2.1.post2992__py3-none-any.whl → 6.2.1.post3003__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.
@@ -27,7 +27,6 @@ from grpc.aio import AioRpcError
27
27
 
28
28
  from nucliadb.common import datamanagers
29
29
  from nucliadb.common.cluster.exceptions import ShardNotFound
30
- from nucliadb.common.cluster.manager import get_index_node
31
30
  from nucliadb.common.cluster.utils import get_shard_manager
32
31
 
33
32
  # XXX: this keys shouldn't be exposed outside datamanagers
@@ -372,6 +371,8 @@ class KnowledgeBox:
372
371
  if exists is False:
373
372
  logger.error(f"{kbid} KB does not exists on Storage")
374
373
 
374
+ nidx_api = get_nidx_api_client()
375
+
375
376
  async with driver.transaction() as txn:
376
377
  storage_to_delete = KB_TO_DELETE_STORAGE.format(kbid=kbid)
377
378
  await txn.set(storage_to_delete, b"")
@@ -384,25 +385,17 @@ class KnowledgeBox:
384
385
  logger.warning(f"Shards not found for KB while purging it", extra={"kbid": kbid})
385
386
  else:
386
387
  for shard in shards_obj.shards:
387
- # Delete the shard on nodes
388
- for replica in shard.replicas:
389
- node = get_index_node(replica.node)
390
- if node is None:
391
- logger.error(
392
- f"No node {replica.node} found, let's continue. Some shards may stay orphaned",
393
- extra={"kbid": kbid},
394
- )
395
- continue
388
+ if shard.nidx_shard_id:
396
389
  try:
397
- await node.delete_shard(replica.shard.id)
390
+ await nidx_api.DeleteShard(noderesources_pb2.ShardId(id=shard.nidx_shard_id))
398
391
  logger.debug(
399
- f"Succeded deleting shard from nodeid={replica.node} at {node.address}",
400
- extra={"kbid": kbid, "node_id": replica.node},
392
+ f"Succeded deleting shard",
393
+ extra={"kbid": kbid, "shard_id": shard.nidx_shard_id},
401
394
  )
402
395
  except AioRpcError as exc:
403
396
  if exc.code() == StatusCode.NOT_FOUND:
404
397
  continue
405
- raise ShardNotFound(f"{exc.details()} @ {node.address}")
398
+ raise ShardNotFound(f"{exc.details()} @ shard {shard.nidx_shard_id}")
406
399
 
407
400
  await txn.commit()
408
401
  await cls.delete_all_kb_keys(driver, kbid)
@@ -25,6 +25,7 @@ from nucliadb.common.cluster.exceptions import NodeError, ShardNotFound
25
25
  from nucliadb.common.cluster.utils import setup_cluster, teardown_cluster
26
26
  from nucliadb.common.maindb.driver import Driver
27
27
  from nucliadb.common.maindb.utils import setup_driver, teardown_driver
28
+ from nucliadb.common.nidx import start_nidx_utility, stop_nidx_utility
28
29
  from nucliadb.ingest import SERVICE_NAME, logger
29
30
  from nucliadb.ingest.fields.base import Field
30
31
  from nucliadb.ingest.orm.knowledgebox import (
@@ -262,6 +263,7 @@ async def main():
262
263
  This script will purge all knowledge boxes marked to be deleted in maindb.
263
264
  """
264
265
  await setup_cluster()
266
+ await start_nidx_utility()
265
267
  driver = await setup_driver()
266
268
  storage = await get_storage(
267
269
  gcs_scopes=["https://www.googleapis.com/auth/devstorage.full_control"],
@@ -283,6 +285,7 @@ async def main():
283
285
  purge_resources_storage_task.cancel()
284
286
  await storage.finalize()
285
287
  await teardown_driver()
288
+ await stop_nidx_utility()
286
289
  await teardown_cluster()
287
290
  except Exception: # pragma: no cover
288
291
  logger.exception("Error tearing down utilities on purge command")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nucliadb
3
- Version: 6.2.1.post2992
3
+ Version: 6.2.1.post3003
4
4
  Home-page: https://docs.nuclia.dev/docs/management/nucliadb/intro
5
5
  Author: NucliaDB Community
6
6
  Author-email: nucliadb@nuclia.com
@@ -22,10 +22,10 @@ Classifier: Programming Language :: Python :: 3.12
22
22
  Classifier: Programming Language :: Python :: 3 :: Only
23
23
  Requires-Python: >=3.9, <4
24
24
  Description-Content-Type: text/markdown
25
- Requires-Dist: nucliadb-telemetry[all]>=6.2.1.post2992
26
- Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.2.1.post2992
27
- Requires-Dist: nucliadb-protos>=6.2.1.post2992
28
- Requires-Dist: nucliadb-models>=6.2.1.post2992
25
+ Requires-Dist: nucliadb-telemetry[all]>=6.2.1.post3003
26
+ Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.2.1.post3003
27
+ Requires-Dist: nucliadb-protos>=6.2.1.post3003
28
+ Requires-Dist: nucliadb-models>=6.2.1.post3003
29
29
  Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
30
30
  Requires-Dist: nuclia-models>=0.24.2
31
31
  Requires-Dist: uvicorn
@@ -130,7 +130,7 @@ nucliadb/ingest/orm/brain.py,sha256=UND5EsNUdd7XdjScYqRqg4r_xCx3l-My8alGw5M9CWg,
130
130
  nucliadb/ingest/orm/broker_message.py,sha256=ZEMueoGuuRKO4tHgzc0P0AM1Ls1TTYey_4UvRQf0BpY,6915
131
131
  nucliadb/ingest/orm/entities.py,sha256=5d6Gfo-Yz-rns_mNJeRqiGaPeWpUMgSKZnmWIGMLCKo,15537
132
132
  nucliadb/ingest/orm/exceptions.py,sha256=k4Esv4NtL4TrGTcsQpwrSfDhPQpiYcRbB1SpYmBX5MY,1432
133
- nucliadb/ingest/orm/knowledgebox.py,sha256=9n2QRuRj5BZiQU93O68UafxCN415kchizeU7A2j-WIo,25580
133
+ nucliadb/ingest/orm/knowledgebox.py,sha256=CGNfvft-IzSUQNENsnqYebp5dGfk2o3N561pcKes-28,25144
134
134
  nucliadb/ingest/orm/metrics.py,sha256=OkwMSPKLZcKba0ZTwtTiIxwBgaLMX5ydhGieKvi2y7E,1096
135
135
  nucliadb/ingest/orm/resource.py,sha256=KDTEwZ6_5eLvLu1s30Pln4BFDOy9D7_ChT7kRmQ1J2g,44670
136
136
  nucliadb/ingest/orm/utils.py,sha256=vCe_9UxHu26JDFGLwQ0wH-XyzJIpQCTK-Ow9dtZR5Vg,2716
@@ -155,7 +155,7 @@ nucliadb/migrator/settings.py,sha256=jOUX0ZMunCXN8HpF9xXN0aunJYRhu4Vdr_ffjRIqwtw
155
155
  nucliadb/migrator/utils.py,sha256=NgUreUvON8_nWEzTxELBMWlfV7E6-6qi-g0DMEbVEz4,2885
156
156
  nucliadb/models/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
157
157
  nucliadb/models/responses.py,sha256=qnuOoc7TrVSUnpikfTwHLKez47_DE4mSFzpxrwtqijA,1599
158
- nucliadb/purge/__init__.py,sha256=ijcigiWz38ohXmVVwDU87aCki1BkmAIQRjDoNQ3LPRM,11647
158
+ nucliadb/purge/__init__.py,sha256=BphuNvsJ1aSwuVXUcSOaK4nj9pDcpuKRBf_QAcoRj-A,11787
159
159
  nucliadb/purge/orphan_shards.py,sha256=7Qm5PFscGr5ihcn5YZ9BaDh6shagkYouv8Z_tTzLuM8,9222
160
160
  nucliadb/reader/__init__.py,sha256=C5Efic7WlGm2U2C5WOyquMFbIj2Pojwe_8mwzVYnOzE,1304
161
161
  nucliadb/reader/app.py,sha256=Se-BFTE6d1v1msLzQn4q5XIhjnSxa2ckDSHdvm7NRf8,3096
@@ -330,9 +330,9 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
330
330
  nucliadb/writer/tus/s3.py,sha256=vF0NkFTXiXhXq3bCVXXVV-ED38ECVoUeeYViP8uMqcU,8357
331
331
  nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
332
332
  nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
333
- nucliadb-6.2.1.post2992.dist-info/METADATA,sha256=XCzGcCOzEQ1nXetscEuNcrPVX2UPSfneLcKx5urGmT0,4603
334
- nucliadb-6.2.1.post2992.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
335
- nucliadb-6.2.1.post2992.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
336
- nucliadb-6.2.1.post2992.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
337
- nucliadb-6.2.1.post2992.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
338
- nucliadb-6.2.1.post2992.dist-info/RECORD,,
333
+ nucliadb-6.2.1.post3003.dist-info/METADATA,sha256=-FuHmxJcszMT19D0ONJHbJUeQdVt_x6rk0yWUTQuf3w,4603
334
+ nucliadb-6.2.1.post3003.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
335
+ nucliadb-6.2.1.post3003.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
336
+ nucliadb-6.2.1.post3003.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
337
+ nucliadb-6.2.1.post3003.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
338
+ nucliadb-6.2.1.post3003.dist-info/RECORD,,