nucliadb 6.6.1.post4701__py3-none-any.whl → 6.6.1.post4708__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/ingest/orm/resource.py +19 -0
- nucliadb/writer/api/v1/field.py +1 -3
- nucliadb/writer/api/v1/resource.py +1 -4
- {nucliadb-6.6.1.post4701.dist-info → nucliadb-6.6.1.post4708.dist-info}/METADATA +6 -6
- {nucliadb-6.6.1.post4701.dist-info → nucliadb-6.6.1.post4708.dist-info}/RECORD +8 -8
- {nucliadb-6.6.1.post4701.dist-info → nucliadb-6.6.1.post4708.dist-info}/WHEEL +0 -0
- {nucliadb-6.6.1.post4701.dist-info → nucliadb-6.6.1.post4708.dist-info}/entry_points.txt +0 -0
- {nucliadb-6.6.1.post4701.dist-info → nucliadb-6.6.1.post4708.dist-info}/top_level.txt +0 -0
nucliadb/ingest/orm/resource.py
CHANGED
@@ -146,6 +146,15 @@ class Resource:
|
|
146
146
|
if basic_in_payload.HasField("metadata") and basic_in_payload.metadata.useful:
|
147
147
|
current_basic.metadata.status = basic_in_payload.metadata.status
|
148
148
|
|
149
|
+
async def title_marked_for_reset(self) -> bool:
|
150
|
+
basic = await self.get_basic()
|
151
|
+
return basic is not None and basic.reset_title
|
152
|
+
|
153
|
+
async def unmark_title_for_reset(self):
|
154
|
+
basic = await self.get_basic()
|
155
|
+
if basic:
|
156
|
+
basic.reset_title = False
|
157
|
+
|
149
158
|
@processor_observer.wrap({"type": "set_basic"})
|
150
159
|
async def set_basic(
|
151
160
|
self,
|
@@ -624,10 +633,16 @@ class Resource:
|
|
624
633
|
self.basic.title.startswith("http")
|
625
634
|
or self.basic.title == ""
|
626
635
|
or self.basic.title == self.uuid
|
636
|
+
or await self.title_marked_for_reset()
|
627
637
|
):
|
628
638
|
return
|
639
|
+
logger.info(
|
640
|
+
"Updating resource title from link extracted data",
|
641
|
+
extra={"kbid": self.kb.kbid, "field": link_extracted_data.field, "rid": self.uuid},
|
642
|
+
)
|
629
643
|
title = link_extracted_data.title
|
630
644
|
await self.update_resource_title(title)
|
645
|
+
await self.unmark_title_for_reset()
|
631
646
|
self.modified = True
|
632
647
|
|
633
648
|
async def update_resource_title(self, computed_title: str) -> None:
|
@@ -694,6 +709,9 @@ class Resource:
|
|
694
709
|
if current_title in filenames:
|
695
710
|
# If the title is equal to any of the file filenames, we should update it
|
696
711
|
return True
|
712
|
+
if await self.title_marked_for_reset():
|
713
|
+
# If the title is marked for reset, we should update it
|
714
|
+
return True
|
697
715
|
return False
|
698
716
|
|
699
717
|
async def maybe_update_resource_title_from_file_extracted_data(self, message: BrokerMessage):
|
@@ -712,6 +730,7 @@ class Resource:
|
|
712
730
|
extra={"kbid": self.kb.kbid, "field": fid.full(), "new_title": fed.title},
|
713
731
|
)
|
714
732
|
await self.update_resource_title(fed.title)
|
733
|
+
await self.unmark_title_for_reset()
|
715
734
|
# Break after the first file with a title is found
|
716
735
|
break
|
717
736
|
|
nucliadb/writer/api/v1/field.py
CHANGED
@@ -595,9 +595,7 @@ async def reprocess_file_field(
|
|
595
595
|
writer.uuid = rid
|
596
596
|
writer.source = BrokerMessage.MessageSource.WRITER
|
597
597
|
if reset_title:
|
598
|
-
|
599
|
-
# computed titles will be used as the resource title after processing.
|
600
|
-
writer.basic.title = rid
|
598
|
+
writer.basic.reset_title = True
|
601
599
|
writer.basic.metadata.useful = True
|
602
600
|
writer.basic.metadata.status = Metadata.Status.PENDING
|
603
601
|
writer.field_statuses.append(
|
@@ -105,7 +105,6 @@ async def create_resource(
|
|
105
105
|
status_code=422,
|
106
106
|
detail="Cannot hide a resource: the KB does not have hidden resources enabled",
|
107
107
|
)
|
108
|
-
|
109
108
|
await maybe_back_pressure(kbid)
|
110
109
|
|
111
110
|
partitioning = get_partitioning()
|
@@ -481,9 +480,7 @@ async def _reprocess_resource(
|
|
481
480
|
writer.uuid = rid
|
482
481
|
writer.source = BrokerMessage.MessageSource.WRITER
|
483
482
|
if reset_title:
|
484
|
-
|
485
|
-
# computed titles will be used as the resource title after processing.
|
486
|
-
writer.basic.title = rid
|
483
|
+
writer.basic.reset_title = True
|
487
484
|
writer.basic.metadata.useful = True
|
488
485
|
writer.basic.metadata.status = Metadata.Status.PENDING
|
489
486
|
await transaction.commit(writer, partition, wait=False)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nucliadb
|
3
|
-
Version: 6.6.1.
|
3
|
+
Version: 6.6.1.post4708
|
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.6.1.
|
23
|
-
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.6.1.
|
24
|
-
Requires-Dist: nucliadb-protos>=6.6.1.
|
25
|
-
Requires-Dist: nucliadb-models>=6.6.1.
|
26
|
-
Requires-Dist: nidx-protos>=6.6.1.
|
22
|
+
Requires-Dist: nucliadb-telemetry[all]>=6.6.1.post4708
|
23
|
+
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.6.1.post4708
|
24
|
+
Requires-Dist: nucliadb-protos>=6.6.1.post4708
|
25
|
+
Requires-Dist: nucliadb-models>=6.6.1.post4708
|
26
|
+
Requires-Dist: nidx-protos>=6.6.1.post4708
|
27
27
|
Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
|
28
28
|
Requires-Dist: nuclia-models>=0.43.0
|
29
29
|
Requires-Dist: uvicorn[standard]
|
@@ -163,7 +163,7 @@ nucliadb/ingest/orm/exceptions.py,sha256=k4Esv4NtL4TrGTcsQpwrSfDhPQpiYcRbB1SpYmB
|
|
163
163
|
nucliadb/ingest/orm/index_message.py,sha256=DWMTHJoVamUbK8opKl5csDvxfgz7c2j7phG1Ut4yIxk,15724
|
164
164
|
nucliadb/ingest/orm/knowledgebox.py,sha256=_rkeTMIXMhR64gbYtZpFHoUHghV2DTJ2lUBqZsoqC_4,23898
|
165
165
|
nucliadb/ingest/orm/metrics.py,sha256=OiuggTh-n3kZHA2G73NEUdIlh8c3yFrbusI88DK-Mko,1273
|
166
|
-
nucliadb/ingest/orm/resource.py,sha256=
|
166
|
+
nucliadb/ingest/orm/resource.py,sha256=G3efCiOnaIW0pdPtB28PkKgaOEE-7A5PnugBu3f9-OQ,38589
|
167
167
|
nucliadb/ingest/orm/utils.py,sha256=fCQRuyecgqhaY7mcBG93oaXMkzkKb9BFjOcy4-ZiSNw,2693
|
168
168
|
nucliadb/ingest/orm/processor/__init__.py,sha256=Aqd9wCNTvggkMkCY3WvoI8spdr94Jnqk-0iq9XpLs18,922
|
169
169
|
nucliadb/ingest/orm/processor/auditing.py,sha256=TeYhXGJRyQ7ROytbb2u8R0fIh_FYi3HgTu3S1ribY3U,4623
|
@@ -352,10 +352,10 @@ nucliadb/writer/api/constants.py,sha256=qWEDjFUycrEZnSJyLnNK4PQNodU2oVmkO4NycaEZ
|
|
352
352
|
nucliadb/writer/api/utils.py,sha256=wIQHlU8RQiIGVLI72suvyVIKlCU44Unh0Ae0IiN6Qwo,1313
|
353
353
|
nucliadb/writer/api/v1/__init__.py,sha256=akI9A_jloNLb0dU4T5zjfdyvmSAiDeIdjAlzNx74FlU,1128
|
354
354
|
nucliadb/writer/api/v1/export_import.py,sha256=v0sU55TtRSqDzwkDgcwv2uSaqKCuQTtGcMpYoHQYBQA,8192
|
355
|
-
nucliadb/writer/api/v1/field.py,sha256=
|
355
|
+
nucliadb/writer/api/v1/field.py,sha256=rF_x6fVczZKa4xBrHChUVau-70uFJT7srQpOLuqG2ic,18755
|
356
356
|
nucliadb/writer/api/v1/knowledgebox.py,sha256=PHEYDFa-sN5JrI8-EiVVg5FDOsRuCLT43kyAB4xt-xA,9530
|
357
357
|
nucliadb/writer/api/v1/learning_config.py,sha256=CKBjqcbewkfPwGUPLDWzZSpro6XkmCaVppe5Qtpu5Go,3117
|
358
|
-
nucliadb/writer/api/v1/resource.py,sha256=
|
358
|
+
nucliadb/writer/api/v1/resource.py,sha256=gr4VtYOtnIAL5zsDQsBDzeOOWWh6wN7PUh1XgUsQ9N4,20436
|
359
359
|
nucliadb/writer/api/v1/router.py,sha256=RjuoWLpZer6Kl2BW_wznpNo6XL3BOpdTGqXZCn3QrrQ,1034
|
360
360
|
nucliadb/writer/api/v1/services.py,sha256=3AUjk-SmvqJx76v7y89DZx6oyasojPliGYeniRQjpcU,13337
|
361
361
|
nucliadb/writer/api/v1/slug.py,sha256=xlVBDBpRi9bNulpBHZwhyftVvulfE0zFm1XZIWl-AKY,2389
|
@@ -376,8 +376,8 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
|
|
376
376
|
nucliadb/writer/tus/s3.py,sha256=vF0NkFTXiXhXq3bCVXXVV-ED38ECVoUeeYViP8uMqcU,8357
|
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.6.1.
|
380
|
-
nucliadb-6.6.1.
|
381
|
-
nucliadb-6.6.1.
|
382
|
-
nucliadb-6.6.1.
|
383
|
-
nucliadb-6.6.1.
|
379
|
+
nucliadb-6.6.1.post4708.dist-info/METADATA,sha256=5ExGb5nsHOVIevztP91xdMRXg7XyF1I1uAJE8NB0OhU,4158
|
380
|
+
nucliadb-6.6.1.post4708.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
381
|
+
nucliadb-6.6.1.post4708.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
|
382
|
+
nucliadb-6.6.1.post4708.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
|
383
|
+
nucliadb-6.6.1.post4708.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|