コード例 #1
0
ファイル: feature_store.py プロジェクト: tedhtchang/feast
    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),
        )
コード例 #2
0
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
コード例 #3
0
    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()
コード例 #4
0
ファイル: feature_store.py プロジェクト: sukumar45/feast
    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()
コード例 #5
0
ファイル: cli.py プロジェクト: tleyden/feast
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())
コード例 #6
0
ファイル: cli.py プロジェクト: tleyden/feast
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())
コード例 #7
0
ファイル: cli.py プロジェクト: terryyylim/feast
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)
コード例 #8
0
ファイル: cli.py プロジェクト: danielsiwiec/feast
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)
コード例 #9
0
ファイル: cli.py プロジェクト: danielsiwiec/feast
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())
コード例 #10
0
ファイル: cli.py プロジェクト: danielsiwiec/feast
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())
コード例 #11
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)
コード例 #12
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)
コード例 #13
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())
コード例 #14
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))
コード例 #15
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))
コード例 #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))
コード例 #17
0
 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")),
         )
コード例 #18
0
ファイル: feature_store.py プロジェクト: tsotnet/feast
    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),
        )