-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathbootstrap.py
More file actions
37 lines (31 loc) · 1.17 KB
/
bootstrap.py
File metadata and controls
37 lines (31 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
def bootstrap():
# Bootstrap() will automatically be called from the init_repo() during `feast init`
import pathlib
from datetime import datetime, timedelta
from feast.driver_test_data import (
create_customer_daily_profile_df,
create_driver_hourly_stats_df,
)
repo_path = pathlib.Path(__file__).parent.absolute() / "feature_repo"
data_path = repo_path / "data"
data_path.mkdir(exist_ok=True)
driver_entities = [1001, 1002, 1003]
end_date = datetime.now().replace(microsecond=0, second=0, minute=0)
start_date = end_date - timedelta(days=15)
driver_stats_df = create_driver_hourly_stats_df(
driver_entities, start_date, end_date
)
driver_stats_df.to_parquet(
path=str(data_path / "driver_hourly_stats.parquet"),
allow_truncated_timestamps=True,
)
customer_entities = [201, 202, 203]
customer_profile_df = create_customer_daily_profile_df(
customer_entities, start_date, end_date
)
customer_profile_df.to_parquet(
path=str(data_path / "customer_daily_profile.parquet"),
allow_truncated_timestamps=True,
)
if __name__ == "__main__":
bootstrap()