Skip to content

Commit

Permalink
remove circ
Browse files Browse the repository at this point in the history
  • Loading branch information
HammadB committed Jan 15, 2025
1 parent e30d0f8 commit 7ffc4f4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
23 changes: 20 additions & 3 deletions chromadb/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
from typing_extensions import Literal
import platform

from chromadb.segment.impl.distributed.segment_directory import RoutingMode


in_pydantic_v2 = False
try:
from pydantic import BaseSettings
Expand Down Expand Up @@ -100,6 +97,26 @@ class APIVersion(str, Enum):
V2 = "/api/v2"


# NOTE(hammadb) 1/13/2024 - This has to be in config.py instead of being localized to the module
# that uses it because of a circular import issue. This is a temporary solution until we can
# refactor the code to remove the circular import.
class RoutingMode(Enum):
"""
Routing mode for the segment directory
node - Assign based on the node name, used in production with multi-node settings with the assumption that
there is one query service pod per node. This is useful for when there is a disk based cache on the
node that we want to route to.
id - Assign based on the member id, used in development and testing environments where the node name is not
guaranteed to be unique. (I.e a local development kubernetes env). Or when there are multiple query service
pods per node.
"""

NODE = "node"
ID = "id"


class Settings(BaseSettings): # type: ignore
# ==============
# Generic config
Expand Down
21 changes: 1 addition & 20 deletions chromadb/segment/impl/distributed/segment_directory.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
from enum import Enum
import threading
import time
from typing import Any, Callable, Dict, Optional, cast

from kubernetes import client, config, watch
from kubernetes.client.rest import ApiException
from overrides import EnforceOverrides, override

from chromadb.config import System
from chromadb.config import RoutingMode, System
from chromadb.segment.distributed import (
Member,
Memberlist,
Expand Down Expand Up @@ -222,23 +220,6 @@ def _notify(self, memberlist: Memberlist) -> None:
callback(memberlist)


class RoutingMode(Enum):
"""
Routing mode for the segment directory
node - Assign based on the node name, used in production with multi-node settings with the assumption that
there is one query service pod per node. This is useful for when there is a disk based cache on the
node that we want to route to.
id - Assign based on the member id, used in development and testing environments where the node name is not
guaranteed to be unique. (I.e a local development kubernetes env). Or when there are multiple query service
pods per node.
"""

NODE = "node"
ID = "id"


class RendezvousHashSegmentDirectory(SegmentDirectory, EnforceOverrides):
_memberlist_provider: MemberlistProvider
_curr_memberlist_mutex: threading.Lock
Expand Down

0 comments on commit 7ffc4f4

Please sign in to comment.