question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Split up parse_repo and apply_total

See original GitHub issue

Is your feature request related to a problem? Please describe. I have a framework that handles the offline store. It creates the tables, indexes, reads data from different data sources, does some transformations, and then inserts into the offline store. As a part of this, I can construct the entities, feature views, feature services, etc, a instance of the ParsedRepo class for Feast. What I need is the ability to pass my instance into the apply_total method.

Describe the solution you’d like Remove the call to parse_repo from the apply_total ( link ) and instead perform that call elsewhere and pass the ParsedRepo object into the apply_total function.

Describe alternatives you’ve considered Copy the apply_total method into my code and make the changes needed. The reason why I don’t like this approach is because I would be maintaining a copy/paste of the method, while the change in the Feast repo wouldn’t impact functionality since feast apply would still call parse_repo and then pass the object to apply_total.

@cli.command("apply", cls=NoOptionDefaultFormat)
@click.option(
    "--skip-source-validation",
    is_flag=True,
    help="Don't validate the data sources by checking for that the tables exist.",
)
@click.pass_context
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:
        parsed_repo = parse_repo(repo) # <- this
        apply_total(parsed_repo, repo_config, repo, skip_source_validation)
    except FeastProviderLoginError as e:
        print(str(e))

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pyalexcommented, Dec 10, 2021

Hi @nossrannug , I think this apply_total was not intended to be used directly and seems to be written specifically for CLI. That being said, it could be easily split into sub-functions. And those sub-functions could be reused directly or new interfaces can be created. If you have time, please feel free to contribute.

0reactions
nossrannugcommented, Jan 19, 2022

So something like this?

@log_exceptions_and_usage
def apply_total(repo_config: RepoConfig, repo_path: Path, skip_source_validation: bool):

    os.chdir(repo_path)
    repo = _parse_repo(repo_path)
    do_stuff(repo_config, repo, sip_source_validation)

def do_stuff(repo_config: RepoConfig, repo: RepoContents, skip_source_validation: bool):
   project, registry, store = _prepare_registry(repo_config)

    if not skip_source_validation:
        data_sources = [t.batch_source for t in repo.feature_views]
        # Make sure the data source used by this feature view is supported by Feast
        for data_source in data_sources:
            data_source.validate(store.config)

    # For each object in the registry, determine whether it should be kept or deleted.
    (
        all_to_apply,
        all_to_delete,
        views_to_delete,
        views_to_keep,
    ) = extract_objects_for_apply_delete(project, registry, repo)

    diff = store.apply(all_to_apply, objects_to_delete=all_to_delete, partial=False)

    log_cli_output(diff, views_to_delete, views_to_keep)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Parsing Strings with split - cs.wisc.edu
When there is just one character used as a delimiter. Example 1. We want to divide up a phrase into words where spaces...
Read more >
Types of Parsers in Compiler Design - GeeksforGeeks
The parser is mainly classified into two categories, i.e. Top-down Parser, and Bottom-up Parser. These are explained below: ...
Read more >
Compiler Design - Bottom-Up Parser - Tutorialspoint
Compiler Design - Bottom-Up Parser, Bottom-up parsing starts from the leaf nodes of a tree and works in upward direction till it reaches...
Read more >
A Guide To Parsing: Algorithms And Terminology
An in-depth coverage of parsing terminology an issues, together with an explanation for each one of the major algorithms and when to use...
Read more >
How to Parsing Full String and split into several String in Excel ...
If that's the case you could use a CASE statement on the left part of the string up until the : to check...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found