nucliadb 6.3.3.post3611__py3-none-any.whl → 6.3.3.post3621__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.
@@ -174,7 +174,12 @@ async def backup_resource_with_binaries(
174
174
  if not await exists_cf(context, cloud_file):
175
175
  logger.warning(
176
176
  "Cloud file not found in storage, skipping",
177
- extra={"kbid": kbid, "rid": rid, "cf_uri": cloud_file.uri},
177
+ extra={
178
+ "kbid": kbid,
179
+ "rid": rid,
180
+ "cf_uri": cloud_file.uri,
181
+ "cf_bucket": cloud_file.bucket_name,
182
+ },
178
183
  )
179
184
  continue
180
185
 
@@ -260,7 +265,8 @@ async def delete_metadata(context: ApplicationContext, kbid: str, backup_id: str
260
265
 
261
266
 
262
267
  async def exists_cf(context: ApplicationContext, cf: resources_pb2.CloudFile) -> bool:
263
- return await context.blob_storage.exists_object(bucket=cf.bucket_name, key=cf.uri)
268
+ bucket_name = context.blob_storage.get_bucket_name_from_cf(cf)
269
+ return await context.blob_storage.exists_object(bucket=bucket_name, key=cf.uri)
264
270
 
265
271
 
266
272
  async def upload_to_bucket(context: ApplicationContext, bytes_iterator: AsyncIterator[bytes], key: str):
@@ -20,12 +20,15 @@
20
20
 
21
21
 
22
22
  import asyncio
23
+ import logging
23
24
 
24
25
  from nucliadb.backups.const import StorageKeys
25
26
  from nucliadb.backups.models import DeleteBackupRequest
26
27
  from nucliadb.backups.settings import settings
27
28
  from nucliadb.common.context import ApplicationContext
28
29
 
30
+ logger = logging.getLogger(__name__)
31
+
29
32
 
30
33
  async def delete_backup_task(context: ApplicationContext, msg: DeleteBackupRequest):
31
34
  """
@@ -35,12 +38,15 @@ async def delete_backup_task(context: ApplicationContext, msg: DeleteBackupReque
35
38
 
36
39
 
37
40
  async def delete_backup(context: ApplicationContext, backup_id: str):
41
+ total_deleted = 0
38
42
  while True:
39
43
  deleted = await delete_n(context, backup_id, n=1000)
40
44
  if deleted == 0:
41
45
  # No more objects to delete
42
46
  break
43
- await asyncio.sleep(1)
47
+ total_deleted += deleted
48
+ logger.info(f"Deleted {total_deleted} objects from backup", extra={"backup_id": backup_id})
49
+ logger.info(f"Backup deletion completed", extra={"backup_id": backup_id})
44
50
 
45
51
 
46
52
  async def delete_n(context: ApplicationContext, backup_id: str, n: int):
nucliadb/backups/tasks.py CHANGED
@@ -21,7 +21,7 @@ from typing import Awaitable, Callable
21
21
 
22
22
  from nucliadb.backups.const import BackupsNatsConfig
23
23
  from nucliadb.backups.create import backup_kb_task
24
- from nucliadb.backups.delete import delete_backup
24
+ from nucliadb.backups.delete import delete_backup_task
25
25
  from nucliadb.backups.models import CreateBackupRequest, DeleteBackupRequest, RestoreBackupRequest
26
26
  from nucliadb.backups.restore import restore_kb_task
27
27
  from nucliadb.common.context import ApplicationContext
@@ -83,11 +83,11 @@ async def restore(kbid: str, backup_id: str) -> None:
83
83
 
84
84
 
85
85
  def deleter_consumer() -> NatsTaskConsumer[DeleteBackupRequest]:
86
- consumer: NatsTaskConsumer = create_consumer(
86
+ consumer: NatsTaskConsumer[DeleteBackupRequest] = create_consumer(
87
87
  name="backup_deleter",
88
88
  stream=BackupsNatsConfig.stream,
89
89
  consumer=BackupsNatsConfig.delete_consumer,
90
- callback=delete_backup,
90
+ callback=delete_backup_task,
91
91
  msg_type=DeleteBackupRequest,
92
92
  max_concurrent_messages=2,
93
93
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nucliadb
3
- Version: 6.3.3.post3611
3
+ Version: 6.3.3.post3621
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.3.post3611
24
- Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.3.3.post3611
25
- Requires-Dist: nucliadb-protos>=6.3.3.post3611
26
- Requires-Dist: nucliadb-models>=6.3.3.post3611
27
- Requires-Dist: nidx-protos>=6.3.3.post3611
23
+ Requires-Dist: nucliadb-telemetry[all]>=6.3.3.post3621
24
+ Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.3.3.post3621
25
+ Requires-Dist: nucliadb-protos>=6.3.3.post3621
26
+ Requires-Dist: nucliadb-models>=6.3.3.post3621
27
+ Requires-Dist: nidx-protos>=6.3.3.post3621
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
@@ -41,12 +41,12 @@ nucliadb/openapi.py,sha256=wDiw0dVEvTpJvbatkJ0JZLkKm9RItZT5PWRHjqRfqTA,2272
41
41
  nucliadb/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
42
  nucliadb/backups/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
43
43
  nucliadb/backups/const.py,sha256=9vPAhLxQO_gNAjSdPxWuv3V66s9WcdpjOQ89CZlfmuk,1894
44
- nucliadb/backups/create.py,sha256=x5Ezd1p8qqlcn-srbE_iFxTwEEjycKWhTezUIkXL-oo,11230
45
- nucliadb/backups/delete.py,sha256=1rnBhVUGYYZJXSZUrrgYMDZ5NyswEWkIA-G-crRCyHk,2404
44
+ nucliadb/backups/create.py,sha256=TJtYewhD0jkYV_h3rNUhKzhqB2QHAhLWYOgRVlGysGs,11450
45
+ nucliadb/backups/delete.py,sha256=AAs-WP-ujejj6c1LJgiMn7Ht67N_j0a1sKQlUepHpEA,2659
46
46
  nucliadb/backups/models.py,sha256=-hITU4Mv6AxePu12toBu_fjpEv6vVGcwNVxV22O9jQA,1273
47
47
  nucliadb/backups/restore.py,sha256=YD3Bbo9ry4YLMM6imB-DXbOAMXfGxVzJtTAAUFDvB0I,10153
48
48
  nucliadb/backups/settings.py,sha256=SyzsInj1BRbBI0atg5IXWbMbOZ_eVg4eSQ3IcnUhCxQ,1357
49
- nucliadb/backups/tasks.py,sha256=4_kOVJ2yCwMvDEpzJgTuTt75TNlpq5woyw9sTAcaSkw,4194
49
+ nucliadb/backups/tasks.py,sha256=WkL1LgdYBHbV_A5ilyYv5p3zmXwxH68TDudytN5f7zk,4225
50
50
  nucliadb/backups/utils.py,sha256=_Vogjqcru5oqNZM-bZ0q7Ju79Bv1PD-LVFEa7Z-Q13I,1261
51
51
  nucliadb/common/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
52
52
  nucliadb/common/constants.py,sha256=QpigxJh_CtD85Evy0PtV5cVq6x0U_f9xfIcXz1ymkUg,869
@@ -351,8 +351,8 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
351
351
  nucliadb/writer/tus/s3.py,sha256=vF0NkFTXiXhXq3bCVXXVV-ED38ECVoUeeYViP8uMqcU,8357
352
352
  nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
353
353
  nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
354
- nucliadb-6.3.3.post3611.dist-info/METADATA,sha256=k4CK1ALRNK5NsSVw0Lo-VG8RNfvYELnUJbd2pxziQzE,4291
355
- nucliadb-6.3.3.post3611.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
356
- nucliadb-6.3.3.post3611.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
357
- nucliadb-6.3.3.post3611.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
358
- nucliadb-6.3.3.post3611.dist-info/RECORD,,
354
+ nucliadb-6.3.3.post3621.dist-info/METADATA,sha256=SQabE3xZSXmHoDasDSvXFiDaUJqMkmdkjf5dj6_jWic,4291
355
+ nucliadb-6.3.3.post3621.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
356
+ nucliadb-6.3.3.post3621.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
357
+ nucliadb-6.3.3.post3621.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
358
+ nucliadb-6.3.3.post3621.dist-info/RECORD,,