Skip to content

Commit ee9e526

Browse files
authored
Update feature_store.py
1 parent 5620fb7 commit ee9e526

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

sdk/python/feast/feature_store.py

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434

3535
import pandas as pd
3636
import pyarrow as pa
37+
import click
38+
from colorama import Fore, Style
3739
from fastapi.concurrency import run_in_threadpool
3840
from google.protobuf.timestamp_pb2 import Timestamp
3941
from tqdm import tqdm
@@ -67,9 +69,6 @@
6769
update_feature_views_with_inferred_features_and_entities,
6870
)
6971
from feast.infra.infra_object import Infra
70-
from feast.infra.offline_stores.offline_utils import (
71-
DEFAULT_ENTITY_DF_EVENT_TIMESTAMP_COL,
72-
)
7372
from feast.infra.provider import Provider, RetrievalJob, get_provider
7473
from feast.infra.registry.base_registry import BaseRegistry
7574
from feast.infra.registry.registry import Registry
@@ -95,8 +94,6 @@
9594
from feast.utils import _get_feature_view_vector_field_metadata, _utc_now
9695

9796
warnings.simplefilter("once", DeprecationWarning)
98-
99-
10097
logger = logging.getLogger(__name__)
10198

10299

@@ -1482,6 +1479,7 @@ def materialize_incremental(
14821479
<BLANKLINE>
14831480
...
14841481
"""
1482+
_print_materializing_banner()
14851483
feature_views_to_materialize = self._get_feature_views_to_materialize(
14861484
feature_views
14871485
)
@@ -1509,7 +1507,9 @@ def materialize_incremental(
15091507
else:
15101508
odfv_start_date = end_date - timedelta(weeks=52)
15111509

1512-
logger.info("%s:", feature_view.name)
1510+
click.echo(
1511+
f"{Style.BRIGHT + Fore.GREEN}{feature_view.name}{Style.RESET_ALL}:"
1512+
)
15131513
self._materialize_odfv(
15141514
feature_view,
15151515
odfv_start_date,
@@ -1530,17 +1530,16 @@ def materialize_incremental(
15301530
else:
15311531
# TODO(felixwang9817): Find the earliest timestamp for this specific feature
15321532
# view from the offline store, and set the start date to that timestamp.
1533-
logger.info(
1534-
"Since the ttl is 0 for feature view %s, the start date will be set to 1 year before the current time.",
1535-
feature_view.name,
1533+
click.echo(
1534+
f"Since the ttl is 0 for feature view {Style.BRIGHT + Fore.GREEN}{feature_view.name}{Style.RESET_ALL}, "
1535+
"the start date will be set to 1 year before the current time."
15361536
)
15371537
start_date = _utc_now() - timedelta(weeks=52)
15381538
provider = self._get_provider()
1539-
logger.info(
1540-
"%s from %s to %s:",
1541-
feature_view.name,
1542-
utils.make_tzaware(start_date.replace(microsecond=0)),
1543-
utils.make_tzaware(end_date.replace(microsecond=0)),
1539+
click.echo(
1540+
f"{Style.BRIGHT + Fore.GREEN}{feature_view.name}{Style.RESET_ALL}"
1541+
f" from {Style.BRIGHT + Fore.GREEN}{utils.make_tzaware(start_date.replace(microsecond=0))}{Style.RESET_ALL}"
1542+
f" to {Style.BRIGHT + Fore.GREEN}{utils.make_tzaware(end_date.replace(microsecond=0))}{Style.RESET_ALL}:"
15441543
)
15451544

15461545
def tqdm_builder(length):
@@ -1603,6 +1602,7 @@ def materialize(
16031602
<BLANKLINE>
16041603
...
16051604
"""
1605+
_print_materializing_banner()
16061606
if utils.make_tzaware(start_date) > utils.make_tzaware(end_date):
16071607
raise ValueError(
16081608
f"The given start_date {start_date} is greater than the given end_date {end_date}."
@@ -1621,7 +1621,9 @@ def materialize(
16211621
for feature_view in feature_views_to_materialize:
16221622
if isinstance(feature_view, OnDemandFeatureView):
16231623
if feature_view.write_to_online_store:
1624-
logger.info("%s:", feature_view.name)
1624+
click.echo(
1625+
f"{Style.BRIGHT + Fore.GREEN}{feature_view.name}{Style.RESET_ALL}:"
1626+
)
16251627
self._materialize_odfv(
16261628
feature_view,
16271629
start_date,
@@ -1630,7 +1632,9 @@ def materialize(
16301632
)
16311633
continue
16321634
provider = self._get_provider()
1633-
logger.info("%s:", feature_view.name)
1635+
click.echo(
1636+
f"{Style.BRIGHT + Fore.GREEN}{feature_view.name}{Style.RESET_ALL}:"
1637+
)
16341638

16351639
def tqdm_builder(length):
16361640
return tqdm(total=length, ncols=100)
@@ -2929,6 +2933,11 @@ def _print_materialization_log(
29292933
)
29302934

29312935

2936+
def _print_materializing_banner() -> None:
2937+
click.echo("Materializing...")
2938+
click.echo()
2939+
2940+
29322941
def _validate_feature_views(feature_views: List[BaseFeatureView]):
29332942
"""Verify feature views have case-insensitively unique names"""
29342943
fv_names = set()

0 commit comments

Comments
 (0)