Example #1
0
File: cli.py Project: qooba/feast
def feature_view_list(ctx: click.Context):
    """
    List all feature views
    """
    repo = ctx.obj["CHDIR"]
    cli_check_repo(repo)
    store = FeatureStore(repo_path=str(repo))
    table = []
    for feature_view in [
            *store.list_feature_views(),
            *store.list_request_feature_views(),
            *store.list_on_demand_feature_views(),
    ]:
        entities = set()
        if isinstance(feature_view, FeatureView):
            entities.update(feature_view.entities)
        elif isinstance(feature_view, OnDemandFeatureView):
            for backing_fv in feature_view.inputs.values():
                if isinstance(backing_fv, FeatureView):
                    entities.update(backing_fv.entities)
        table.append([
            feature_view.name,
            entities if len(entities) > 0 else "n/a",
            type(feature_view).__name__,
        ])

    from tabulate import tabulate

    print(
        tabulate(table, headers=["NAME", "ENTITIES", "TYPE"],
                 tablefmt="plain"))
Example #2
0
File: cli.py Project: qooba/feast
def serve_transformations_command(ctx: click.Context, port: int):
    """[Experimental] Start a the feature consumption server locally on a given port."""
    repo = ctx.obj["CHDIR"]
    cli_check_repo(repo)
    store = FeatureStore(repo_path=str(repo))

    store.serve_transformations(port)
Example #3
0
def apply_total_command():
    """
    Create or update a feature store deployment
    """
    cli_check_repo(Path.cwd())
    repo_config = load_repo_config(Path.cwd())

    apply_total(repo_config, Path.cwd())
Example #4
0
def teardown_command():
    """
    Tear down deployed feature store infrastructure
    """
    cli_check_repo(Path.cwd())
    repo_config = load_repo_config(Path.cwd())

    teardown(repo_config, Path.cwd())
Example #5
0
def registry_dump_command():
    """
    Print contents of the metadata registry
    """
    cli_check_repo(Path.cwd())
    repo_config = load_repo_config(Path.cwd())

    registry_dump(repo_config)
Example #6
0
def teardown_command(repo_path: str):
    """
    Tear down infra for a feature repo
    """
    cli_check_repo(Path(repo_path))
    repo_config = load_repo_config(Path(repo_path))

    teardown(repo_config, Path(repo_path).resolve())
Example #7
0
def apply_total_command(repo_path: str):
    """
    Applies a feature repo
    """
    cli_check_repo(Path(repo_path))
    repo_config = load_repo_config(Path(repo_path))

    apply_total(repo_config, Path(repo_path).resolve())
Example #8
0
def serve_command(ctx: click.Context, host: str, port: int,
                  no_access_log: bool):
    """Start a feature server locally on a given port."""
    repo = ctx.obj["CHDIR"]
    cli_check_repo(repo)
    store = FeatureStore(repo_path=str(repo))

    store.serve(host, port, no_access_log)
Example #9
0
def registry_dump_command(ctx: click.Context):
    """
    Print contents of the metadata registry
    """
    repo = ctx.obj["CHDIR"]
    cli_check_repo(repo)
    repo_config = load_repo_config(repo)

    registry_dump(repo_config, repo_path=repo)
Example #10
0
def teardown_command(ctx: click.Context):
    """
    Tear down deployed feature store infrastructure
    """
    repo = ctx.obj["CHDIR"]
    cli_check_repo(repo)
    repo_config = load_repo_config(repo)

    teardown(repo_config, repo)
Example #11
0
def apply_total_command():
    """
    Create or update a feature store deployment
    """
    cli_check_repo(Path.cwd())
    repo_config = load_repo_config(Path.cwd())
    try:
        apply_total(repo_config, Path.cwd())
    except FeastProviderLoginError as e:
        print(str(e))
Example #12
0
def registry_dump_command():
    """
    Print contents of the metadata registry
    """
    cli_check_repo(Path.cwd())
    repo_config = load_repo_config(Path.cwd())
    tele = Telemetry()
    tele.log("registry-dump")

    registry_dump(repo_config, repo_path=Path.cwd())
Example #13
0
def apply_total_command(ctx: click.Context, skip_source_validation: bool):
    """
    Create or update a feature store deployment
    """
    repo = ctx.obj["CHDIR"]
    cli_check_repo(repo)
    repo_config = load_repo_config(repo)
    try:
        apply_total(repo_config, repo, skip_source_validation)
    except FeastProviderLoginError as e:
        print(str(e))
Example #14
0
File: cli.py Project: qooba/feast
def disable_alpha_features(ctx: click.Context):
    """
    Disables all alpha features
    """
    repo = ctx.obj["CHDIR"]
    cli_check_repo(repo)
    repo_path = str(repo)
    store = FeatureStore(repo_path=repo_path)

    store.config.flags = None
    store.config.write_to_path(Path(repo_path))
Example #15
0
def feature_view_list():
    """
    List all feature views
    """
    cli_check_repo(Path.cwd())
    store = FeatureStore(repo_path=str(Path.cwd()))
    table = []
    for feature_view in store.list_feature_views():
        table.append([feature_view.name, feature_view.entities])

    from tabulate import tabulate

    print(tabulate(table, headers=["NAME", "ENTITIES"], tablefmt="plain"))
Example #16
0
def apply_total_command(ctx: click.Context):
    """
    Create or update a feature store deployment
    """
    repo = ctx.obj["CHDIR"]
    cli_check_repo(repo)
    repo_config = load_repo_config(repo)
    tele = Telemetry()
    tele.log("apply")
    try:
        apply_total(repo_config, repo)
    except FeastProviderLoginError as e:
        print(str(e))
Example #17
0
File: cli.py Project: qooba/feast
def endpoint(ctx: click.Context):
    """
    Display feature server endpoints.
    """
    repo = ctx.obj["CHDIR"]
    cli_check_repo(repo)
    store = FeatureStore(repo_path=str(repo))
    endpoint = store.get_feature_server_endpoint()
    if endpoint is not None:
        _logger.info(
            f"Feature server endpoint: {Style.BRIGHT + Fore.GREEN}{endpoint}{Style.RESET_ALL}"
        )
    else:
        _logger.info("There is no active feature server.")
Example #18
0
File: cli.py Project: qooba/feast
def on_demand_feature_view_list(ctx: click.Context):
    """
    [Experimental] List all on demand feature views
    """
    repo = ctx.obj["CHDIR"]
    cli_check_repo(repo)
    store = FeatureStore(repo_path=str(repo))
    table = []
    for on_demand_feature_view in store.list_on_demand_feature_views():
        table.append([on_demand_feature_view.name])

    from tabulate import tabulate

    print(tabulate(table, headers=["NAME"], tablefmt="plain"))
Example #19
0
File: cli.py Project: qooba/feast
def enable_alpha_features(ctx: click.Context):
    """
    Enables all alpha features
    """
    repo = ctx.obj["CHDIR"]
    cli_check_repo(repo)
    repo_path = str(repo)
    store = FeatureStore(repo_path=repo_path)

    if store.config.flags is None:
        store.config.flags = {}
    for flag_name in flags.FLAG_NAMES:
        store.config.flags[flag_name] = True
    store.config.write_to_path(Path(repo_path))
Example #20
0
def feature_view_list(ctx: click.Context):
    """
    List all feature views
    """
    repo = ctx.obj["CHDIR"]
    cli_check_repo(repo)
    store = FeatureStore(repo_path=str(repo))
    table = []
    for feature_view in store.list_feature_views():
        table.append([feature_view.name, feature_view.entities])

    from tabulate import tabulate

    print(tabulate(table, headers=["NAME", "ENTITIES"], tablefmt="plain"))
Example #21
0
def materialize_incremental_command(end_ts: str, views: List[str]):
    """
    Run an incremental materialization job to ingest new data into the online store. Feast will read
    all data from the previously ingested point to END_TS from the offline store and write it to the
    online store. If you don't specify feature view names using --views, all registered Feature
    Views will be incrementally materialized.

    END_TS should be in ISO 8601 format, e.g. '2021-07-16T19:20:01'
    """
    cli_check_repo(Path.cwd())
    store = FeatureStore(repo_path=str(Path.cwd()))
    store.materialize_incremental(
        feature_views=None if not views else views,
        end_date=datetime.fromisoformat(end_ts),
    )
Example #22
0
def materialize_command(start_ts: str, end_ts: str, views: List[str]):
    """
    Run a (non-incremental) materialization job to ingest data into the online store. Feast
    will read all data between START_TS and END_TS from the offline store and write it to the
    online store. If you don't specify feature view names using --views, all registered Feature
    Views will be materialized.

    START_TS and END_TS should be in ISO 8601 format, e.g. '2021-07-16T19:20:01'
    """
    cli_check_repo(Path.cwd())
    store = FeatureStore(repo_path=str(Path.cwd()))
    store.materialize(
        feature_views=None if not views else views,
        start_date=datetime.fromisoformat(start_ts),
        end_date=datetime.fromisoformat(end_ts),
    )
Example #23
0
def entity_list():
    """
    List all entities
    """
    cli_check_repo(Path.cwd())
    store = FeatureStore(repo_path=str(Path.cwd()))
    table = []
    for entity in store.list_entities():
        table.append([entity.name, entity.description, entity.value_type])

    from tabulate import tabulate

    print(
        tabulate(table,
                 headers=["NAME", "DESCRIPTION", "TYPE"],
                 tablefmt="plain"))
Example #24
0
File: cli.py Project: qooba/feast
def list_alpha_features(ctx: click.Context):
    """
    Lists all alpha features
    """
    repo = ctx.obj["CHDIR"]
    cli_check_repo(repo)
    repo_path = str(repo)
    store = FeatureStore(repo_path=repo_path)

    flags_to_show = flags.FLAG_NAMES.copy()
    flags_to_show.remove(flags.FLAG_ALPHA_FEATURES_NAME)
    print("Alpha features:")
    for flag in flags_to_show:
        enabled_string = ("enabled" if flags_helper.feature_flag_enabled(
            store.config, flag) else "disabled")
        print(f"{flag}: {enabled_string}")
Example #25
0
File: cli.py Project: qooba/feast
def disable_alpha_feature(ctx: click.Context, name: str):
    """
    Disables an alpha feature
    """
    if name not in flags.FLAG_NAMES:
        raise ValueError(f"Flag name, {name}, not valid.")

    repo = ctx.obj["CHDIR"]
    cli_check_repo(repo)
    repo_path = str(repo)
    store = FeatureStore(repo_path=repo_path)

    if store.config.flags is None or name not in store.config.flags:
        return
    store.config.flags[name] = False
    store.config.write_to_path(Path(repo_path))
Example #26
0
def feature_view_describe(name: str):
    """
    Describe a feature view
    """
    cli_check_repo(Path.cwd())
    store = FeatureStore(repo_path=str(Path.cwd()))

    try:
        feature_view = store.get_feature_view(name)
    except FeastObjectNotFoundException as e:
        print(e)
        exit(1)

    print(
        yaml.dump(yaml.safe_load(str(feature_view)),
                  default_flow_style=False,
                  sort_keys=False))
Example #27
0
def entity_describe(name: str):
    """
    Describe an entity
    """
    cli_check_repo(Path.cwd())
    store = FeatureStore(repo_path=str(Path.cwd()))

    try:
        entity = store.get_entity(name)
    except FeastObjectNotFoundException as e:
        print(e)
        exit(1)

    print(
        yaml.dump(yaml.safe_load(str(entity)),
                  default_flow_style=False,
                  sort_keys=False))
Example #28
0
File: cli.py Project: qooba/feast
def enable_alpha_feature(ctx: click.Context, name: str):
    """
    Enables an alpha feature
    """
    if name not in flags.FLAG_NAMES:
        raise ValueError(f"Flag name, {name}, not valid.")

    repo = ctx.obj["CHDIR"]
    cli_check_repo(repo)
    repo_path = str(repo)
    store = FeatureStore(repo_path=repo_path)

    if store.config.flags is None:
        store.config.flags = {}
    store.config.flags[flags.FLAG_ALPHA_FEATURES_NAME] = True
    store.config.flags[name] = True
    store.config.write_to_path(Path(repo_path))
Example #29
0
def entity_list(ctx: click.Context):
    """
    List all entities
    """
    repo = ctx.obj["CHDIR"]
    cli_check_repo(repo)
    store = FeatureStore(repo_path=str(repo))
    table = []
    for entity in store.list_entities():
        table.append([entity.name, entity.description, entity.value_type])

    from tabulate import tabulate

    print(
        tabulate(table,
                 headers=["NAME", "DESCRIPTION", "TYPE"],
                 tablefmt="plain"))
Example #30
0
def entity_describe(ctx: click.Context, name: str):
    """
    Describe an entity
    """
    repo = ctx.obj["CHDIR"]
    cli_check_repo(repo)
    store = FeatureStore(repo_path=str(repo))

    try:
        entity = store.get_entity(name)
    except FeastObjectNotFoundException as e:
        print(e)
        exit(1)

    print(
        yaml.dump(yaml.safe_load(str(entity)),
                  default_flow_style=False,
                  sort_keys=False))