Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d372a09
ci: Add bigtable cleanup script
adchia Jul 3, 2023
f6d3caf
fix: Missing Catalog argument in athena connector (#3661)
GyuminJack Jul 3, 2023
d4f9158
ci: Disable flaky lambda materialization test
adchia Jul 3, 2023
4861af0
fix: Broken non-root path with projects-list.json (#3665)
bjfletcher Jul 3, 2023
48e0971
fix: Manage redis pipe's context (#3655)
j1wonpark Jul 4, 2023
315073f
chore: Bump tough-cookie from 4.0.0 to 4.1.3 in /sdk/python/feast/ui …
dependabot[bot] Jul 11, 2023
870762a
chore: Bump tough-cookie from 4.0.0 to 4.1.3 in /ui (#3676)
dependabot[bot] Jul 11, 2023
478caec
fix: For SQL registry, increase max data_source_name length to 255 (#…
radonnachie Jul 13, 2023
1c01035
fix: Optimize bytes processed when retrieving entity df schema to 0 (…
sudohainguyen Jul 13, 2023
ef4ef32
fix: Entityless fv breaks with `KeyError: __dummy` applying feature_s…
wfoschiera Jul 13, 2023
0ad2d62
chore: Bump protobufjs from 7.1.1 to 7.2.4 in /ui (#3674)
dependabot[bot] Jul 17, 2023
e4c0c9b
chore: Bump protobufjs from 7.1.2 to 7.2.4 in /sdk/python/feast/ui (#…
dependabot[bot] Jul 17, 2023
bef5791
chore: Bump semver from 6.3.0 to 6.3.1 in /ui (#3678)
dependabot[bot] Jul 17, 2023
928be7b
chore: Bump semver from 6.3.0 to 6.3.1 in /sdk/python/feast/ui (#3679)
dependabot[bot] Jul 17, 2023
12f57a9
chore: Bump google.golang.org/grpc from 1.47.0 to 1.53.0 (#3670)
dependabot[bot] Jul 17, 2023
9527183
chore(release): release 0.32.0
feast-ci-bot Jul 17, 2023
76270f6
fix: Redshift push ignores schema (#3671)
metavee Jul 24, 2023
c75a01f
fix: Add aws-sts dependency in java sdk so that S3 client acquires IR…
harmeet-singh-discovery Aug 1, 2023
0578b9b
Adding initial update changes
Aug 7, 2023
8487678
Merge branch 'feast-dev:master' into msudhir/add-vector-update-functi…
Manisha4 Aug 7, 2023
5828891
Added formatting changes
Aug 7, 2023
4a29d33
Revert "Merge branch 'feast-dev:master' into msudhir/add-vector-updat…
Aug 7, 2023
e209770
Added more tests and functionality
Aug 8, 2023
ebe1e32
updating tests
Aug 8, 2023
62692e0
updated functionality and added more tests
Aug 9, 2023
0680c94
correcting a test case
Aug 9, 2023
5c5490d
Making formatting corrections and changeing log
Aug 9, 2023
cdadb87
Improved tests and added functionality to convert feast schema to mil…
Aug 10, 2023
e1fd230
Added PR Review comments
Aug 11, 2023
d0c4269
Fixed failing test
Aug 11, 2023
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
Prev Previous commit
Next Next commit
Added formatting changes
  • Loading branch information
Manisha Sudhir committed Aug 7, 2023
commit 58288913d47021161a0762242ddc6c50c53d24a1
19 changes: 14 additions & 5 deletions sdk/python/feast/expediagroup/vectordb/milvus_online_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple

from pydantic.typing import Literal
from pymilvus import (
Collection,
connections,
utility,
)

from feast import Entity, RepoConfig
from feast.expediagroup.vectordb.vector_feature_view import VectorFeatureView
Expand All @@ -11,8 +16,6 @@
from feast.protos.feast.types.Value_pb2 import Value as ValueProto
from feast.repo_config import FeastConfigBaseModel

from pymilvus import Collection, FieldSchema, CollectionSchema, DataType, connections, utility

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -71,7 +74,9 @@ def update(
for table_to_keep in tables_to_keep:
try:
Collection(name=table_to_keep.name, schema=table_to_keep.schema)
logger.info(f"Collection {table_to_keep.name} has been updated successfully.")
logger.info(
f"Collection {table_to_keep.name} has been updated successfully."
)
except Exception as e:
logger.error(f"Collection update failed due to {e}")

Expand All @@ -80,9 +85,13 @@ def update(
try:
if collection_available:
utility.drop_collection(table_to_delete.name)
logger.info(f"Collection {table_to_keep.name} has been deleted successfully.")
logger.info(
f"Collection {table_to_keep.name} has been deleted successfully."
)
else:
return logger.error("Collection does not exist or is already deleted.")
return logger.error(
"Collection does not exist or is already deleted."
)
except Exception as e:
logger.error(f"Collection deletion failed due to {e}")

Expand Down
159 changes: 0 additions & 159 deletions sdk/python/tests/expediagroup/test.py

This file was deleted.

153 changes: 125 additions & 28 deletions sdk/python/tests/expediagroup/test_milvus_online_store.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,139 @@
from pymilvus.client.stub import Milvus
from pymilvus.client.types import DataType
import logging
from dataclasses import dataclass
from typing import List, Optional

import pytest
from pymilvus import CollectionSchema, DataType, FieldSchema, utility
from pymilvus.client.stub import Milvus

from feast.expediagroup.vectordb.milvus_online_store import (
MilvusOnlineStore,
MilvusOnlineStoreConfig,
)
from feast.field import Field
from feast.infra.offline_stores.file import FileOfflineStoreConfig
from feast.repo_config import RepoConfig
from tests.expediagroup.milvus_online_store_creator import MilvusOnlineStoreCreator

logging.basicConfig(level=logging.INFO)

REGISTRY = "s3://test_registry/registry.db"
PROJECT = "test_aws"
PROVIDER = "aws"
TABLE_NAME = "milvus_online_store"
REGION = "us-west-2"
HOST = "localhost"


@dataclass
class MockFeatureView:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it really necessary to use a mock? Can you use a VectorFeatureView instead?

name: str
schema: Optional[List[Field]]


@pytest.fixture
def repo_config():
return RepoConfig(
registry=REGISTRY,
project=PROJECT,
provider=PROVIDER,
online_store=MilvusOnlineStoreConfig(host=HOST, region=REGION),
offline_store=FileOfflineStoreConfig(),
entity_key_serialization_version=2,
)


def test_milvus_start_stop():
# this is just an example how to start / stop Milvus. Once a real test is implemented this test can be deleted
@pytest.fixture
def milvus_online_store():
return MilvusOnlineStore()


@pytest.fixture(scope="class")
def milvus_online_setup():
# Creating an online store through embedded Milvus for all tests in the class
online_store_creator = MilvusOnlineStoreCreator("milvus")
online_store_creator.create_online_store()

# access through a stub
milvus = Milvus(online_store_creator.host, 19530)

# Create collection demo_collection if it doesn't exist.
collection_name = "example_collection_"

ok = milvus.has_collection(collection_name)
if not ok:
fields = {
"fields": [
{"name": "key", "type": DataType.INT64, "is_primary": True},
{
"name": "vector",
"type": DataType.FLOAT_VECTOR,
"params": {"dim": 32},
},
],
"auto_id": True,
}

milvus.create_collection(collection_name, fields)

collection = milvus.describe_collection(collection_name)
assert collection.get("collection_name") == collection_name
yield online_store_creator

# Tearing down the Milvus instance after all tests in the class
online_store_creator.teardown()


class TestMilvusOnlineStore:
def test_milvus_start_stop(self):
# this is just an example how to start / stop Milvus. Once a real test is implemented this test can be deleted
online_store_creator = MilvusOnlineStoreCreator("milvus")
online_store_creator.create_online_store()

# access through a stub
milvus = Milvus(online_store_creator.host, 19530)

# Create collection demo_collection if it doesn't exist.
collection_name = "example_collection_"

ok = milvus.has_collection(collection_name)
if not ok:
fields = {
"fields": [
{"name": "key", "type": DataType.INT64, "is_primary": True},
{
"name": "vector",
"type": DataType.FLOAT_VECTOR,
"params": {"dim": 32},
},
],
"auto_id": True,
}

milvus.create_collection(collection_name, fields)

collection = milvus.describe_collection(collection_name)
assert collection.get("collection_name") == collection_name
online_store_creator.teardown()

def test_milvus_update(self, milvus_online_setup):

collection_to_delete = "Collection1"
collection_to_write = "Collection2"
MilvusOnlineStoreConfig(host=HOST)

# Creating a common schema for collection
schema = CollectionSchema(
fields=[
FieldSchema(
"int64", DataType.INT64, description="int64", is_primary=True
),
FieldSchema(
"float_vector", DataType.FLOAT_VECTOR, is_primary=False, dim=128
),
]
)

# Ensuring no collections exist at the start of the test
utility.drop_collection(collection_to_delete)
utility.drop_collection(collection_to_write)

MilvusOnlineStore().update(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here I would also rather create the collection first through the pymilvus sdk so that we do not introduce tests that are interdependent.

config=repo_config,
tables_to_delete=[],
tables_to_keep=[MockFeatureView(name=collection_to_delete, schema=schema)],
entities_to_delete=None,
entities_to_keep=None,
partial=None,
)

assert len(utility.list_collections()) == 1

MilvusOnlineStore().update(
config=repo_config,
tables_to_delete=[MockFeatureView(name=collection_to_delete, schema=None)],
tables_to_keep=[MockFeatureView(name=collection_to_write, schema=schema)],
entities_to_delete=None,
entities_to_keep=None,
partial=None,
)

assert utility.has_collection(collection_to_write) is True
assert utility.has_collection(collection_to_delete) is False
assert len(utility.list_collections()) == 1