def __init__( self, repo_path: Optional[str] = None, config: Optional[RepoConfig] = None, ): """ Creates a FeatureStore object. Raises: ValueError: If both or neither of repo_path and config are specified. """ if repo_path is not None and config is not None: raise ValueError("You cannot specify both repo_path and config.") if config is not None: self.repo_path = Path(os.getcwd()) self.config = config elif repo_path is not None: self.repo_path = Path(repo_path) self.config = load_repo_config(Path(repo_path)) else: raise ValueError("Please specify one of repo_path or config.") registry_config = self.config.get_registry_config() self._registry = Registry( registry_path=registry_config.path, repo_path=self.repo_path, cache_ttl=timedelta(seconds=registry_config.cache_ttl_seconds), )
def _test_config(config_text, expect_error: Optional[str]): """ Try loading a repo config and check raised error against a regex. """ with tempfile.TemporaryDirectory() as repo_dir_name: repo_path = Path(repo_dir_name) repo_config = repo_path / "feature_store.yaml" repo_config.write_text(config_text) error = None rc = None try: rc = load_repo_config(repo_path) except FeastConfigError as e: error = e if expect_error is not None: assert expect_error in str(error) else: print(f"error: {error}") assert error is None return rc
def __init__( self, repo_path: Optional[str] = None, config: Optional[RepoConfig] = None, ): self.repo_path = repo_path if repo_path is not None and config is not None: raise ValueError("You cannot specify both repo_path and config") if config is not None: self.config = config elif repo_path is not None: self.config = load_repo_config(Path(repo_path)) else: self.config = RepoConfig( registry="./registry.db", project="default", provider="local", online_store=OnlineStoreConfig( local=LocalOnlineStoreConfig(path="online_store.db") ), ) registry_config = self.config.get_registry_config() self._registry = Registry( registry_path=registry_config.path, cache_ttl=timedelta(seconds=registry_config.cache_ttl_seconds), ) self._tele = Telemetry()
def __init__( self, repo_path: Optional[str] = None, config: Optional[RepoConfig] = None, ): """ Initializes a new FeatureStore object. Used to manage a feature store. Args: repo_path: Path to a `feature_store.yaml` used to configure the feature store config (RepoConfig): Configuration object used to configure the feature store """ if repo_path is not None and config is not None: raise ValueError("You cannot specify both repo_path and config") if config is not None: self.repo_path = Path(os.getcwd()) self.config = config elif repo_path is not None: self.repo_path = Path(repo_path) self.config = load_repo_config(Path(repo_path)) else: raise ValueError("Please specify one of repo_path or config") registry_config = self.config.get_registry_config() self._registry = Registry( registry_path=registry_config.path, repo_path=self.repo_path, cache_ttl=timedelta(seconds=registry_config.cache_ttl_seconds), ) self._tele = Telemetry()
def teardown_command(repo_path: str): """ Tear down infra for a feature repo """ repo_config = load_repo_config(Path(repo_path)) teardown(repo_config, Path(repo_path).resolve())
def apply_total_command(repo_path: str): """ Applies a feature repo """ repo_config = load_repo_config(Path(repo_path)) apply_total(repo_config, Path(repo_path).resolve())
def registry_dump_command(repo_path: str): """ Prints contents of the metadata registry """ repo_config = load_repo_config(Path(repo_path)) registry_dump(repo_config)
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)
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())
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())
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)
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)
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())
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))
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))
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))
def __init__( self, repo_path: Optional[str] = None, config: Optional[RepoConfig] = None, ): if repo_path is not None and config is not None: raise ValueError("You cannot specify both repo_path and config") if config is not None: self.config = config elif repo_path is not None: self.config = load_repo_config(Path(repo_path)) else: self.config = RepoConfig( metadata_store="./metadata.db", project="default", provider="local", online_store=OnlineStoreConfig( local=LocalOnlineStoreConfig("online_store.db")), )
def __init__( self, repo_path: Optional[str] = None, config: Optional[RepoConfig] = None, ): if repo_path is not None and config is not None: raise ValueError("You cannot specify both repo_path and config") if config is not None: self.repo_path = Path(os.getcwd()) self.config = config elif repo_path is not None: self.repo_path = Path(repo_path) self.config = load_repo_config(Path(repo_path)) else: raise ValueError("Please specify one of repo_path or config") registry_config = self.config.get_registry_config() self._registry = Registry( registry_path=registry_config.path, repo_path=self.repo_path, cache_ttl=timedelta(seconds=registry_config.cache_ttl_seconds), )