nucliadb 6.1.0.post2569__py3-none-any.whl → 6.1.0.post2572__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.
- nucliadb/export_import/importer.py +26 -14
- {nucliadb-6.1.0.post2569.dist-info → nucliadb-6.1.0.post2572.dist-info}/METADATA +5 -5
- {nucliadb-6.1.0.post2569.dist-info → nucliadb-6.1.0.post2572.dist-info}/RECORD +7 -7
- {nucliadb-6.1.0.post2569.dist-info → nucliadb-6.1.0.post2572.dist-info}/WHEEL +0 -0
- {nucliadb-6.1.0.post2569.dist-info → nucliadb-6.1.0.post2572.dist-info}/entry_points.txt +0 -0
- {nucliadb-6.1.0.post2569.dist-info → nucliadb-6.1.0.post2572.dist-info}/top_level.txt +0 -0
- {nucliadb-6.1.0.post2569.dist-info → nucliadb-6.1.0.post2572.dist-info}/zip-safe +0 -0
@@ -37,6 +37,7 @@ from nucliadb.export_import.utils import (
|
|
37
37
|
)
|
38
38
|
from nucliadb_protos import knowledgebox_pb2 as kb_pb2
|
39
39
|
from nucliadb_protos import resources_pb2, writer_pb2
|
40
|
+
from nucliadb_utils.utilities import _create_storage
|
40
41
|
|
41
42
|
BinaryStream = AsyncGenerator[bytes, None]
|
42
43
|
BinaryStreamGenerator = Callable[[int], BinaryStream]
|
@@ -97,17 +98,28 @@ async def import_kb_from_blob_storage(context: ApplicationContext, msg: NatsTask
|
|
97
98
|
"""
|
98
99
|
Imports to a knowledgebox from an export stored in the blob storage service.
|
99
100
|
"""
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
101
|
+
try:
|
102
|
+
# There is an issue when using the same aiobotocore client to download and upload files concurrently.
|
103
|
+
# https://github.com/aio-libs/aiobotocore/issues/1235
|
104
|
+
#
|
105
|
+
# As a workaround, we use a newly created client for the download of the import file, while using
|
106
|
+
# the normally configured storage for the uploads:
|
107
|
+
# - The `ExportImportDataManager` is used for the downloads and gets the new storage
|
108
|
+
# - `import_kb` gets the `context` with the default blob storage to use in uploads
|
109
|
+
download_storage = await _create_storage()
|
110
|
+
kbid, import_id = msg.kbid, msg.id
|
111
|
+
dm = ExportImportDataManager(context.kv_driver, download_storage)
|
112
|
+
metadata = await dm.get_metadata(type="import", kbid=kbid, id=import_id)
|
113
|
+
|
114
|
+
retry_handler = TaskRetryHandler("import", dm, metadata)
|
115
|
+
|
116
|
+
@retry_handler.wrap
|
117
|
+
async def import_kb_retried(context, kbid, metadata):
|
118
|
+
stream = dm.download_import(kbid, import_id)
|
119
|
+
await import_kb(context, kbid, stream, metadata)
|
120
|
+
|
121
|
+
await import_kb_retried(context, kbid, metadata)
|
122
|
+
|
123
|
+
await dm.try_delete_from_storage("import", kbid, import_id)
|
124
|
+
finally:
|
125
|
+
await download_storage.finalize()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: nucliadb
|
3
|
-
Version: 6.1.0.
|
3
|
+
Version: 6.1.0.post2572
|
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.1.0.
|
26
|
-
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.1.0.
|
27
|
-
Requires-Dist: nucliadb-protos>=6.1.0.
|
28
|
-
Requires-Dist: nucliadb-models>=6.1.0.
|
25
|
+
Requires-Dist: nucliadb-telemetry[all]>=6.1.0.post2572
|
26
|
+
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.1.0.post2572
|
27
|
+
Requires-Dist: nucliadb-protos>=6.1.0.post2572
|
28
|
+
Requires-Dist: nucliadb-models>=6.1.0.post2572
|
29
29
|
Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
|
30
30
|
Requires-Dist: nucliadb-node-binding>=2.26.0
|
31
31
|
Requires-Dist: uvicorn
|
@@ -100,7 +100,7 @@ nucliadb/export_import/__init__.py,sha256=y-Is0Bxa8TMV6UiOW0deC_D3U465P65CQ5RjBj
|
|
100
100
|
nucliadb/export_import/datamanager.py,sha256=b9Vhf-WqJ8HosTdNpKXlGj-Vi7MHyMoPxL0VpfPlYlE,6720
|
101
101
|
nucliadb/export_import/exceptions.py,sha256=Dw8WqfG4r6MPJc5TPfbjMvCgXXWTcTOecGHRVU1h3kM,1949
|
102
102
|
nucliadb/export_import/exporter.py,sha256=kgbW-B7FNW7mlc9rBVEfwkkFTqD58TWSTDe9zkmEnBc,7098
|
103
|
-
nucliadb/export_import/importer.py,sha256=
|
103
|
+
nucliadb/export_import/importer.py,sha256=_tzoE2dUfLPivjp8CPE5BMMRCCr_1heOrWmqIe89_LQ,4964
|
104
104
|
nucliadb/export_import/models.py,sha256=VHetyHlofHH5yzcV5q6hN15zGKJTRAu7GOTNveN-tGA,2063
|
105
105
|
nucliadb/export_import/tasks.py,sha256=fpCBeFYPReyLIdk38LDM9Tpnw_VczeMrobT4n1RAIp4,2507
|
106
106
|
nucliadb/export_import/utils.py,sha256=zrNrkkc9i3uT-R6Ju4J_0WNrzayln3KuQFCz-_qIaIA,19613
|
@@ -331,9 +331,9 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
|
|
331
331
|
nucliadb/writer/tus/s3.py,sha256=vF0NkFTXiXhXq3bCVXXVV-ED38ECVoUeeYViP8uMqcU,8357
|
332
332
|
nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
|
333
333
|
nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
|
334
|
-
nucliadb-6.1.0.
|
335
|
-
nucliadb-6.1.0.
|
336
|
-
nucliadb-6.1.0.
|
337
|
-
nucliadb-6.1.0.
|
338
|
-
nucliadb-6.1.0.
|
339
|
-
nucliadb-6.1.0.
|
334
|
+
nucliadb-6.1.0.post2572.dist-info/METADATA,sha256=Xgkb6zYf-w9Ys2nS1-c4wPB-fhPrlrsoH9KXB44Vfto,4390
|
335
|
+
nucliadb-6.1.0.post2572.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
336
|
+
nucliadb-6.1.0.post2572.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
|
337
|
+
nucliadb-6.1.0.post2572.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
|
338
|
+
nucliadb-6.1.0.post2572.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
339
|
+
nucliadb-6.1.0.post2572.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|