()
| 12 | |
| 13 | |
| 14 | def bootstrap(): |
| 15 | # Bootstrap() will automatically be called from the init_repo() during `feast init` |
| 16 | |
| 17 | import pathlib |
| 18 | from datetime import datetime, timedelta |
| 19 | |
| 20 | from feast.driver_test_data import create_driver_hourly_stats_df |
| 21 | |
| 22 | repo_path = pathlib.Path(__file__).parent.absolute() / "feature_repo" |
| 23 | config_file = repo_path / "feature_store.yaml" |
| 24 | |
| 25 | if click.confirm("Configure Couchbase Online Store?", default=True): |
| 26 | connection_string = click.prompt( |
| 27 | "Couchbase Connection String", default="couchbase://127.0.0.1" |
| 28 | ) |
| 29 | user = click.prompt("Couchbase Username", default="Administrator") |
| 30 | password = click.prompt("Couchbase Password", hide_input=True) |
| 31 | bucket_name = click.prompt("Couchbase Bucket Name", default="feast") |
| 32 | kv_port = click.prompt("Couchbase KV Port", default=11210) |
| 33 | |
| 34 | replace_str_in_file( |
| 35 | config_file, "COUCHBASE_CONNECTION_STRING", connection_string |
| 36 | ) |
| 37 | replace_str_in_file(config_file, "COUCHBASE_USER", user) |
| 38 | replace_str_in_file(config_file, "COUCHBASE_PASSWORD", password) |
| 39 | replace_str_in_file(config_file, "COUCHBASE_BUCKET_NAME", bucket_name) |
| 40 | replace_str_in_file(config_file, "COUCHBASE_KV_PORT", str(kv_port)) |
| 41 | |
| 42 | if click.confirm( |
| 43 | "Configure Couchbase Columnar Offline Store? (Note: requires Couchbase Capella Columnar)", |
| 44 | default=True, |
| 45 | ): |
| 46 | end_date = datetime.now().replace(microsecond=0, second=0, minute=0) |
| 47 | start_date = end_date - timedelta(days=15) |
| 48 | |
| 49 | driver_entities = [1001, 1002, 1003, 1004, 1005] |
| 50 | driver_df = create_driver_hourly_stats_df(driver_entities, start_date, end_date) |
| 51 | |
| 52 | columnar_connection_string = click.prompt("Columnar Connection String") |
| 53 | columnar_user = click.prompt("Columnar Username") |
| 54 | columnar_password = click.prompt("Columnar Password", hide_input=True) |
| 55 | columnar_timeout = click.prompt("Couchbase Columnar Timeout", default=120) |
| 56 | |
| 57 | if click.confirm( |
| 58 | 'Should I upload example data to Couchbase Capella Columnar (overwriting "Default.Default.feast_driver_hourly_stats" table)?', |
| 59 | default=True, |
| 60 | ): |
| 61 | cred = Credential.from_username_and_password( |
| 62 | columnar_user, columnar_password |
| 63 | ) |
| 64 | timeout_opts = TimeoutOptions(dispatch_timeout=timedelta(seconds=120)) |
| 65 | cluster = Cluster.create_instance( |
| 66 | columnar_connection_string, |
| 67 | cred, |
| 68 | ClusterOptions(timeout_options=timeout_opts), |
| 69 | ) |
| 70 | |
| 71 | table_name = "Default.Default.feast_driver_hourly_stats" |
no test coverage detected