nucliadb 6.3.1.post3492__py3-none-any.whl → 6.3.1.post3498__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/datamanager.py +7 -4
- nucliadb/export_import/exporter.py +2 -2
- nucliadb/export_import/tasks.py +18 -10
- nucliadb/ingest/app.py +2 -0
- nucliadb/search/api/v1/catalog.py +5 -1
- nucliadb/tasks/__init__.py +2 -3
- nucliadb/tasks/consumer.py +23 -40
- nucliadb/tasks/models.py +2 -12
- nucliadb/tasks/producer.py +24 -26
- nucliadb/tasks/utils.py +0 -5
- nucliadb/writer/api/v1/export_import.py +2 -2
- {nucliadb-6.3.1.post3492.dist-info → nucliadb-6.3.1.post3498.dist-info}/METADATA +6 -6
- {nucliadb-6.3.1.post3492.dist-info → nucliadb-6.3.1.post3498.dist-info}/RECORD +16 -17
- nucliadb/tasks/registry.py +0 -59
- {nucliadb-6.3.1.post3492.dist-info → nucliadb-6.3.1.post3498.dist-info}/WHEEL +0 -0
- {nucliadb-6.3.1.post3492.dist-info → nucliadb-6.3.1.post3498.dist-info}/entry_points.txt +0 -0
- {nucliadb-6.3.1.post3492.dist-info → nucliadb-6.3.1.post3498.dist-info}/top_level.txt +0 -0
@@ -19,7 +19,7 @@
|
|
19
19
|
#
|
20
20
|
import json
|
21
21
|
from datetime import datetime
|
22
|
-
from typing import AsyncGenerator, Union
|
22
|
+
from typing import AsyncGenerator, Type, Union, cast
|
23
23
|
|
24
24
|
from nucliadb.common.maindb.driver import Driver
|
25
25
|
from nucliadb.export_import import logger
|
@@ -59,11 +59,12 @@ class ExportImportDataManager:
|
|
59
59
|
if data is None or data == b"":
|
60
60
|
raise MetadataNotFound()
|
61
61
|
decoded = data.decode("utf-8")
|
62
|
+
model_type: Union[Type[ExportMetadata], Type[ImportMetadata]]
|
62
63
|
if type == "export":
|
63
64
|
model_type = ExportMetadata
|
64
65
|
elif type == "import":
|
65
|
-
model_type = ImportMetadata
|
66
|
-
else:
|
66
|
+
model_type = ImportMetadata
|
67
|
+
else: # pragma: no cover
|
67
68
|
raise ValueError(f"Invalid type: {type}")
|
68
69
|
json_decoded = json.loads(decoded)
|
69
70
|
|
@@ -73,9 +74,11 @@ class ExportImportDataManager:
|
|
73
74
|
json_decoded["total"] = 0
|
74
75
|
if json_decoded.get("processed") is None:
|
75
76
|
json_decoded["processed"] = 0
|
76
|
-
|
77
77
|
return model_type.model_validate(json_decoded)
|
78
78
|
|
79
|
+
async def get_export_metadata(self, kbid: str, id: str) -> ExportMetadata:
|
80
|
+
return cast(ExportMetadata, await self.get_metadata("export", kbid, id))
|
81
|
+
|
79
82
|
async def set_metadata(
|
80
83
|
self,
|
81
84
|
type: str,
|
@@ -76,8 +76,8 @@ async def export_kb_to_blob_storage(context: ApplicationContext, msg: NatsTaskMe
|
|
76
76
|
"""
|
77
77
|
kbid, export_id = msg.kbid, msg.id
|
78
78
|
dm = ExportImportDataManager(context.kv_driver, context.blob_storage)
|
79
|
-
metadata = await dm.
|
80
|
-
iterator = export_kb(context, kbid, metadata)
|
79
|
+
metadata = await dm.get_export_metadata(kbid=kbid, id=export_id)
|
80
|
+
iterator = export_kb(context, kbid, metadata)
|
81
81
|
|
82
82
|
retry_handler = TaskRetryHandler("export", dm, metadata)
|
83
83
|
|
nucliadb/export_import/tasks.py
CHANGED
@@ -27,40 +27,48 @@ from nucliadb.tasks.producer import NatsTaskProducer
|
|
27
27
|
from nucliadb_utils import const
|
28
28
|
|
29
29
|
|
30
|
-
def get_exports_consumer() -> NatsTaskConsumer:
|
30
|
+
def get_exports_consumer() -> NatsTaskConsumer[NatsTaskMessage]:
|
31
31
|
return create_consumer(
|
32
32
|
name="exports_consumer",
|
33
|
-
stream=const.Streams.KB_EXPORTS,
|
34
|
-
|
33
|
+
stream=const.Streams.KB_EXPORTS.name,
|
34
|
+
stream_subjects=[const.Streams.KB_EXPORTS.subject],
|
35
|
+
consumer_subject=const.Streams.KB_EXPORTS.subject,
|
36
|
+
callback=export_kb_to_blob_storage,
|
35
37
|
msg_type=NatsTaskMessage,
|
36
38
|
max_concurrent_messages=10,
|
37
39
|
)
|
38
40
|
|
39
41
|
|
40
|
-
async def get_exports_producer(context: ApplicationContext) -> NatsTaskProducer:
|
42
|
+
async def get_exports_producer(context: ApplicationContext) -> NatsTaskProducer[NatsTaskMessage]:
|
41
43
|
producer = create_producer(
|
42
44
|
name="exports_producer",
|
43
|
-
stream=const.Streams.KB_EXPORTS,
|
45
|
+
stream=const.Streams.KB_EXPORTS.name,
|
46
|
+
stream_subjects=[const.Streams.KB_EXPORTS.subject],
|
47
|
+
producer_subject=const.Streams.KB_EXPORTS.subject,
|
44
48
|
msg_type=NatsTaskMessage,
|
45
49
|
)
|
46
50
|
await producer.initialize(context)
|
47
51
|
return producer
|
48
52
|
|
49
53
|
|
50
|
-
def get_imports_consumer() -> NatsTaskConsumer:
|
54
|
+
def get_imports_consumer() -> NatsTaskConsumer[NatsTaskMessage]:
|
51
55
|
return create_consumer(
|
52
56
|
name="imports_consumer",
|
53
|
-
stream=const.Streams.KB_IMPORTS,
|
54
|
-
|
57
|
+
stream=const.Streams.KB_IMPORTS.name,
|
58
|
+
stream_subjects=[const.Streams.KB_IMPORTS.subject],
|
59
|
+
consumer_subject=const.Streams.KB_IMPORTS.subject,
|
60
|
+
callback=import_kb_from_blob_storage,
|
55
61
|
msg_type=NatsTaskMessage,
|
56
62
|
max_concurrent_messages=10,
|
57
63
|
)
|
58
64
|
|
59
65
|
|
60
|
-
async def get_imports_producer(context: ApplicationContext) -> NatsTaskProducer:
|
66
|
+
async def get_imports_producer(context: ApplicationContext) -> NatsTaskProducer[NatsTaskMessage]:
|
61
67
|
producer = create_producer(
|
62
68
|
name="imports_producer",
|
63
|
-
stream=const.Streams.KB_IMPORTS,
|
69
|
+
stream=const.Streams.KB_IMPORTS.name,
|
70
|
+
stream_subjects=[const.Streams.KB_IMPORTS.subject],
|
71
|
+
producer_subject=const.Streams.KB_IMPORTS.subject,
|
64
72
|
msg_type=NatsTaskMessage,
|
65
73
|
)
|
66
74
|
await producer.initialize(context)
|
nucliadb/ingest/app.py
CHANGED
@@ -214,6 +214,8 @@ def run_subscriber_workers() -> None: # pragma: no cover
|
|
214
214
|
- shard creator subscriber
|
215
215
|
- audit counter subscriber
|
216
216
|
- audit fields subscriber
|
217
|
+
- export/import subscriber
|
218
|
+
- materializer subscriber
|
217
219
|
"""
|
218
220
|
setup_configuration()
|
219
221
|
asyncio.run(main_subscriber_workers())
|
@@ -98,6 +98,9 @@ async def catalog_get(
|
|
98
98
|
SearchParamDefaults.range_modification_end
|
99
99
|
),
|
100
100
|
hidden: Optional[bool] = fastapi_query(SearchParamDefaults.hidden),
|
101
|
+
show: list[ResourceProperties] = fastapi_query(
|
102
|
+
SearchParamDefaults.show, default=[ResourceProperties.BASIC, ResourceProperties.ERRORS]
|
103
|
+
),
|
101
104
|
) -> Union[KnowledgeboxSearchResults, HTTPClientError]:
|
102
105
|
try:
|
103
106
|
expr = (
|
@@ -121,6 +124,7 @@ async def catalog_get(
|
|
121
124
|
range_modification_start=range_modification_start,
|
122
125
|
range_modification_end=range_modification_end,
|
123
126
|
hidden=hidden,
|
127
|
+
show=show,
|
124
128
|
)
|
125
129
|
if sort_field:
|
126
130
|
item.sort = SortOptions(field=sort_field, limit=sort_limit, order=sort_order)
|
@@ -169,7 +173,7 @@ async def catalog(
|
|
169
173
|
catalog_results.resources = await fetch_resources(
|
170
174
|
resources=[r.rid for r in catalog_results.fulltext.results],
|
171
175
|
kbid=kbid,
|
172
|
-
show=
|
176
|
+
show=item.show,
|
173
177
|
field_type_filter=list(FieldTypeName),
|
174
178
|
extracted=[],
|
175
179
|
)
|
nucliadb/tasks/__init__.py
CHANGED
@@ -17,6 +17,5 @@
|
|
17
17
|
# You should have received a copy of the GNU Affero General Public License
|
18
18
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
19
|
#
|
20
|
-
from .consumer import NatsTaskConsumer, create_consumer
|
21
|
-
from .producer import NatsTaskProducer, create_producer
|
22
|
-
from .registry import register_task # noqa
|
20
|
+
from .consumer import NatsTaskConsumer, create_consumer # noqa
|
21
|
+
from .producer import NatsTaskProducer, create_producer # noqa
|
nucliadb/tasks/consumer.py
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
#
|
20
20
|
|
21
21
|
import asyncio
|
22
|
-
from typing import Optional
|
22
|
+
from typing import Generic, Optional, Type
|
23
23
|
|
24
24
|
import nats
|
25
25
|
import pydantic
|
@@ -27,42 +27,41 @@ from nats.aio.client import Msg
|
|
27
27
|
|
28
28
|
from nucliadb.common.context import ApplicationContext
|
29
29
|
from nucliadb.tasks.logger import logger
|
30
|
-
from nucliadb.tasks.models import MsgType
|
31
|
-
from nucliadb.tasks.
|
32
|
-
from nucliadb.tasks.utils import TaskCallback, create_nats_stream_if_not_exists
|
30
|
+
from nucliadb.tasks.models import Callback, MsgType
|
31
|
+
from nucliadb.tasks.utils import create_nats_stream_if_not_exists
|
33
32
|
from nucliadb_telemetry import errors
|
34
|
-
from nucliadb_utils import const
|
35
33
|
from nucliadb_utils.nats import MessageProgressUpdater
|
36
34
|
from nucliadb_utils.settings import nats_consumer_settings
|
37
35
|
|
38
36
|
BEFORE_NAK_SLEEP_SECONDS = 2
|
39
37
|
|
40
38
|
|
41
|
-
class NatsTaskConsumer:
|
39
|
+
class NatsTaskConsumer(Generic[MsgType]):
|
42
40
|
def __init__(
|
43
41
|
self,
|
44
42
|
name: str,
|
45
|
-
stream:
|
46
|
-
|
47
|
-
|
43
|
+
stream: str,
|
44
|
+
stream_subjects: list[str],
|
45
|
+
consumer_subject: str,
|
46
|
+
callback: Callback,
|
47
|
+
msg_type: Type[MsgType],
|
48
48
|
max_concurrent_messages: Optional[int] = None,
|
49
49
|
):
|
50
50
|
self.name = name
|
51
51
|
self.stream = stream
|
52
|
+
self.stream_subjects = stream_subjects
|
53
|
+
self.consumer_subject = consumer_subject
|
52
54
|
self.callback = callback
|
53
55
|
self.msg_type = msg_type
|
54
56
|
self.max_concurrent_messages = max_concurrent_messages
|
55
57
|
self.initialized = False
|
56
|
-
self.context: Optional[ApplicationContext] = None
|
57
58
|
self.running_tasks: list[asyncio.Task] = []
|
58
59
|
self.subscription = None
|
59
60
|
|
60
61
|
async def initialize(self, context: ApplicationContext):
|
61
62
|
self.context = context
|
62
63
|
await create_nats_stream_if_not_exists(
|
63
|
-
self.
|
64
|
-
self.stream.name, # type: ignore
|
65
|
-
subjects=[self.stream.subject], # type: ignore
|
64
|
+
context, stream_name=self.stream, subjects=self.stream_subjects
|
66
65
|
)
|
67
66
|
await self._setup_nats_subscription()
|
68
67
|
self.initialized = True
|
@@ -81,9 +80,8 @@ class NatsTaskConsumer:
|
|
81
80
|
|
82
81
|
async def _setup_nats_subscription(self):
|
83
82
|
# Nats push consumer
|
84
|
-
|
85
|
-
group = self.
|
86
|
-
stream = self.stream.name
|
83
|
+
stream = self.stream
|
84
|
+
subject = group = self.consumer_subject
|
87
85
|
max_ack_pending = (
|
88
86
|
self.max_concurrent_messages
|
89
87
|
if self.max_concurrent_messages
|
@@ -146,7 +144,7 @@ class NatsTaskConsumer:
|
|
146
144
|
|
147
145
|
logger.info(f"Starting task consumption", extra={"consumer_name": self.name})
|
148
146
|
try:
|
149
|
-
await self.callback(self.context, task_msg)
|
147
|
+
await self.callback(self.context, task_msg)
|
150
148
|
except asyncio.CancelledError:
|
151
149
|
logger.debug(
|
152
150
|
f"Task cancelled. Naking and exiting...",
|
@@ -180,38 +178,23 @@ class NatsTaskConsumer:
|
|
180
178
|
|
181
179
|
def create_consumer(
|
182
180
|
name: str,
|
183
|
-
stream:
|
184
|
-
|
185
|
-
|
181
|
+
stream: str,
|
182
|
+
stream_subjects: list[str],
|
183
|
+
consumer_subject: str,
|
184
|
+
callback: Callback,
|
185
|
+
msg_type: Type[MsgType],
|
186
186
|
max_concurrent_messages: Optional[int] = None,
|
187
|
-
) -> NatsTaskConsumer:
|
187
|
+
) -> NatsTaskConsumer[MsgType]:
|
188
188
|
"""
|
189
189
|
Returns a non-initialized consumer
|
190
190
|
"""
|
191
191
|
consumer = NatsTaskConsumer(
|
192
192
|
name=name,
|
193
193
|
stream=stream,
|
194
|
+
stream_subjects=stream_subjects,
|
195
|
+
consumer_subject=consumer_subject,
|
194
196
|
callback=callback,
|
195
197
|
msg_type=msg_type,
|
196
198
|
max_concurrent_messages=max_concurrent_messages,
|
197
199
|
)
|
198
200
|
return consumer
|
199
|
-
|
200
|
-
|
201
|
-
async def start_consumer(task_name: str, context: ApplicationContext) -> NatsTaskConsumer:
|
202
|
-
"""
|
203
|
-
Returns an initialized consumer for the given task name, ready to consume messages from the task stream.
|
204
|
-
"""
|
205
|
-
try:
|
206
|
-
task = get_registered_task(task_name)
|
207
|
-
except KeyError:
|
208
|
-
raise ValueError(f"Task {task_name} not registered")
|
209
|
-
consumer = create_consumer(
|
210
|
-
name=f"{task_name}_consumer",
|
211
|
-
stream=task.stream,
|
212
|
-
callback=task.callback, # type: ignore
|
213
|
-
msg_type=task.msg_type,
|
214
|
-
max_concurrent_messages=task.max_concurrent_messages,
|
215
|
-
)
|
216
|
-
await consumer.initialize(context)
|
217
|
-
return consumer
|
nucliadb/tasks/models.py
CHANGED
@@ -17,23 +17,13 @@
|
|
17
17
|
# You should have received a copy of the GNU Affero General Public License
|
18
18
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
19
|
#
|
20
|
-
from
|
21
|
-
from typing import Any, Callable, Coroutine, Optional, Type
|
20
|
+
from typing import Any, Callable, Coroutine, TypeVar
|
22
21
|
|
23
22
|
import pydantic
|
24
23
|
|
25
24
|
from nucliadb.common.context import ApplicationContext
|
26
|
-
from nucliadb_utils import const
|
27
25
|
|
28
|
-
MsgType =
|
26
|
+
MsgType = TypeVar("MsgType", bound=pydantic.BaseModel)
|
29
27
|
|
30
28
|
# async def callback(context: ApplicationContext, msg: MyPydanticModel):
|
31
29
|
Callback = Callable[[ApplicationContext, MsgType], Coroutine[Any, Any, Any]]
|
32
|
-
|
33
|
-
|
34
|
-
@dataclass
|
35
|
-
class RegisteredTask:
|
36
|
-
stream: const.Streams
|
37
|
-
callback: Callback
|
38
|
-
msg_type: MsgType
|
39
|
-
max_concurrent_messages: Optional[int] = None
|
nucliadb/tasks/producer.py
CHANGED
@@ -17,26 +17,28 @@
|
|
17
17
|
# You should have received a copy of the GNU Affero General Public License
|
18
18
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
19
|
#
|
20
|
-
from typing import Optional
|
20
|
+
from typing import Generic, Optional, Type
|
21
21
|
|
22
22
|
from nucliadb.common.context import ApplicationContext
|
23
23
|
from nucliadb.tasks.logger import logger
|
24
24
|
from nucliadb.tasks.models import MsgType
|
25
|
-
from nucliadb.tasks.registry import get_registered_task
|
26
25
|
from nucliadb.tasks.utils import create_nats_stream_if_not_exists
|
27
26
|
from nucliadb_telemetry import errors
|
28
|
-
from nucliadb_utils import const
|
29
27
|
|
30
28
|
|
31
|
-
class NatsTaskProducer:
|
29
|
+
class NatsTaskProducer(Generic[MsgType]):
|
32
30
|
def __init__(
|
33
31
|
self,
|
34
32
|
name: str,
|
35
|
-
stream:
|
36
|
-
|
33
|
+
stream: str,
|
34
|
+
stream_subjects: list[str],
|
35
|
+
producer_subject: str,
|
36
|
+
msg_type: Type[MsgType],
|
37
37
|
):
|
38
38
|
self.name = name
|
39
39
|
self.stream = stream
|
40
|
+
self.stream_subjects = stream_subjects
|
41
|
+
self.producer_subject = producer_subject
|
40
42
|
self.msg_type = msg_type
|
41
43
|
self.context: Optional[ApplicationContext] = None
|
42
44
|
self.initialized = False
|
@@ -45,12 +47,12 @@ class NatsTaskProducer:
|
|
45
47
|
self.context = context
|
46
48
|
await create_nats_stream_if_not_exists(
|
47
49
|
self.context,
|
48
|
-
self.stream
|
49
|
-
subjects=
|
50
|
+
self.stream,
|
51
|
+
subjects=self.stream_subjects,
|
50
52
|
)
|
51
53
|
self.initialized = True
|
52
54
|
|
53
|
-
async def
|
55
|
+
async def send(self, msg: MsgType) -> int:
|
54
56
|
"""
|
55
57
|
Publish message to the producer's nats stream.
|
56
58
|
Returns the sequence number of the published message.
|
@@ -59,7 +61,7 @@ class NatsTaskProducer:
|
|
59
61
|
raise RuntimeError("NatsTaskProducer not initialized")
|
60
62
|
try:
|
61
63
|
pub_ack = await self.context.nats_manager.js.publish( # type: ignore
|
62
|
-
self.
|
64
|
+
self.producer_subject,
|
63
65
|
msg.model_dump_json().encode("utf-8"), # type: ignore
|
64
66
|
)
|
65
67
|
logger.info(
|
@@ -79,23 +81,19 @@ class NatsTaskProducer:
|
|
79
81
|
|
80
82
|
def create_producer(
|
81
83
|
name: str,
|
82
|
-
stream:
|
83
|
-
|
84
|
-
|
84
|
+
stream: str,
|
85
|
+
stream_subjects: list[str],
|
86
|
+
producer_subject: str,
|
87
|
+
msg_type: Type[MsgType],
|
88
|
+
) -> NatsTaskProducer[MsgType]:
|
85
89
|
"""
|
86
90
|
Returns a non-initialized producer.
|
87
91
|
"""
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
try:
|
96
|
-
task = get_registered_task(task_name)
|
97
|
-
except KeyError:
|
98
|
-
raise ValueError(f"Task {task_name} not registered")
|
99
|
-
producer = create_producer(name=f"{task_name}_producer", stream=task.stream, msg_type=task.msg_type)
|
100
|
-
await producer.initialize(context)
|
92
|
+
producer = NatsTaskProducer[MsgType](
|
93
|
+
name=name,
|
94
|
+
stream=stream,
|
95
|
+
stream_subjects=stream_subjects,
|
96
|
+
producer_subject=producer_subject,
|
97
|
+
msg_type=msg_type,
|
98
|
+
)
|
101
99
|
return producer
|
nucliadb/tasks/utils.py
CHANGED
@@ -18,15 +18,10 @@
|
|
18
18
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
19
|
#
|
20
20
|
|
21
|
-
from typing import Awaitable, Callable
|
22
|
-
|
23
21
|
import nats
|
24
|
-
from pydantic import BaseModel
|
25
22
|
|
26
23
|
from nucliadb.common.context import ApplicationContext
|
27
24
|
|
28
|
-
TaskCallback = Callable[[ApplicationContext, BaseModel], Awaitable[None]]
|
29
|
-
|
30
25
|
|
31
26
|
async def create_nats_stream_if_not_exists(
|
32
27
|
context: ApplicationContext, stream_name: str, subjects: list[str]
|
@@ -197,7 +197,7 @@ async def start_export_task(context: ApplicationContext, kbid: str, export_id: s
|
|
197
197
|
try:
|
198
198
|
producer = await get_exports_producer(context)
|
199
199
|
msg = NatsTaskMessage(kbid=kbid, id=export_id)
|
200
|
-
seqid = await producer(msg)
|
200
|
+
seqid = await producer.send(msg)
|
201
201
|
logger.info(f"Export task produced. seqid={seqid} kbid={kbid} export_id={export_id}")
|
202
202
|
except Exception as e:
|
203
203
|
errors.capture_exception(e)
|
@@ -214,7 +214,7 @@ async def start_import_task(context: ApplicationContext, kbid: str, import_id: s
|
|
214
214
|
try:
|
215
215
|
producer = await get_imports_producer(context)
|
216
216
|
msg = NatsTaskMessage(kbid=kbid, id=import_id)
|
217
|
-
seqid = await producer(msg)
|
217
|
+
seqid = await producer.send(msg)
|
218
218
|
logger.info(f"Import task produced. seqid={seqid} kbid={kbid} import_id={import_id}")
|
219
219
|
except Exception as e:
|
220
220
|
errors.capture_exception(e)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: nucliadb
|
3
|
-
Version: 6.3.1.
|
3
|
+
Version: 6.3.1.post3498
|
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.1.
|
24
|
-
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.3.1.
|
25
|
-
Requires-Dist: nucliadb-protos>=6.3.1.
|
26
|
-
Requires-Dist: nucliadb-models>=6.3.1.
|
27
|
-
Requires-Dist: nidx-protos>=6.3.1.
|
23
|
+
Requires-Dist: nucliadb-telemetry[all]>=6.3.1.post3498
|
24
|
+
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.3.1.post3498
|
25
|
+
Requires-Dist: nucliadb-protos>=6.3.1.post3498
|
26
|
+
Requires-Dist: nucliadb-models>=6.3.1.post3498
|
27
|
+
Requires-Dist: nidx-protos>=6.3.1.post3498
|
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
|
@@ -95,15 +95,15 @@ nucliadb/common/models_utils/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJ
|
|
95
95
|
nucliadb/common/models_utils/from_proto.py,sha256=d-q6-JWvjVVxtI57itQVKRIY8Hzv-tBhDt-tr4aIKNM,15979
|
96
96
|
nucliadb/common/models_utils/to_proto.py,sha256=97JvOR_3odu50YvzLa2CERfEN3w_QPmAVcCJwJB5m5A,2438
|
97
97
|
nucliadb/export_import/__init__.py,sha256=y-Is0Bxa8TMV6UiOW0deC_D3U465P65CQ5RjBjIWnow,932
|
98
|
-
nucliadb/export_import/datamanager.py,sha256=
|
98
|
+
nucliadb/export_import/datamanager.py,sha256=xL8b0xvk45q6wx1l7J32JgPmpyjnF6fKiJi2F2B_UQY,6968
|
99
99
|
nucliadb/export_import/exceptions.py,sha256=Dw8WqfG4r6MPJc5TPfbjMvCgXXWTcTOecGHRVU1h3kM,1949
|
100
|
-
nucliadb/export_import/exporter.py,sha256=
|
100
|
+
nucliadb/export_import/exporter.py,sha256=k2QVx1EjqFlDYiggriWiEJzwtMXzHbldsqWdpGQM3_U,7074
|
101
101
|
nucliadb/export_import/importer.py,sha256=v5cq9Nn8c2zrY_K_00mydR52f8mdFxR7tLdtNLQ0qvk,4229
|
102
102
|
nucliadb/export_import/models.py,sha256=dbjScNkiMRv4X3Ktudy1JRliD25bfoDTy3JmEZgQSCc,2121
|
103
|
-
nucliadb/export_import/tasks.py,sha256=
|
103
|
+
nucliadb/export_import/tasks.py,sha256=yPNdBdvTD7eGc7zvV9Rp7UZ0-mDhA34OOsLqHvns_v0,2975
|
104
104
|
nucliadb/export_import/utils.py,sha256=t7xLA3f5W3zGq3HNXe3noOQnY7gRO8TAoe8S8BG3_so,19733
|
105
105
|
nucliadb/ingest/__init__.py,sha256=fsw3C38VP50km3R-nHL775LNGPpJ4JxqXJ2Ib1f5SqE,1011
|
106
|
-
nucliadb/ingest/app.py,sha256=
|
106
|
+
nucliadb/ingest/app.py,sha256=ErNd3q44xbBcUOl-Ae_lvcKPAsfFMSzb8zqWAjekrM4,7097
|
107
107
|
nucliadb/ingest/cache.py,sha256=w7jMMzamOmQ7gwXna6Dqm6isRNBVv6l5BTBlTxaYWjE,1005
|
108
108
|
nucliadb/ingest/partitions.py,sha256=2NIhMYbNT0TNBL6bX1UMSi7vxFGICstCKEqsB0TXHOE,2410
|
109
109
|
nucliadb/ingest/processing.py,sha256=gg1DqbMFwqdOsmCSGsZc2abRdYz86xOZJun9vrHOCzs,20618
|
@@ -192,7 +192,7 @@ nucliadb/search/utilities.py,sha256=9SsRDw0rJVXVoLBfF7rBb6q080h-thZc7u8uRcTiBeY,
|
|
192
192
|
nucliadb/search/api/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
|
193
193
|
nucliadb/search/api/v1/__init__.py,sha256=8w6VhZ5rbzX1xLSXr336d2IE-O0dQiv-ba6UYdRKnHA,1325
|
194
194
|
nucliadb/search/api/v1/ask.py,sha256=F2dR3-swb3Xz8MfZPYL3G65KY2R_mgef4YVBbu8kLi4,4352
|
195
|
-
nucliadb/search/api/v1/catalog.py,sha256=
|
195
|
+
nucliadb/search/api/v1/catalog.py,sha256=IyBkq99CND1kFelsedJiQaSD8GOPGBJpcKuw1Z6jB9E,7709
|
196
196
|
nucliadb/search/api/v1/feedback.py,sha256=kNLc4dHz2SXHzV0PwC1WiRAwY88fDptPcP-kO0q-FrQ,2620
|
197
197
|
nucliadb/search/api/v1/find.py,sha256=l2dRg0eYngq52vyn9_z9iK7bdO7ufHQDnJWBZgMVrqY,9628
|
198
198
|
nucliadb/search/api/v1/knowledgebox.py,sha256=rWhx3PYWryingu19qwwFDbVvVYynq5Ky23FSlzmTutQ,8721
|
@@ -260,13 +260,12 @@ nucliadb/standalone/versions.py,sha256=8CxNMNt2NgWM8ct50UsR4d44-ae7wtQI-sV-yGiFq
|
|
260
260
|
nucliadb/standalone/static/favicon.ico,sha256=96pKGp6Sx457JkTfjy1dtApMhkitixfU6invCUGAYOU,2285
|
261
261
|
nucliadb/standalone/static/index.html,sha256=PEZfuEQFYnYACAL1ceN8xC0im8lBrUx838RkE8tbvgA,3833
|
262
262
|
nucliadb/standalone/static/logo.svg,sha256=-wQqSvPGTdlKjUP6pHE6kiq005pgYjDzp9nPl0X71Mk,2639
|
263
|
-
nucliadb/tasks/__init__.py,sha256=
|
264
|
-
nucliadb/tasks/consumer.py,sha256=
|
263
|
+
nucliadb/tasks/__init__.py,sha256=vruCOMmCu0BcAZQrEinlgiQtiR1WYxSxvI5UsydAopc,963
|
264
|
+
nucliadb/tasks/consumer.py,sha256=x-999Nsw6lBcKvyGyCGPiGP_naANVYMfl9M-u0U3mhY,7052
|
265
265
|
nucliadb/tasks/logger.py,sha256=C7keOEO_mjLVp5VbqAZ2QXfqVB2Hot7NgBlUP_SDSMw,924
|
266
|
-
nucliadb/tasks/models.py,sha256=
|
267
|
-
nucliadb/tasks/producer.py,sha256=
|
268
|
-
nucliadb/tasks/
|
269
|
-
nucliadb/tasks/utils.py,sha256=abXcE_bjAkO4UwrKXhZykFPsRwbtwnuc0reNWhYImjw,1360
|
266
|
+
nucliadb/tasks/models.py,sha256=qrZKi5DNDQ07waMsp5L4_Fi7WRs57YiO-kmXlrBzEAA,1168
|
267
|
+
nucliadb/tasks/producer.py,sha256=w4R1YXgXtmCPGcoNNOr3qkqJYcHJtSmix-xjt7vsPqk,3261
|
268
|
+
nucliadb/tasks/utils.py,sha256=6tQVckqyzxv8PhVAd3ZqcMYpGcn73ZY6p1cpm1FxagA,1214
|
270
269
|
nucliadb/tests/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
|
271
270
|
nucliadb/tests/config.py,sha256=JN_Jhgj-fwM9_8IeO9pwxr6C1PiwRDrXxm67Y38rU30,2080
|
272
271
|
nucliadb/tests/vectors.py,sha256=CcNKx-E8LPpyvRyljbmb-Tn_wST9Juw2CBoogWrKiTk,62843
|
@@ -315,7 +314,7 @@ nucliadb/writer/api/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20
|
|
315
314
|
nucliadb/writer/api/constants.py,sha256=qWEDjFUycrEZnSJyLnNK4PQNodU2oVmkO4NycaEZtio,1738
|
316
315
|
nucliadb/writer/api/utils.py,sha256=wIQHlU8RQiIGVLI72suvyVIKlCU44Unh0Ae0IiN6Qwo,1313
|
317
316
|
nucliadb/writer/api/v1/__init__.py,sha256=akI9A_jloNLb0dU4T5zjfdyvmSAiDeIdjAlzNx74FlU,1128
|
318
|
-
nucliadb/writer/api/v1/export_import.py,sha256=
|
317
|
+
nucliadb/writer/api/v1/export_import.py,sha256=FxGY_rofj3AH-HQReoMDOYfEpACeWB5bsmxrT03QUtQ,8227
|
319
318
|
nucliadb/writer/api/v1/field.py,sha256=OsWOYA0WQ6onE5Rkl20QIEdtrSi7Jgnu62fUt90Ziy8,17503
|
320
319
|
nucliadb/writer/api/v1/knowledgebox.py,sha256=MLeIuym4jPrJgfy1NTcN9CpUGwuBiqDHMcx0hY9DR7g,9530
|
321
320
|
nucliadb/writer/api/v1/learning_config.py,sha256=CKBjqcbewkfPwGUPLDWzZSpro6XkmCaVppe5Qtpu5Go,3117
|
@@ -340,8 +339,8 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
|
|
340
339
|
nucliadb/writer/tus/s3.py,sha256=vF0NkFTXiXhXq3bCVXXVV-ED38ECVoUeeYViP8uMqcU,8357
|
341
340
|
nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
|
342
341
|
nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
|
343
|
-
nucliadb-6.3.1.
|
344
|
-
nucliadb-6.3.1.
|
345
|
-
nucliadb-6.3.1.
|
346
|
-
nucliadb-6.3.1.
|
347
|
-
nucliadb-6.3.1.
|
342
|
+
nucliadb-6.3.1.post3498.dist-info/METADATA,sha256=Klk4uOzMdNOlGiYiw_96v0_aVFKbjJMSDpKXOfEcRFU,4291
|
343
|
+
nucliadb-6.3.1.post3498.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
344
|
+
nucliadb-6.3.1.post3498.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
|
345
|
+
nucliadb-6.3.1.post3498.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
|
346
|
+
nucliadb-6.3.1.post3498.dist-info/RECORD,,
|
nucliadb/tasks/registry.py
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
# Copyright (C) 2021 Bosutech XXI S.L.
|
2
|
-
#
|
3
|
-
# nucliadb is offered under the AGPL v3.0 and as commercial software.
|
4
|
-
# For commercial licensing, contact us at info@nuclia.com.
|
5
|
-
#
|
6
|
-
# AGPL:
|
7
|
-
# This program is free software: you can redistribute it and/or modify
|
8
|
-
# it under the terms of the GNU Affero General Public License as
|
9
|
-
# published by the Free Software Foundation, either version 3 of the
|
10
|
-
# License, or (at your option) any later version.
|
11
|
-
#
|
12
|
-
# This program is distributed in the hope that it will be useful,
|
13
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
-
# GNU Affero General Public License for more details.
|
16
|
-
#
|
17
|
-
# You should have received a copy of the GNU Affero General Public License
|
18
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
|
-
#
|
20
|
-
import functools
|
21
|
-
from typing import Optional
|
22
|
-
|
23
|
-
import pydantic
|
24
|
-
|
25
|
-
from nucliadb.tasks.models import RegisteredTask
|
26
|
-
from nucliadb_utils import const
|
27
|
-
|
28
|
-
REGISTRY: dict[str, RegisteredTask] = dict()
|
29
|
-
|
30
|
-
|
31
|
-
def register_task(
|
32
|
-
name: str,
|
33
|
-
stream: const.Streams,
|
34
|
-
msg_type: pydantic.BaseModel,
|
35
|
-
max_concurrent_messages: Optional[int] = None,
|
36
|
-
):
|
37
|
-
"""
|
38
|
-
Decorator to register a task in the registry.
|
39
|
-
"""
|
40
|
-
|
41
|
-
def decorator_register(func):
|
42
|
-
REGISTRY[name] = RegisteredTask(
|
43
|
-
callback=func,
|
44
|
-
stream=stream,
|
45
|
-
msg_type=msg_type,
|
46
|
-
max_concurrent_messages=max_concurrent_messages,
|
47
|
-
)
|
48
|
-
|
49
|
-
@functools.wraps(func)
|
50
|
-
async def wrapper_register(*args, **kwargs):
|
51
|
-
return await func(*args, **kwargs)
|
52
|
-
|
53
|
-
return wrapper_register
|
54
|
-
|
55
|
-
return decorator_register
|
56
|
-
|
57
|
-
|
58
|
-
def get_registered_task(name: str) -> RegisteredTask:
|
59
|
-
return REGISTRY[name]
|
File without changes
|
File without changes
|
File without changes
|