Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
21e47d2
test
mavysavydav Jun 12, 2021
06e0c77
refactored existing tests to test full_feature_names feature on data …
Mwad22 Jun 16, 2021
4b7dd18
removed full_feature_names usage from quickstart and README to have m…
Mwad22 Jun 16, 2021
579e08f
Update CHANGELOG for Feast v0.10.8
Jun 17, 2021
462da43
GitBook: [master] 2 pages modified
achals Jun 17, 2021
df95ee8
Schema Inferencing should happen at apply time (#1646)
mavysavydav Jun 18, 2021
e383575
GitBook: [master] 80 pages modified
woop Jun 19, 2021
dd25ad6
GitBook: [master] 80 pages modified
woop Jun 20, 2021
cef2869
Provide descriptive error on invalid table reference (#1627)
codyjlin Jun 21, 2021
c2e2b4d
Refactor OnlineStoreConfig classes into owning modules (#1649)
achals Jun 21, 2021
d2cda24
Possibility to specify a project for BigQuery queries (#1656)
MattDelac Jun 21, 2021
4ab4c60
Refactor OfflineStoreConfig classes into their owning modules (#1657)
achals Jun 22, 2021
64a2cb5
Run python unit tests in parallel (#1652)
achals Jun 22, 2021
9e4c907
Rename telemetry to usage (#1660)
Jun 22, 2021
b951282
resolved final comments on PR (variable renaming, refactor tests)
Mwad22 Jun 23, 2021
a68b12b
reformatted after merge conflict
Mwad22 Jun 23, 2021
094dbf3
Update CHANGELOG for Feast v0.11.0
woop Jun 24, 2021
0a148f9
Update charts README (#1659)
szalai1 Jun 25, 2021
0ce8210
Added Redis to list of online stores for local provider in providers …
nels Jun 25, 2021
d71e4c5
Grouped inferencing statements together in apply methods for easier r…
mavysavydav Jun 25, 2021
c14023f
Add RedshiftDataSource (#1669)
Jun 28, 2021
d138648
Provide the user with more options for setting the to_bigquery config…
codyjlin Jun 28, 2021
c02b9eb
Add streaming sources to the FeatureView API (#1664)
achals Jun 28, 2021
12dbbea
Add to_table() to RetrievalJob object (#1663)
MattDelac Jun 29, 2021
d0fe0a9
Rename to_table to to_arrow (#1671)
MattDelac Jun 29, 2021
6e8670e
Cancel BigQuery job if timeout hits (#1672)
MattDelac Jun 29, 2021
5314024
Fix Feature References example (#1674)
GregKuhlmann Jun 30, 2021
eb1da5e
Allow strings for online/offline store instead of dicts (#1673)
achals Jun 30, 2021
183a0b9
Remove default list from the FeatureView constructor (#1679)
achals Jul 1, 2021
b714a12
made changes requested by @tsotnet
Mwad22 Jul 2, 2021
c78894f
Fix unit tests that got broken by Pandas 1.3.0 release (#1683)
Jul 3, 2021
20c9461
Add support for DynamoDB and S3 registry (#1483)
leonid133 Jul 3, 2021
d36d1a0
Parallelize integration tests (#1684)
Jul 4, 2021
651bce3
BQ exception should be raised first before we check the timedout (#1675)
MattDelac Jul 5, 2021
f3b92c3
Update sdk/python/feast/infra/provider.py
Mwad22 Jul 5, 2021
f400d65
Update sdk/python/feast/feature_store.py
Mwad22 Jul 5, 2021
082fca7
made error logic/messages more descriptive
Mwad22 Jul 5, 2021
3aca976
made error logic/messages more descriptive.
Mwad22 Jul 5, 2021
79aa736
Simplified error messages
Mwad22 Jul 6, 2021
d7d08ef
ran formatter, issue in errors.py
Mwad22 Jul 7, 2021
2ab8eea
Merge branch 'master' into mwad22-1618-PR
Mwad22 Jul 7, 2021
650340d
python linter issues resolved
Mwad22 Jul 7, 2021
5d582a6
removed unnecessary default assignment in get_historical_features. de…
Mwad22 Jul 8, 2021
8724e0b
added error message assertion for feature name collisions, and other …
Mwad22 Jul 8, 2021
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
Refactor OfflineStoreConfig classes into their owning modules (#1657)
* Refactor OfflineStoreConfig classes into their owning modules

Signed-off-by: Achal Shah <achals@gmail.com>

* Fix error string

Signed-off-by: Achal Shah <achals@gmail.com>

* Generic error class

Signed-off-by: Achal Shah <achals@gmail.com>

* Merge conflicts

Signed-off-by: Achal Shah <achals@gmail.com>

* make the store type work, and add a test that uses the fully qualified name of the OnlineStore

Signed-off-by: Achal Shah <achals@gmail.com>

* Address comments from previous PR

Signed-off-by: Achal Shah <achals@gmail.com>

* CR updates

Signed-off-by: Achal Shah <achals@gmail.com>
Signed-off-by: Mwad22 <51929507+Mwad22@users.noreply.github.com>
  • Loading branch information
achals authored and Mwad22 committed Jul 7, 2021
commit 4ab4c607a5fddfc11dfc637836f903769ad50f28
9 changes: 5 additions & 4 deletions sdk/python/feast/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(self, provider_name):


class FeastModuleImportError(Exception):
def __init__(self, module_name, module_type="provider"):
def __init__(self, module_name: str, module_type: str):
super().__init__(f"Could not import {module_type} module '{module_name}'")


Expand Down Expand Up @@ -92,10 +92,11 @@ def __init__(self, online_store_class_name: str):
)


class FeastOnlineStoreConfigInvalidName(Exception):
def __init__(self, online_store_config_class_name: str):
class FeastClassInvalidName(Exception):
def __init__(self, class_name: str, class_type: str):
super().__init__(
f"Online Store Config Class '{online_store_config_class_name}' should end with the string `OnlineStoreConfig`.'"
f"Config Class '{class_name}' "
f"should end with the string `{class_type}`.'"
)


Expand Down
28 changes: 28 additions & 0 deletions sdk/python/feast/importer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import importlib

from feast import errors


def get_class_from_type(module_name: str, class_name: str, class_type: str):
if not class_name.endswith(class_type):
raise errors.FeastClassInvalidName(class_name, class_type)

# Try importing the module that contains the custom provider
try:
module = importlib.import_module(module_name)
except Exception as e:
# The original exception can be anything - either module not found,
# or any other kind of error happening during the module import time.
# So we should include the original error as well in the stack trace.
raise errors.FeastModuleImportError(module_name, class_type) from e

# Try getting the provider class definition
try:
_class = getattr(module, class_name)
except AttributeError:
# This can only be one type of error, when class_name attribute does not exist in the module
# So we don't have to include the original exception here
raise errors.FeastClassImportError(
module_name, class_name, class_type=class_type
) from None
return _class
17 changes: 16 additions & 1 deletion sdk/python/feast/infra/offline_stores/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import pandas
import pyarrow
from jinja2 import BaseLoader, Environment
from pydantic import StrictStr
from pydantic.typing import Literal
from tenacity import retry, stop_after_delay, wait_fixed

from feast import errors
Expand All @@ -20,7 +22,7 @@
_get_requested_feature_views_to_features_dict,
)
from feast.registry import Registry
from feast.repo_config import BigQueryOfflineStoreConfig, RepoConfig
from feast.repo_config import FeastConfigBaseModel, RepoConfig

try:
from google.api_core.exceptions import NotFound
Expand All @@ -34,6 +36,19 @@
raise FeastExtrasDependencyImportError("gcp", str(e))


class BigQueryOfflineStoreConfig(FeastConfigBaseModel):
""" Offline store config for GCP BigQuery """

type: Literal["bigquery"] = "bigquery"
""" Offline store type selector"""

dataset: StrictStr = "feast"
""" (optional) BigQuery Dataset name for temporary tables """

project_id: Optional[StrictStr] = None
""" (optional) GCP project name used for the BigQuery offline store """


class BigQueryOfflineStore(OfflineStore):
@staticmethod
def pull_latest_from_table_or_query(
Expand Down
10 changes: 9 additions & 1 deletion sdk/python/feast/infra/offline_stores/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pandas as pd
import pyarrow
import pytz
from pydantic.typing import Literal

from feast.data_source import DataSource, FileSource
from feast.errors import FeastJoinKeysDuringMaterialization
Expand All @@ -15,7 +16,14 @@
_run_field_mapping,
)
from feast.registry import Registry
from feast.repo_config import RepoConfig
from feast.repo_config import FeastConfigBaseModel, RepoConfig


class FileOfflineStoreConfig(FeastConfigBaseModel):
""" Offline store config for local (file-based) store """

type: Literal["file"] = "file"
""" Offline store type selector"""


class FileRetrievalJob(RetrievalJob):
Expand Down
62 changes: 26 additions & 36 deletions sdk/python/feast/infra/offline_stores/helpers.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,31 @@
from feast.data_source import BigQuerySource, DataSource, FileSource
from feast.errors import FeastOfflineStoreUnsupportedDataSource
import importlib
from typing import Any

from feast import errors
from feast.infra.offline_stores.offline_store import OfflineStore
from feast.repo_config import (
BigQueryOfflineStoreConfig,
FileOfflineStoreConfig,
OfflineStoreConfig,
)


def get_offline_store_from_config(
offline_store_config: OfflineStoreConfig,
) -> OfflineStore:
def get_offline_store_from_config(offline_store_config: Any,) -> OfflineStore:
"""Get the offline store from offline store config"""

if isinstance(offline_store_config, FileOfflineStoreConfig):
from feast.infra.offline_stores.file import FileOfflineStore

return FileOfflineStore()
elif isinstance(offline_store_config, BigQueryOfflineStoreConfig):
from feast.infra.offline_stores.bigquery import BigQueryOfflineStore

return BigQueryOfflineStore()

raise ValueError(f"Unsupported offline store config '{offline_store_config}'")


def assert_offline_store_supports_data_source(
offline_store_config: OfflineStoreConfig, data_source: DataSource
):
if (
isinstance(offline_store_config, FileOfflineStoreConfig)
and isinstance(data_source, FileSource)
) or (
isinstance(offline_store_config, BigQueryOfflineStoreConfig)
and isinstance(data_source, BigQuerySource)
):
return
raise FeastOfflineStoreUnsupportedDataSource(
offline_store_config.type, data_source.__class__.__name__
)
module_name = offline_store_config.__module__
qualified_name = type(offline_store_config).__name__
store_class_name = qualified_name.replace("Config", "")
try:
module = importlib.import_module(module_name)
except Exception as e:
# The original exception can be anything - either module not found,
# or any other kind of error happening during the module import time.
# So we should include the original error as well in the stack trace.
raise errors.FeastModuleImportError(module_name, "OfflineStore") from e

# Try getting the provider class definition
try:
offline_store_class = getattr(module, store_class_name)
except AttributeError:
# This can only be one type of error, when class_name attribute does not exist in the module
# So we don't have to include the original exception here
raise errors.FeastClassImportError(
module_name, store_class_name, class_type="OfflineStore"
) from None
return offline_store_class()
4 changes: 1 addition & 3 deletions sdk/python/feast/infra/online_stores/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ def get_online_store_from_config(online_store_config: Any,) -> OnlineStore:
# The original exception can be anything - either module not found,
# or any other kind of error happening during the module import time.
# So we should include the original error as well in the stack trace.
raise errors.FeastModuleImportError(
module_name, module_type="OnlineStore"
) from e
raise errors.FeastModuleImportError(module_name, "OnlineStore") from e

# Try getting the provider class definition
try:
Expand Down
9 changes: 7 additions & 2 deletions sdk/python/feast/infra/online_stores/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
class SqliteOnlineStoreConfig(FeastConfigBaseModel):
""" Online store config for local (SQLite-based) store """

type: Literal["sqlite"] = "sqlite"
type: Literal[
"sqlite", "feast.infra.online_stores.sqlite.SqliteOnlineStore"
] = "sqlite"
""" Online store type selector"""

path: StrictStr = "data/online.db"
Expand All @@ -51,7 +53,10 @@ class SqliteOnlineStore(OnlineStore):

@staticmethod
def _get_db_path(config: RepoConfig) -> str:
assert config.online_store.type == "sqlite"
assert (
config.online_store.type == "sqlite"
or config.online_store.type.endswith("SqliteOnlineStore")
)

if config.repo_path and not Path(config.online_store.path).is_absolute():
db_path = str(config.repo_path / config.online_store.path)
Expand Down
24 changes: 4 additions & 20 deletions sdk/python/feast/infra/provider.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import abc
import importlib
from datetime import datetime
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
Expand All @@ -8,7 +7,7 @@
import pyarrow
from tqdm import tqdm

from feast import errors
from feast import errors, importer
from feast.entity import Entity
from feast.feature_table import FeatureTable
from feast.feature_view import FeatureView
Expand Down Expand Up @@ -157,24 +156,9 @@ def get_provider(config: RepoConfig, repo_path: Path) -> Provider:
# For example, provider 'foo.bar.MyProvider' will be parsed into 'foo.bar' and 'MyProvider'
module_name, class_name = config.provider.rsplit(".", 1)

# Try importing the module that contains the custom provider
try:
module = importlib.import_module(module_name)
except Exception as e:
# The original exception can be anything - either module not found,
# or any other kind of error happening during the module import time.
# So we should include the original error as well in the stack trace.
raise errors.FeastModuleImportError(module_name) from e

# Try getting the provider class definition
try:
ProviderCls = getattr(module, class_name)
except AttributeError:
# This can only be one type of error, when class_name attribute does not exist in the module
# So we don't have to include the original exception here
raise errors.FeastClassImportError(module_name, class_name) from None

return ProviderCls(config, repo_path)
cls = importer.get_class_from_type(module_name, class_name, "Provider")

return cls(config, repo_path)


def _get_requested_feature_views_to_features_dict(
Expand Down
Loading