nucliadb 6.3.1.post3544__py3-none-any.whl → 6.3.1.post3549__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.
@@ -28,9 +28,6 @@ create new shards in the remaining nodes.
28
28
 
29
29
  import logging
30
30
 
31
- from nucliadb.common import datamanagers
32
- from nucliadb.common.cluster.rollover import rollover_kb_index
33
- from nucliadb.common.cluster.settings import settings as cluster_settings
34
31
  from nucliadb.migrator.context import ExecutionContext
35
32
 
36
33
  logger = logging.getLogger(__name__)
@@ -39,45 +36,4 @@ logger = logging.getLogger(__name__)
39
36
  async def migrate(context: ExecutionContext) -> None: ...
40
37
 
41
38
 
42
- async def migrate_kb(context: ExecutionContext, kbid: str) -> None:
43
- """
44
- Rollover KB shards if any of the shards are on the nodes to drain
45
- """
46
- drain_node_ids = cluster_settings.drain_nodes
47
- if len(drain_node_ids) == 0:
48
- logger.info("Skipping migration because no drain_nodes are set")
49
- return
50
-
51
- if not await kb_has_shards_on_drain_nodes(kbid, drain_node_ids):
52
- logger.info(
53
- "KB does not have shards on the nodes to drain, skipping rollover",
54
- extra={"kbid": kbid},
55
- )
56
- return
57
-
58
- logger.info("Rolling over affected KB", extra={"kbid": kbid})
59
- await rollover_kb_index(context, kbid, drain_nodes=drain_node_ids)
60
-
61
-
62
- async def kb_has_shards_on_drain_nodes(kbid: str, drain_node_ids: list[str]) -> bool:
63
- async with datamanagers.with_ro_transaction() as txn:
64
- shards = await datamanagers.cluster.get_kb_shards(txn, kbid=kbid)
65
- if not shards:
66
- logger.warning("Shards object not found", extra={"kbid": kbid})
67
- return False
68
- shard_in_drain_nodes = False
69
- for shard in shards.shards:
70
- for replica in shard.replicas:
71
- if replica.node in drain_node_ids:
72
- logger.info(
73
- "Shard found in drain nodes, will rollover it",
74
- extra={
75
- "kbid": kbid,
76
- "logical_shard": shard.shard,
77
- "replica_shard_id": replica.shard.id,
78
- "node": replica.node,
79
- "drain_node_ids": drain_node_ids,
80
- },
81
- )
82
- shard_in_drain_nodes = True
83
- return shard_in_drain_nodes
39
+ async def migrate_kb(context: ExecutionContext, kbid: str) -> None: ...
@@ -46,7 +46,7 @@ from nucliadb_utils.utilities import get_audit
46
46
 
47
47
 
48
48
  async def backup_kb_task(context: ApplicationContext, msg: CreateBackupRequest):
49
- kbid = msg.kbid
49
+ kbid = msg.kb_id
50
50
  backup_id = msg.backup_id
51
51
 
52
52
  retry_handler = TaskRetryHandler(
@@ -79,7 +79,7 @@ async def backup_resources(context: ApplicationContext, kbid: str, backup_id: st
79
79
  metadata = await get_metadata(context, kbid, backup_id)
80
80
  if metadata is None:
81
81
  metadata = BackupMetadata(
82
- kbid=kbid,
82
+ kb_id=kbid,
83
83
  requested_at=datetime.now(tz=timezone.utc),
84
84
  )
85
85
  async for rid in datamanagers.resources.iterate_resource_ids(kbid=kbid):
@@ -23,12 +23,12 @@ from pydantic import BaseModel
23
23
 
24
24
 
25
25
  class CreateBackupRequest(BaseModel):
26
- kbid: str
26
+ kb_id: str
27
27
  backup_id: str
28
28
 
29
29
 
30
30
  class RestoreBackupRequest(BaseModel):
31
- kbid: str
31
+ kb_id: str
32
32
  backup_id: str
33
33
 
34
34
 
@@ -37,7 +37,7 @@ class DeleteBackupRequest(BaseModel):
37
37
 
38
38
 
39
39
  class BackupMetadata(BaseModel):
40
- kbid: str
40
+ kb_id: str
41
41
  requested_at: datetime
42
42
  total_resources: int = 0
43
43
  missing_resources: list[str] = []
@@ -41,7 +41,7 @@ from nucliadb_protos.writer_pb2 import BrokerMessage
41
41
 
42
42
 
43
43
  async def restore_kb_task(context: ApplicationContext, msg: RestoreBackupRequest):
44
- kbid = msg.kbid
44
+ kbid = msg.kb_id
45
45
  backup_id = msg.backup_id
46
46
 
47
47
  retry_handler = TaskRetryHandler(
nucliadb/backups/tasks.py CHANGED
@@ -52,7 +52,7 @@ async def create(kbid: str, backup_id: str) -> None:
52
52
  msg_type=CreateBackupRequest,
53
53
  )
54
54
  msg = CreateBackupRequest(
55
- kbid=kbid,
55
+ kb_id=kbid,
56
56
  backup_id=backup_id,
57
57
  )
58
58
  await producer.send(msg)
@@ -80,7 +80,7 @@ async def restore(kbid: str, backup_id: str) -> None:
80
80
  msg_type=RestoreBackupRequest,
81
81
  )
82
82
  msg = RestoreBackupRequest(
83
- kbid=kbid,
83
+ kb_id=kbid,
84
84
  backup_id=backup_id,
85
85
  )
86
86
  await producer.send(msg)
@@ -24,12 +24,6 @@ from pydantic import Field
24
24
  from pydantic_settings import BaseSettings
25
25
 
26
26
 
27
- class ClusterDiscoveryMode(str, enum.Enum):
28
- MANUAL = "manual"
29
- KUBERNETES = "kubernetes"
30
- SINGLE_NODE = "single_node"
31
-
32
-
33
27
  class StandaloneNodeRole(enum.Enum):
34
28
  ALL = "all"
35
29
  INDEX = "index"
@@ -39,53 +33,20 @@ class StandaloneNodeRole(enum.Enum):
39
33
  class Settings(BaseSettings):
40
34
  data_path: str = "./data/node"
41
35
  standalone_mode: bool = False
42
- standalone_node_port: int = Field(
43
- default=10009,
44
- title="Standalone node port",
45
- description="Port to use for standalone nodes to communication with each other through",
46
- )
47
36
  standalone_node_role: StandaloneNodeRole = StandaloneNodeRole.ALL
48
37
 
49
- node_replicas: int = 2
50
-
51
- node_writer_port: int = 10000
52
- node_reader_port: int = 10001
53
-
54
- # Only for testing purposes
55
- writer_port_map: dict[str, int] = {}
56
- reader_port_map: dict[str, int] = {}
57
-
58
- # Node limits
38
+ # Index limits
59
39
  max_shard_paragraphs: int = Field(
60
40
  default=500_000,
61
41
  title="Max shard paragraphs",
62
42
  description="Maximum number of paragraphs to target per shard",
63
43
  )
64
- max_node_replicas: int = Field(
65
- default=800,
66
- title="Max node replicas",
67
- description="Maximum number of shard replicas a single node will manage",
68
- )
69
44
  max_resource_paragraphs: int = Field(
70
45
  default=50_000,
71
46
  title="Max paragraphs per resource",
72
47
  description="Maximum number of paragraphs allowed on a single resource",
73
48
  )
74
49
 
75
- drain_nodes: list[str] = Field(
76
- default=[],
77
- title="Drain nodes",
78
- description="List of node IDs to ignore when creating new shards. It is used for draining nodes from a cluster. Example: ['1bf3bfe7-e164-4a19-a4d9-41372fc15aca',]", # noqa: E501
79
- )
80
-
81
- local_reader_threads: int = 5
82
- local_writer_threads: int = 5
83
-
84
- cluster_discovery_mode: ClusterDiscoveryMode = ClusterDiscoveryMode.KUBERNETES
85
- cluster_discovery_kubernetes_namespace: str = "nucliadb"
86
- cluster_discovery_kubernetes_selector: str = "appType=node"
87
- cluster_discovery_manual_addresses: list[str] = []
88
-
89
50
  nidx_api_address: Optional[str] = Field(default=None, description="NIDX gRPC API address")
90
51
  nidx_searcher_address: Optional[str] = Field(
91
52
  default=None, description="NIDX gRPC searcher API address"
@@ -473,11 +473,11 @@ class WriterServicer(writer_pb2_grpc.WriterServicer):
473
473
  async def CreateBackup(
474
474
  self, request: backups_pb2.CreateBackupRequest, context=None
475
475
  ) -> backups_pb2.CreateBackupResponse:
476
- if not await exists_kb(request.kbid):
476
+ if not await exists_kb(request.kb_id):
477
477
  return backups_pb2.CreateBackupResponse(
478
478
  status=backups_pb2.CreateBackupResponse.Status.KB_NOT_FOUND
479
479
  )
480
- await backup_tasks.create(request.kbid, request.backup_id)
480
+ await backup_tasks.create(request.kb_id, request.backup_id)
481
481
  return backups_pb2.CreateBackupResponse(status=backups_pb2.CreateBackupResponse.Status.OK)
482
482
 
483
483
  async def DeleteBackup(
@@ -493,7 +493,7 @@ class WriterServicer(writer_pb2_grpc.WriterServicer):
493
493
  async def RestoreBackup(
494
494
  self, request: backups_pb2.RestoreBackupRequest, context=None
495
495
  ) -> backups_pb2.RestoreBackupResponse:
496
- if not await exists_kb(request.kbid):
496
+ if not await exists_kb(request.kb_id):
497
497
  return backups_pb2.RestoreBackupResponse(
498
498
  status=backups_pb2.RestoreBackupResponse.Status.NOT_FOUND
499
499
  )
@@ -501,7 +501,7 @@ class WriterServicer(writer_pb2_grpc.WriterServicer):
501
501
  return backups_pb2.RestoreBackupResponse(
502
502
  status=backups_pb2.RestoreBackupResponse.Status.NOT_FOUND
503
503
  )
504
- await backup_tasks.restore(request.kbid, request.backup_id)
504
+ await backup_tasks.restore(request.kb_id, request.backup_id)
505
505
  return backups_pb2.RestoreBackupResponse(status=backups_pb2.RestoreBackupResponse.Status.OK)
506
506
 
507
507
 
@@ -22,7 +22,7 @@ import logging
22
22
  import os
23
23
 
24
24
  from nucliadb.common.cluster.settings import StandaloneNodeRole
25
- from nucliadb.standalone.settings import Settings, StandaloneDiscoveryMode
25
+ from nucliadb.standalone.settings import Settings
26
26
 
27
27
  logger = logging.getLogger(__name__)
28
28
 
@@ -76,7 +76,6 @@ def config_nucliadb(nucliadb_args: Settings):
76
76
  use some specific settings.
77
77
  """
78
78
 
79
- from nucliadb.common.cluster.settings import ClusterDiscoveryMode
80
79
  from nucliadb.common.cluster.settings import settings as cluster_settings
81
80
  from nucliadb.ingest.settings import settings as ingest_settings
82
81
  from nucliadb.train.settings import settings as train_settings
@@ -91,14 +90,8 @@ def config_nucliadb(nucliadb_args: Settings):
91
90
 
92
91
  cluster_settings.standalone_mode = True
93
92
  cluster_settings.data_path = nucliadb_args.data_path
94
- cluster_settings.standalone_node_port = nucliadb_args.standalone_node_port
95
93
  cluster_settings.standalone_node_role = nucliadb_args.standalone_node_role
96
94
 
97
- if nucliadb_args.cluster_discovery_mode == StandaloneDiscoveryMode.DEFAULT:
98
- # default for standalone is single node
99
- cluster_settings.cluster_discovery_mode = ClusterDiscoveryMode.SINGLE_NODE
100
- cluster_settings.node_replicas = 1
101
-
102
95
  ingest_settings.nuclia_partitions = 1
103
96
  ingest_settings.replica_number = 0
104
97
  ingest_settings.partitions = ["1"]
@@ -99,10 +99,7 @@ def run():
99
99
  "Admin UI": f"http://{settings.http_host}:{settings.http_port}/admin",
100
100
  "Key-value backend": ingest_settings.driver.value,
101
101
  "Blob storage backend": storage_settings.file_backend.value,
102
- "Cluster discovery mode": cluster_settings.cluster_discovery_mode.value,
103
- "Node replicas": cluster_settings.node_replicas,
104
102
  "Index data path": os.path.realpath(cluster_settings.data_path),
105
- "Node port": cluster_settings.standalone_node_port,
106
103
  "Auth policy": settings.auth_policy.value,
107
104
  "Node role": cluster_settings.standalone_node_role.value,
108
105
  }
@@ -30,13 +30,6 @@ from nucliadb_utils.settings import StorageSettings
30
30
  from nucliadb_utils.storages.settings import Settings as ExtendedStorageSettings
31
31
 
32
32
 
33
- class StandaloneDiscoveryMode(Enum):
34
- DEFAULT = "default"
35
- MANUAL = "manual"
36
- KUBERNETES = "kubernetes"
37
- SINGLE_NODE = "single_node"
38
-
39
-
40
33
  class AuthPolicy(Enum):
41
34
  UPSTREAM_NAIVE = "upstream_naive"
42
35
  UPSTREAM_AUTH_HEADER = "upstream_auth_header"
@@ -60,8 +53,6 @@ class Settings(DriverSettings, StorageSettings, ExtendedStorageSettings):
60
53
  http_port: int = pydantic.Field(default=8080, description="HTTP Port")
61
54
  ingest_grpc_port: int = pydantic.Field(default=8030, description="Ingest GRPC Port")
62
55
  train_grpc_port: int = pydantic.Field(default=8031, description="Train GRPC Port")
63
- standalone_node_port: int = pydantic.Field(default=10009, description="Node GRPC Port")
64
-
65
56
  auth_policy: AuthPolicy = pydantic.Field(
66
57
  default=AuthPolicy.UPSTREAM_NAIVE,
67
58
  description="""Auth policy to use for http requests.
@@ -111,8 +102,6 @@ Examples:
111
102
  description="JWK key used for temporary token generation and validation.",
112
103
  )
113
104
 
114
- cluster_discovery_mode: StandaloneDiscoveryMode = StandaloneDiscoveryMode.DEFAULT
115
-
116
105
  fork: bool = pydantic.Field(default=False, description="Fork process on startup")
117
106
 
118
107
  # Standalone logging settings
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nucliadb
3
- Version: 6.3.1.post3544
3
+ Version: 6.3.1.post3549
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.post3544
24
- Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.3.1.post3544
25
- Requires-Dist: nucliadb-protos>=6.3.1.post3544
26
- Requires-Dist: nucliadb-models>=6.3.1.post3544
27
- Requires-Dist: nidx-protos>=6.3.1.post3544
23
+ Requires-Dist: nucliadb-telemetry[all]>=6.3.1.post3549
24
+ Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.3.1.post3549
25
+ Requires-Dist: nucliadb-protos>=6.3.1.post3549
26
+ Requires-Dist: nucliadb-models>=6.3.1.post3549
27
+ Requires-Dist: nidx-protos>=6.3.1.post3549
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
@@ -16,7 +16,7 @@ migrations/0016_upgrade_to_paragraphs_v2.py,sha256=9eepvzme-nb_mw6rwIdjjJzbFcpOq
16
16
  migrations/0017_multiple_writable_shards.py,sha256=HSi-eXXI0kO9sLgunUMuVpFnYMjVhWTVfDS_lIjlkuM,2095
17
17
  migrations/0018_purge_orphan_kbslugs.py,sha256=ztEOAjqlWVagv1UMg_sOm8HaW6S9FoDOIg7-rZ05tro,2177
18
18
  migrations/0019_upgrade_to_paragraphs_v3.py,sha256=zP13_IKE7u4ox2gyc493L2_ewyiPlr7Csn5K6n5eylI,2479
19
- migrations/0020_drain_nodes_from_cluster.py,sha256=cgm_72kH57QiBbPx17Judn7Wp5hQnKn6UW_1Z37_8s8,3269
19
+ migrations/0020_drain_nodes_from_cluster.py,sha256=BeECAI0T8u14M2U5USl1fFNcsfmdMerNhisolYQN_eA,1411
20
20
  migrations/0021_overwrite_vectorsets_key.py,sha256=O6nb2a7kDFX9I3XFrVtudCUyKptpGyv2_GYvcvbQOI8,1583
21
21
  migrations/0022_fix_paragraph_deletion_bug.py,sha256=-tH342VXF-8xwc_h3P1cYaUtTT1wHSGf7ZoeVEpnaYs,1422
22
22
  migrations/0023_backfill_pg_catalog.py,sha256=gw22pU5cAtg2a7n7xVaVqT2itjAoDMNtzWwTllwqIvg,2993
@@ -41,12 +41,12 @@ nucliadb/openapi.py,sha256=wDiw0dVEvTpJvbatkJ0JZLkKm9RItZT5PWRHjqRfqTA,2272
41
41
  nucliadb/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
42
  nucliadb/backups/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
43
43
  nucliadb/backups/const.py,sha256=llb5TaC53Ce6BMmlPKPUrVhVGl7uQrqv_Vle-P4GET4,1673
44
- nucliadb/backups/create.py,sha256=4RsvwY808X22kr06_uiASz6hEqmMirWQZgA_RoTbkqw,10440
44
+ nucliadb/backups/create.py,sha256=AM_nC7TgHOX0EFGaTXClS28jBSK28fHrKNZi14z2wek,10442
45
45
  nucliadb/backups/delete.py,sha256=1rnBhVUGYYZJXSZUrrgYMDZ5NyswEWkIA-G-crRCyHk,2404
46
- nucliadb/backups/models.py,sha256=13-Z4p-Ypjdtg5NuDE2m-09CTdFYHh-W6U9FyWSEhPA,1270
47
- nucliadb/backups/restore.py,sha256=X-Ai5HjujNWIjqxegDaJp33dSUIDaTzJ3K8n_heeDeo,9702
46
+ nucliadb/backups/models.py,sha256=-hITU4Mv6AxePu12toBu_fjpEv6vVGcwNVxV22O9jQA,1273
47
+ nucliadb/backups/restore.py,sha256=xhslVvTf4H8VmDucZpjrEFpKj6csPIWBadCPMVJYKQ8,9703
48
48
  nucliadb/backups/settings.py,sha256=SyzsInj1BRbBI0atg5IXWbMbOZ_eVg4eSQ3IcnUhCxQ,1357
49
- nucliadb/backups/tasks.py,sha256=e0J85c7RjqYO92hcG9GT_g_LK-enyisWuSWxAUl5IZE,4528
49
+ nucliadb/backups/tasks.py,sha256=QgGDBBWsTpD-jLcrRP-C897Zo1qvc_ux1b4L-SlCnd8,4530
50
50
  nucliadb/backups/utils.py,sha256=ayDaxfWP5cPnAkQH-tF4M6cnowsPQgU2ljYz_iL1CbE,1249
51
51
  nucliadb/common/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
52
52
  nucliadb/common/constants.py,sha256=QpigxJh_CtD85Evy0PtV5cVq6x0U_f9xfIcXz1ymkUg,869
@@ -58,11 +58,10 @@ nucliadb/common/cluster/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIX
58
58
  nucliadb/common/cluster/base.py,sha256=kklDqyvsubNX0W494ttl9f3E58lGaX6AXqAd8XX8ZHE,5522
59
59
  nucliadb/common/cluster/exceptions.py,sha256=t7v_l93t44l2tQpdQXgO_w-c4YZRcaayOz1A2i0w4RQ,1258
60
60
  nucliadb/common/cluster/grpc_node_dummy.py,sha256=LxONv0mhDFhx7mI91qqGfQlQ-R0qOGDYaxhXoBHLXaE,3548
61
- nucliadb/common/cluster/index_node.py,sha256=g38H1kiAliF3Y6et_CWYInpn_xPxf7THAFJ7RtgLNZo,3246
62
61
  nucliadb/common/cluster/manager.py,sha256=KIzqAYGgdVK3GicJ9LdLoei8arWZ7H60imbc32USPj4,12754
63
62
  nucliadb/common/cluster/rebalance.py,sha256=cLUlR08SsqmnoA_9GDflV6k2tXmkAPpyFxZErzp45vo,8754
64
63
  nucliadb/common/cluster/rollover.py,sha256=iTJ9EQmHbzXL34foNFto-hqdC0Kq1pF1mNxqv0jqhBs,25362
65
- nucliadb/common/cluster/settings.py,sha256=TMoym-cZsQ2soWfLAce0moSa2XncttQyhahL43LrWTo,3384
64
+ nucliadb/common/cluster/settings.py,sha256=JPwV_0U_i618Tn66GWUq6qCKNjy4TWkGEGld9GwH5uk,2048
66
65
  nucliadb/common/cluster/utils.py,sha256=7nQvnVFxM4XV7J560R8hUA-GPzrgD19UlQxHrl4mZUc,4687
67
66
  nucliadb/common/cluster/standalone/__init__.py,sha256=itSI7dtTwFP55YMX4iK7JzdMHS5CQVUiB1XzQu4UBh8,833
68
67
  nucliadb/common/cluster/standalone/utils.py,sha256=af3r-x_GF7A6dwIAhZLR-r-SZQEVxsFrDKeMfUTA6G0,1908
@@ -113,7 +112,6 @@ nucliadb/export_import/tasks.py,sha256=yPNdBdvTD7eGc7zvV9Rp7UZ0-mDhA34OOsLqHvns_
113
112
  nucliadb/export_import/utils.py,sha256=iAQAjYuNx0dhM2b5-1A0NEs8tSRsznuT-izysUrTwS0,19986
114
113
  nucliadb/ingest/__init__.py,sha256=fsw3C38VP50km3R-nHL775LNGPpJ4JxqXJ2Ib1f5SqE,1011
115
114
  nucliadb/ingest/app.py,sha256=rX1KE5vsAzG9hlArBk8WE2SOlvdYylcb-jNkMQNPJdQ,7407
116
- nucliadb/ingest/cache.py,sha256=w7jMMzamOmQ7gwXna6Dqm6isRNBVv6l5BTBlTxaYWjE,1005
117
115
  nucliadb/ingest/partitions.py,sha256=2NIhMYbNT0TNBL6bX1UMSi7vxFGICstCKEqsB0TXHOE,2410
118
116
  nucliadb/ingest/processing.py,sha256=8OggvuxNzktTTKDTUwsIuazhDParEWhn46CBZaMYAy8,20659
119
117
  nucliadb/ingest/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -154,7 +152,7 @@ nucliadb/ingest/orm/processor/processor.py,sha256=oaiZ9HUszhUbvNMCmDq5Xj_jtXiCDj
154
152
  nucliadb/ingest/orm/processor/sequence_manager.py,sha256=uqEphtI1Ir_yk9jRl2gPf7BlzzXWovbARY5MNZSBI_8,1704
155
153
  nucliadb/ingest/service/__init__.py,sha256=MME_G_ERxzJR6JW_hfE2qcfXpmpH1kdG-S0a-M0qRm8,2043
156
154
  nucliadb/ingest/service/exceptions.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
157
- nucliadb/ingest/service/writer.py,sha256=XISw3m5joj30gKe9CfpyybXMwgWOueAcgfiHRnX4Cqc,22311
155
+ nucliadb/ingest/service/writer.py,sha256=8oHJru1Yc8e05MXKmdQMbcNOzLHFFbWmHlJXIMjJcnY,22315
158
156
  nucliadb/middleware/__init__.py,sha256=A8NBlBuEkunCFMKpR9gnfNELsVn0Plc55BIQMbWDM8Q,2202
159
157
  nucliadb/migrator/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
160
158
  nucliadb/migrator/command.py,sha256=dKbJ1tAmP6X4lMVRSSlz351euaqs2wBPpOczLjATUes,2089
@@ -258,13 +256,13 @@ nucliadb/standalone/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20
258
256
  nucliadb/standalone/api_router.py,sha256=hgq9FXpihzgjHkwcVGfGCSwyXy67fqXTfLFHuINzIi0,5567
259
257
  nucliadb/standalone/app.py,sha256=mAApNK_iVsQgJyd-mtwCeZq5csSimwnXmlQGH9a70pE,5586
260
258
  nucliadb/standalone/auth.py,sha256=UwMv-TywhMZabvVg3anQLeCRdoHDnWf2o3luvnoNBjs,7670
261
- nucliadb/standalone/config.py,sha256=g9JBJQfyw87TYZ3yuy0O9WFVLd_MmCJxSRSI0E8FwZE,5396
259
+ nucliadb/standalone/config.py,sha256=hJ3p4dBRSsj5FOmIgAiEX9ZsAGUYd1W-_UJIol5LCCg,4967
262
260
  nucliadb/standalone/lifecycle.py,sha256=rdKLG-oOLN4rfd2VGG_2vlDUWYneWSCiuEhoeiFKfnM,2343
263
261
  nucliadb/standalone/migrations.py,sha256=s9-3RSZ-O3bjEw2TnBe_YWLUEKbub0bARUxi1gA3yuY,1950
264
262
  nucliadb/standalone/purge.py,sha256=ZY-cebb214FFiPG7OFmXZGg0G3CK5Amw0FLLm9WJhKE,1343
265
263
  nucliadb/standalone/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
266
- nucliadb/standalone/run.py,sha256=d4lmi9ePObbHeDqwcoZnp5JIkBp9iIPSw9uOwxeQMOU,5623
267
- nucliadb/standalone/settings.py,sha256=nPJ8R8yNUQD4G92zXBi5KiD6QWhXZdtLoQQUTXfuaHE,6041
264
+ nucliadb/standalone/run.py,sha256=0QKEAT6pCaLvnuxTG3RltTlhE2g5-HI21KbOWfusBGE,5425
265
+ nucliadb/standalone/settings.py,sha256=fbgqVT37XB2cJHJARnR19MO_dz6NLbkuIC2okH7J80o,5714
268
266
  nucliadb/standalone/versions.py,sha256=8CxNMNt2NgWM8ct50UsR4d44-ae7wtQI-sV-yGiFqyI,3508
269
267
  nucliadb/standalone/static/favicon.ico,sha256=96pKGp6Sx457JkTfjy1dtApMhkitixfU6invCUGAYOU,2285
270
268
  nucliadb/standalone/static/index.html,sha256=PEZfuEQFYnYACAL1ceN8xC0im8lBrUx838RkE8tbvgA,3833
@@ -349,8 +347,8 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
349
347
  nucliadb/writer/tus/s3.py,sha256=vF0NkFTXiXhXq3bCVXXVV-ED38ECVoUeeYViP8uMqcU,8357
350
348
  nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
351
349
  nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
352
- nucliadb-6.3.1.post3544.dist-info/METADATA,sha256=vKxvrIe5oh3QKwI-JxIAA8NJ2V0bwXCdg6K_O4wOCFg,4291
353
- nucliadb-6.3.1.post3544.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
354
- nucliadb-6.3.1.post3544.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
355
- nucliadb-6.3.1.post3544.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
356
- nucliadb-6.3.1.post3544.dist-info/RECORD,,
350
+ nucliadb-6.3.1.post3549.dist-info/METADATA,sha256=zRXMEsuY63780s274oEzv-I_wLynIyYEfW8iLptlP-U,4291
351
+ nucliadb-6.3.1.post3549.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
352
+ nucliadb-6.3.1.post3549.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
353
+ nucliadb-6.3.1.post3549.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
354
+ nucliadb-6.3.1.post3549.dist-info/RECORD,,
@@ -1,77 +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 Optional
21
-
22
- from lru import LRU
23
-
24
- from nucliadb.common.cluster.base import AbstractIndexNode
25
- from nucliadb.common.cluster.grpc_node_dummy import DummyReaderStub, DummyWriterStub
26
- from nucliadb.ingest import SERVICE_NAME
27
- from nucliadb_protos.nodereader_pb2_grpc import NodeReaderStub
28
- from nucliadb_protos.nodewriter_pb2_grpc import NodeWriterStub
29
- from nucliadb_utils.grpc import get_traced_grpc_channel
30
-
31
- from .settings import settings
32
-
33
- READ_CONNECTIONS = LRU(50) # type: ignore
34
- WRITE_CONNECTIONS = LRU(50) # type: ignore
35
-
36
-
37
- class IndexNode(AbstractIndexNode):
38
- _writer: Optional[NodeWriterStub] = None
39
- _reader: Optional[NodeReaderStub] = None
40
-
41
- def _get_service_address(self, port_map: dict[str, int], port: Optional[int]) -> str:
42
- hostname = self.address.split(":")[0]
43
- if port is None:
44
- # For testing purposes we need to be able to have a writing port
45
- port = port_map[hostname]
46
- grpc_address = f"localhost:{port}"
47
- else:
48
- grpc_address = f"{hostname}:{port}"
49
- return grpc_address
50
-
51
- @property
52
- def writer(self) -> NodeWriterStub:
53
- if self._writer is None or self.address not in WRITE_CONNECTIONS:
54
- if not self.dummy:
55
- grpc_address = self._get_service_address(
56
- settings.writer_port_map, settings.node_writer_port
57
- )
58
- channel = get_traced_grpc_channel(grpc_address, SERVICE_NAME, variant="_writer")
59
- WRITE_CONNECTIONS[self.address] = NodeWriterStub(channel)
60
- else:
61
- WRITE_CONNECTIONS[self.address] = DummyWriterStub()
62
- self._writer = WRITE_CONNECTIONS[self.address]
63
- return self._writer # type: ignore
64
-
65
- @property
66
- def reader(self) -> NodeReaderStub:
67
- if self._reader is None or self.address not in READ_CONNECTIONS:
68
- if not self.dummy:
69
- grpc_address = self._get_service_address(
70
- settings.reader_port_map, settings.node_reader_port
71
- )
72
- channel = get_traced_grpc_channel(grpc_address, SERVICE_NAME, variant="_reader")
73
- READ_CONNECTIONS[self.address] = NodeReaderStub(channel)
74
- else:
75
- READ_CONNECTIONS[self.address] = DummyReaderStub()
76
- self._reader = READ_CONNECTIONS[self.address]
77
- return self._reader # type: ignore
nucliadb/ingest/cache.py DELETED
@@ -1,25 +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 nucliadb.common.cluster.index_node import READ_CONNECTIONS, WRITE_CONNECTIONS
21
-
22
-
23
- def clear_ingest_cache():
24
- READ_CONNECTIONS.clear()
25
- WRITE_CONNECTIONS.clear()