()
| 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 | project_name = pathlib.Path(__file__).parent.absolute().name |
| 14 | data_path = repo_path / "data" |
| 15 | data_path.mkdir(exist_ok=True) |
| 16 | |
| 17 | end_date = datetime.now().replace(microsecond=0, second=0, minute=0) |
| 18 | start_date = end_date - timedelta(days=15) |
| 19 | |
| 20 | driver_entities = [1001, 1002, 1003, 1004, 1005] |
| 21 | driver_df = create_driver_hourly_stats_df(driver_entities, start_date, end_date) |
| 22 | |
| 23 | driver_stats_path = data_path / "driver_stats.parquet" |
| 24 | driver_df.to_parquet(path=str(driver_stats_path), allow_truncated_timestamps=True) |
| 25 | |
| 26 | example_py_file = repo_path / "feature_definitions.py" |
| 27 | replace_str_in_file(example_py_file, "%PROJECT_NAME%", str(project_name)) |
| 28 | replace_str_in_file( |
| 29 | example_py_file, "%PARQUET_PATH%", str(driver_stats_path.relative_to(repo_path)) |
| 30 | ) |
| 31 | replace_str_in_file( |
| 32 | example_py_file, "%LOGGING_PATH%", str(data_path.relative_to(repo_path)) |
| 33 | ) |
| 34 | |
| 35 | |
| 36 | if __name__ == "__main__": |
no test coverage detected