Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Updating milvus connect function to work with remote instance
Signed-off-by: Fiona Waters <fiwaters6@gmail.com>
  • Loading branch information
Fiona-Waters committed May 29, 2025
commit 9c20396623ff87f428d56888adc7e6a5edb4bf4d
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class MilvusOnlineStoreConfig(FeastConfigBaseModel, VectorStoreConfig):
"""

type: Literal["milvus"] = "milvus"
path: Optional[StrictStr] = "online_store.db"
host: Optional[StrictStr] = "localhost"
path: Optional[StrictStr] = ""
host: Optional[StrictStr] = "http://localhost"
port: Optional[int] = 19530
index_type: Optional[str] = "FLAT"
metric_type: Optional[str] = "COSINE"
Expand Down Expand Up @@ -126,13 +126,16 @@ def _get_db_path(self, config: RepoConfig) -> str:

def _connect(self, config: RepoConfig) -> MilvusClient:
if not self.client:
if config.provider == "local":
if config.provider == "local" and config.online_store.path:
db_path = self._get_db_path(config)
print(f"Connecting to Milvus in local mode using {db_path}")
self.client = MilvusClient(db_path)
else:
print(
f"Connecting to Milvus remotely at {config.online_store.host}:{config.online_store.port}"
)
self.client = MilvusClient(
url=f"{config.online_store.host}:{config.online_store.port}",
uri=f"{config.online_store.host}:{config.online_store.port}",
token=f"{config.online_store.username}:{config.online_store.password}"
if config.online_store.username and config.online_store.password
else "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def create_online_store(self) -> Dict[str, Any]:
wait_for_logs(
container=self.container, predicate=log_string_to_wait_for, timeout=30
)
host = "localhost"
host = "http://localhost"
port = self.container.get_exposed_port(self.fixed_port)
return {
"type": "milvus",
Expand Down
Loading