()
| 2 | |
| 3 | |
| 4 | def bootstrap(): |
| 5 | # Bootstrap() will automatically be called from the init_repo() during `feast init` |
| 6 | |
| 7 | import pathlib |
| 8 | from datetime import datetime, timedelta |
| 9 | |
| 10 | from feast.driver_test_data import create_driver_hourly_stats_df |
| 11 | |
| 12 | repo_path = pathlib.Path(__file__).parent.absolute() / "feature_repo" |
| 13 | data_path = repo_path / "data" |
| 14 | data_path.mkdir(exist_ok=True) |
| 15 | |
| 16 | end_date = datetime.now().replace(microsecond=0, second=0, minute=0) |
| 17 | start_date = end_date - timedelta(days=15) |
| 18 | |
| 19 | driver_entities = [1001, 1002, 1003, 1004, 1005] |
| 20 | driver_df = create_driver_hourly_stats_df(driver_entities, start_date, end_date) |
| 21 | |
| 22 | driver_stats_path = data_path / "driver_stats.parquet" |
| 23 | driver_df.to_parquet(path=str(driver_stats_path), allow_truncated_timestamps=True) |
| 24 | |
| 25 | example_py_file = repo_path / "feature_definitions.py" |
| 26 | replace_str_in_file( |
| 27 | example_py_file, "%PARQUET_PATH%", str(driver_stats_path.relative_to(repo_path)) |
| 28 | ) |
| 29 | |
| 30 | |
| 31 | if __name__ == "__main__": |
no test coverage detected