Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions feathr_project/feathr/_feature_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,12 @@ def _extract_features(self, workspace_path: Path) -> RepoDefinitions:
return definitions

@classmethod
def save_to_feature_config(self, workspace_path: Path):
def save_to_feature_config(self, workspace_path: Path, config_save_dir: Path):
"""Save feature definition within the workspace into HOCON feature config files"""
repo_definitions = self._extract_features(workspace_path)
self._save_request_feature_config(repo_definitions)
self._save_anchored_feature_config(repo_definitions)
self._save_derived_feature_config(repo_definitions)
self._save_request_feature_config(repo_definitions, config_save_dir)
self._save_anchored_feature_config(repo_definitions, config_save_dir)
self._save_derived_feature_config(repo_definitions, config_save_dir)

@classmethod
def save_to_feature_config_from_context(self, anchor_list, derived_feature_list, local_workspace_dir: Path):
Expand Down
2 changes: 1 addition & 1 deletion feathr_project/feathr/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def to_feature_config(self) -> str:
tm = Template("""
{{source.name}}: {
location: {path: "{{source.path}}"}
{% if source.event_timestamp_column is defined %}
{% if source.event_timestamp_column %}
timeWindowParameters: {
timestampColumn: "{{source.event_timestamp_column}}"
timestampColumnFormat: "{{source.timestamp_format}}"
Expand Down
14 changes: 13 additions & 1 deletion feathr_project/feathrcli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import subprocess
import urllib.request
from feathr.client import FeathrClient

from feathr._feature_registry import _FeatureRegistry

@click.group()
@click.pass_context
Expand Down Expand Up @@ -71,6 +71,18 @@ def init(name, git):
click.echo(click.style('Feathr initialization completed.', fg='green'))


@cli.command()
@click.option('--save_to', default="./", help='Specify the path to save the output HOCON config(relative to current path).')
def hocon(save_to):
"""
Scan all Python-based feature definitions recursively under current directory,
convert them to HOCON config and save to a given path (relative to current directory).
"""
scan_dir = Path.cwd()
save_to = Path(os.path.join(scan_dir, save_to))
_FeatureRegistry.save_to_feature_config(scan_dir, save_to)


@cli.command()
@click.argument('filepath', default='feature_join_conf/feature_join.conf', type=click.Path(exists=True))
def join(filepath):
Expand Down