nucliadb-utils 6.2.1.post3332__py3-none-any.whl → 6.2.1.post3365__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-utils might be problematic. Click here for more details.

nucliadb_utils/const.py CHANGED
@@ -42,15 +42,6 @@ class Streams:
42
42
  subject = "ndb.consumer.processed"
43
43
  group = "nucliadb-pull-processed"
44
44
 
45
- class INDEX:
46
- """
47
- Indexing resources on the IndexNode
48
- """
49
-
50
- name = "node"
51
- subject = "node.{node}"
52
- group = "node-{node}"
53
-
54
45
  class KB_EXPORTS:
55
46
  """
56
47
  Exporting kbs
@@ -38,13 +38,11 @@ from nucliadb_utils.cache.settings import settings as cache_settings
38
38
  from nucliadb_utils.encryption import EndecryptorUtility
39
39
  from nucliadb_utils.encryption.settings import settings as encryption_settings
40
40
  from nucliadb_utils.exceptions import ConfigurationError
41
- from nucliadb_utils.indexing import IndexingUtility
42
41
  from nucliadb_utils.nats import NatsConnectionManager
43
42
  from nucliadb_utils.partition import PartitionUtility
44
43
  from nucliadb_utils.settings import (
45
44
  FileBackendConfig,
46
45
  audit_settings,
47
- indexing_settings,
48
46
  nuclia_settings,
49
47
  storage_settings,
50
48
  transaction_settings,
@@ -71,7 +69,6 @@ class Utility(str, Enum):
71
69
  SHARD_MANAGER = "shard_manager"
72
70
  COUNTER = "counter"
73
71
  PUBSUB = "pubsub"
74
- INDEXING = "indexing"
75
72
  AUDIT = "audit"
76
73
  STORAGE = "storage"
77
74
  TRAIN = "train"
@@ -311,27 +308,6 @@ async def stop_transaction_utility() -> None:
311
308
  clean_utility(Utility.TRANSACTION)
312
309
 
313
310
 
314
- async def start_indexing_utility(service_name: Optional[str] = None) -> IndexingUtility:
315
- indexing_utility = IndexingUtility(
316
- nats_creds=indexing_settings.index_jetstream_auth,
317
- nats_servers=indexing_settings.index_jetstream_servers,
318
- )
319
- await indexing_utility.initialize(service_name)
320
- set_utility(Utility.INDEXING, indexing_utility)
321
- return indexing_utility
322
-
323
-
324
- async def stop_indexing_utility():
325
- indexing_utility = get_indexing()
326
- if indexing_utility:
327
- clean_utility(Utility.INDEXING)
328
- await indexing_utility.finalize()
329
-
330
-
331
- def get_indexing() -> IndexingUtility:
332
- return get_utility(Utility.INDEXING)
333
-
334
-
335
311
  def get_audit() -> Optional[AuditStorage]:
336
312
  return get_utility(Utility.AUDIT)
337
313
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nucliadb_utils
3
- Version: 6.2.1.post3332
3
+ Version: 6.2.1.post3365
4
4
  Summary: NucliaDB util library
5
5
  Author-email: Nuclia <nucliadb@nuclia.com>
6
6
  License: AGPL
@@ -27,8 +27,8 @@ Requires-Dist: nats-py[nkeys]>=2.6.0
27
27
  Requires-Dist: PyNaCl
28
28
  Requires-Dist: pyjwt>=2.4.0
29
29
  Requires-Dist: mrflagly>=0.2.9
30
- Requires-Dist: nucliadb-protos>=6.2.1.post3332
31
- Requires-Dist: nucliadb-telemetry>=6.2.1.post3332
30
+ Requires-Dist: nucliadb-protos>=6.2.1.post3365
31
+ Requires-Dist: nucliadb-telemetry>=6.2.1.post3365
32
32
  Provides-Extra: cache
33
33
  Requires-Dist: redis>=4.3.4; extra == "cache"
34
34
  Requires-Dist: orjson>=3.6.7; extra == "cache"
@@ -1,13 +1,12 @@
1
1
  nucliadb_utils/__init__.py,sha256=EvBCH1iTODe-AgXm48aj4kVUt_Std3PeL8QnwimR5wI,895
2
2
  nucliadb_utils/asyncio_utils.py,sha256=h8Y-xpcFFRgNzaiIW0eidz7griAQa7ggbNk34-tAt2c,2888
3
3
  nucliadb_utils/authentication.py,sha256=5_b323v2ylJaJvM_0coeSQEtnD-p9IGD-6CPA6IXhik,6471
4
- nucliadb_utils/const.py,sha256=fA8NLObuow6ZyXHEDzl3kordTVyhNWHOdtvzK0oUaJU,2174
4
+ nucliadb_utils/const.py,sha256=EY6xda1FWf9sHjY6T6fzRE7TAh0QGGDQwgwxN-4knS0,2003
5
5
  nucliadb_utils/debug.py,sha256=Q56Nx9Dp7V2ae3CU2H0ztaZcHTJXdlflPLKLeOPZ170,2436
6
6
  nucliadb_utils/exceptions.py,sha256=y_3wk77WLVUtdo-5FtbBsdSkCtK_DsJkdWb5BoPn3qo,1094
7
7
  nucliadb_utils/featureflagging.py,sha256=YxDiXzWuiDlHtqgeTVeyakmbAdzBePzJpgJv53ELbmI,2259
8
8
  nucliadb_utils/grpc.py,sha256=apu0uePnkGHCAT7GRQ9YZfRYyFj26kJ440i8jitbM3U,3314
9
9
  nucliadb_utils/helpers.py,sha256=nPw8yod3hP-pxq80VF8QC36s7ygSg0dBUdfI-LatvCs,1600
10
- nucliadb_utils/indexing.py,sha256=Luaqcar3CySpdYOFp6Q9Fyr8ZYwhYhaKRHQ_VGL78f8,2318
11
10
  nucliadb_utils/nats.py,sha256=99YJkK1QMfWDxKJK8u0acK0lLYb8yThalzulGETiT80,15266
12
11
  nucliadb_utils/partition.py,sha256=jBgy4Hu5Iwn4gjbPPcthSykwf-qNx-GcLAIwbzPd1d0,1157
13
12
  nucliadb_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -16,7 +15,7 @@ nucliadb_utils/settings.py,sha256=RnGhEUvwv6faNqALiqDCivvzNOyyXVBflYh_37uNkow,81
16
15
  nucliadb_utils/signals.py,sha256=JRNv2y9zLtBjOANBf7krGfDGfOc9qcoXZ6N1nKWS2FE,2674
17
16
  nucliadb_utils/store.py,sha256=kQ35HemE0v4_Qg6xVqNIJi8vSFAYQtwI3rDtMsNy62Y,890
18
17
  nucliadb_utils/transaction.py,sha256=YYnTpxCDs56lo0tS6ErABjk9WjDuieUc4f7r63Q_OP8,7864
19
- nucliadb_utils/utilities.py,sha256=_5pNsXBknULGrTvV4hgIjsOJ0sSbFq4ygseH89C1gdk,16128
18
+ nucliadb_utils/utilities.py,sha256=usyqgkfinZeDoUSFpIugmKKJZpoi8wppFL_lAhhlkBI,15371
20
19
  nucliadb_utils/aiopynecone/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
21
20
  nucliadb_utils/aiopynecone/client.py,sha256=MPyHnDXwhukJr7U3CJh7BpsekfSuOkyM4g5b9LLtzc8,22941
22
21
  nucliadb_utils/aiopynecone/exceptions.py,sha256=fUErx3ceKQK1MUbOnYcZhIzpNe8UVAptZE9JIRDLXDE,4000
@@ -55,11 +54,10 @@ nucliadb_utils/tests/asyncbenchmark.py,sha256=vrX_x9ifCXi18PfNShc23w9x_VUiB_Ph-2
55
54
  nucliadb_utils/tests/azure.py,sha256=Dg-Eb4KVScG-O6P9y-bVQZTAKTNUMQ0i-CKEd9IdrWw,4474
56
55
  nucliadb_utils/tests/fixtures.py,sha256=i0sqPqe5a5JlKGFdaIvOlHYkZ3pHZ2hTIgTsaIB3vSM,3472
57
56
  nucliadb_utils/tests/gcs.py,sha256=KW_DLet1WRlssSW55eI-IQ-0d94Jo2Oh7Di4xGv4JCc,4685
58
- nucliadb_utils/tests/indexing.py,sha256=YW2QhkhO9Q_8A4kKWJaWSvXvyQ_AiAwY1VylcfVQFxk,1513
59
57
  nucliadb_utils/tests/local.py,sha256=fXIBasrvdaFJM-sw2wk1_oiFzBcm9O10iCyC-OiXwY8,1914
60
58
  nucliadb_utils/tests/nats.py,sha256=RWHjwqq5esuO7OFbP24yYX1cXnpPLcWJwDUdmwCpH28,1897
61
59
  nucliadb_utils/tests/s3.py,sha256=pl-RJFjA4MH6iXkqhsh5g8gDuEhrYu1nPZ-laxlrMlE,3704
62
- nucliadb_utils-6.2.1.post3332.dist-info/METADATA,sha256=1T46aO8cM9AjK2EfPwIRXDU72v29GrKKaDA-s99aknQ,2209
63
- nucliadb_utils-6.2.1.post3332.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
64
- nucliadb_utils-6.2.1.post3332.dist-info/top_level.txt,sha256=fE3vJtALTfgh7bcAWcNhcfXkNPp_eVVpbKK-2IYua3E,15
65
- nucliadb_utils-6.2.1.post3332.dist-info/RECORD,,
60
+ nucliadb_utils-6.2.1.post3365.dist-info/METADATA,sha256=h6lDRLvl5X4k93TMf8DEcdbMbuASJ4Bx6O1-4_Czvjo,2209
61
+ nucliadb_utils-6.2.1.post3365.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
62
+ nucliadb_utils-6.2.1.post3365.dist-info/top_level.txt,sha256=fE3vJtALTfgh7bcAWcNhcfXkNPp_eVVpbKK-2IYua3E,15
63
+ nucliadb_utils-6.2.1.post3365.dist-info/RECORD,,
@@ -1,64 +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
- from typing import List, Optional, Tuple
21
-
22
- from nucliadb_protos.nodewriter_pb2 import IndexMessage
23
- from nucliadb_utils import const, logger
24
- from nucliadb_utils.nats import NatsConnectionManager
25
-
26
-
27
- class IndexingUtility:
28
- def __init__(
29
- self,
30
- nats_servers: List[str],
31
- nats_creds: Optional[str] = None,
32
- dummy: bool = False,
33
- ):
34
- self.dummy = dummy
35
- if dummy:
36
- self._calls: List[Tuple[str, IndexMessage]] = []
37
- else:
38
- self.nats_connection_manager = NatsConnectionManager(
39
- service_name="IndexingUtility",
40
- nats_servers=nats_servers,
41
- nats_creds=nats_creds,
42
- )
43
-
44
- async def initialize(self, service_name: Optional[str] = None):
45
- if self.dummy:
46
- return
47
- await self.nats_connection_manager.initialize()
48
-
49
- async def finalize(self):
50
- if self.dummy:
51
- return
52
- await self.nats_connection_manager.finalize()
53
-
54
- async def index(self, writer: IndexMessage, node: str) -> int:
55
- if self.dummy:
56
- self._calls.append((node, writer))
57
- return 0
58
-
59
- subject = const.Streams.INDEX.subject.format(node=node)
60
- res = await self.nats_connection_manager.js.publish(subject, writer.SerializeToString())
61
- logger.info(
62
- f" - Pushed message to index {subject}. shard: {writer.shard}, txid: {writer.txid} seqid: {res.seq}" # noqa
63
- )
64
- return res.seq
@@ -1,38 +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 pytest
21
-
22
- from nucliadb_utils.indexing import IndexingUtility
23
- from nucliadb_utils.settings import indexing_settings
24
- from nucliadb_utils.utilities import Utility, clean_utility, get_utility, set_utility
25
-
26
-
27
- @pytest.fixture(scope="function")
28
- async def indexing_utility_registered(): # pragma: no cover
29
- indexing_util = IndexingUtility(
30
- nats_creds=indexing_settings.index_jetstream_auth,
31
- nats_servers=indexing_settings.index_jetstream_servers,
32
- )
33
- await indexing_util.initialize()
34
- set_utility(Utility.INDEXING, indexing_util)
35
- yield
36
- await indexing_util.finalize()
37
- if get_utility(Utility.INDEXING):
38
- clean_utility(Utility.INDEXING)