nucliadb 6.8.0.post4925__py3-none-any.whl → 6.8.1.post4932__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/writer/tus/gcs.py +11 -17
- {nucliadb-6.8.0.post4925.dist-info → nucliadb-6.8.1.post4932.dist-info}/METADATA +6 -6
- {nucliadb-6.8.0.post4925.dist-info → nucliadb-6.8.1.post4932.dist-info}/RECORD +6 -6
- {nucliadb-6.8.0.post4925.dist-info → nucliadb-6.8.1.post4932.dist-info}/WHEEL +0 -0
- {nucliadb-6.8.0.post4925.dist-info → nucliadb-6.8.1.post4932.dist-info}/entry_points.txt +0 -0
- {nucliadb-6.8.0.post4925.dist-info → nucliadb-6.8.1.post4932.dist-info}/top_level.txt +0 -0
nucliadb/writer/tus/gcs.py
CHANGED
|
@@ -74,7 +74,7 @@ RETRIABLE_EXCEPTIONS = (
|
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
class GCloudBlobStore(BlobStore):
|
|
77
|
-
|
|
77
|
+
_session: Optional[aiohttp.ClientSession] = None
|
|
78
78
|
loop = None
|
|
79
79
|
upload_url: str
|
|
80
80
|
object_base_url: str
|
|
@@ -84,6 +84,12 @@ class GCloudBlobStore(BlobStore):
|
|
|
84
84
|
project: str
|
|
85
85
|
executor = ThreadPoolExecutor(max_workers=5)
|
|
86
86
|
|
|
87
|
+
@property
|
|
88
|
+
def session(self) -> aiohttp.ClientSession:
|
|
89
|
+
if self._session is None: # pragma: no cover
|
|
90
|
+
raise AttributeError("Session not initialized")
|
|
91
|
+
return self._session
|
|
92
|
+
|
|
87
93
|
async def get_access_headers(self):
|
|
88
94
|
if self._credentials is None:
|
|
89
95
|
return {}
|
|
@@ -106,8 +112,9 @@ class GCloudBlobStore(BlobStore):
|
|
|
106
112
|
return access_token.access_token
|
|
107
113
|
|
|
108
114
|
async def finalize(self):
|
|
109
|
-
if self.
|
|
110
|
-
await self.
|
|
115
|
+
if self._session is not None:
|
|
116
|
+
await self._session.close()
|
|
117
|
+
self._session = None
|
|
111
118
|
|
|
112
119
|
async def initialize(
|
|
113
120
|
self,
|
|
@@ -143,12 +150,9 @@ class GCloudBlobStore(BlobStore):
|
|
|
143
150
|
self._credentials = None
|
|
144
151
|
|
|
145
152
|
loop = asyncio.get_event_loop()
|
|
146
|
-
self.
|
|
153
|
+
self._session = aiohttp.ClientSession(loop=loop, timeout=TIMEOUT)
|
|
147
154
|
|
|
148
155
|
async def check_exists(self, bucket_name: str):
|
|
149
|
-
if self.session is None:
|
|
150
|
-
raise AttributeError()
|
|
151
|
-
|
|
152
156
|
headers = await self.get_access_headers()
|
|
153
157
|
# Using object access url instead of bucket access to avoid
|
|
154
158
|
# giving admin permission to the SA, needed to GET a bucket
|
|
@@ -163,8 +167,6 @@ class GCloudBlobStore(BlobStore):
|
|
|
163
167
|
return False
|
|
164
168
|
|
|
165
169
|
async def create_bucket(self, bucket_name: str):
|
|
166
|
-
if self.session is None:
|
|
167
|
-
raise AttributeError()
|
|
168
170
|
headers = await self.get_access_headers()
|
|
169
171
|
url = f"{self.object_base_url}?project={self.project}"
|
|
170
172
|
|
|
@@ -199,10 +201,6 @@ class GCloudFileStorageManager(FileStorageManager):
|
|
|
199
201
|
_resumable_uri : uri to resumable upload
|
|
200
202
|
_uri : finished uploaded image
|
|
201
203
|
"""
|
|
202
|
-
|
|
203
|
-
if self.storage.session is None:
|
|
204
|
-
raise AttributeError()
|
|
205
|
-
|
|
206
204
|
upload_file_id = dm.get("upload_file_id")
|
|
207
205
|
if upload_file_id is not None:
|
|
208
206
|
await self.delete_upload(upload_file_id, kbid)
|
|
@@ -287,8 +285,6 @@ class GCloudFileStorageManager(FileStorageManager):
|
|
|
287
285
|
|
|
288
286
|
@backoff.on_exception(backoff.expo, RETRIABLE_EXCEPTIONS, jitter=backoff.random_jitter, max_tries=4)
|
|
289
287
|
async def _append(self, dm: FileDataManager, data, offset):
|
|
290
|
-
if self.storage.session is None:
|
|
291
|
-
raise AttributeError()
|
|
292
288
|
if dm.size:
|
|
293
289
|
size = str(dm.size)
|
|
294
290
|
else:
|
|
@@ -353,8 +349,6 @@ class GCloudFileStorageManager(FileStorageManager):
|
|
|
353
349
|
@backoff.on_exception(backoff.expo, RETRIABLE_EXCEPTIONS, jitter=backoff.random_jitter, max_tries=4)
|
|
354
350
|
async def finish(self, dm: FileDataManager):
|
|
355
351
|
if dm.size == 0:
|
|
356
|
-
if self.storage.session is None:
|
|
357
|
-
raise AttributeError()
|
|
358
352
|
# In case of empty file, we need to send a PUT request with empty body
|
|
359
353
|
# and Content-Range header set to "bytes */0"
|
|
360
354
|
headers = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nucliadb
|
|
3
|
-
Version: 6.8.
|
|
3
|
+
Version: 6.8.1.post4932
|
|
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.8.
|
|
23
|
-
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.8.
|
|
24
|
-
Requires-Dist: nucliadb-protos>=6.8.
|
|
25
|
-
Requires-Dist: nucliadb-models>=6.8.
|
|
26
|
-
Requires-Dist: nidx-protos>=6.8.
|
|
22
|
+
Requires-Dist: nucliadb-telemetry[all]>=6.8.1.post4932
|
|
23
|
+
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.8.1.post4932
|
|
24
|
+
Requires-Dist: nucliadb-protos>=6.8.1.post4932
|
|
25
|
+
Requires-Dist: nucliadb-models>=6.8.1.post4932
|
|
26
|
+
Requires-Dist: nidx-protos>=6.8.1.post4932
|
|
27
27
|
Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
|
|
28
28
|
Requires-Dist: nuclia-models>=0.47.0
|
|
29
29
|
Requires-Dist: uvicorn[standard]
|
|
@@ -374,13 +374,13 @@ nucliadb/writer/tus/__init__.py,sha256=Kera0BtxoDX0ngPftXiMjNgjrhtQ3l2XFc5nJqSBO
|
|
|
374
374
|
nucliadb/writer/tus/azure.py,sha256=XhWAlWTM0vmXcXtuEPYjjeEhuZjiZXZu8q9WsJ7omFE,4107
|
|
375
375
|
nucliadb/writer/tus/dm.py,sha256=bVoXqt_dpNvTjpffPYhj1JfqK6gfLoPr0hdkknUCZ9E,5488
|
|
376
376
|
nucliadb/writer/tus/exceptions.py,sha256=WfZSSjsHfoy63wUFlH3QoHx7FMoCNA1oKJmWpZZDnCo,2156
|
|
377
|
-
nucliadb/writer/tus/gcs.py,sha256=
|
|
377
|
+
nucliadb/writer/tus/gcs.py,sha256=pzJDJSXZKh7VrFYw-wiRSCCXfXklfGwDZSMAnjoh_48,13871
|
|
378
378
|
nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,5193
|
|
379
379
|
nucliadb/writer/tus/s3.py,sha256=vu1BGg4VqJ_x2P1u2BxqPKlSfw5orT_a3R-Ln5oPUpU,8483
|
|
380
380
|
nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
|
|
381
381
|
nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
|
|
382
|
-
nucliadb-6.8.
|
|
383
|
-
nucliadb-6.8.
|
|
384
|
-
nucliadb-6.8.
|
|
385
|
-
nucliadb-6.8.
|
|
386
|
-
nucliadb-6.8.
|
|
382
|
+
nucliadb-6.8.1.post4932.dist-info/METADATA,sha256=j-QmNX1P8xGjploIJ2vMzm015CCHBQ0ZqD2Tv3AwI5I,4158
|
|
383
|
+
nucliadb-6.8.1.post4932.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
384
|
+
nucliadb-6.8.1.post4932.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
|
|
385
|
+
nucliadb-6.8.1.post4932.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
|
|
386
|
+
nucliadb-6.8.1.post4932.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|