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
17 changes: 14 additions & 3 deletions sdk/python/feast/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,16 +474,27 @@ def init_command(project_directory, minimal: bool, template: str):

@cli.command("serve")
@click.option(
"--port", "-p", type=click.INT, default=6566, help="Specify a port for the server"
"--host",
"-h",
type=click.STRING,
default="127.0.0.1",
help="Specify a host for the server [default: 127.0.0.1]",
)
@click.option(
"--port",
"-p",
type=click.INT,
default=6566,
help="Specify a port for the server [default: 6566]",
)
@click.pass_context
def serve_command(ctx: click.Context, port: int):
def serve_command(ctx: click.Context, host: str, 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(port)
store.serve(host, port)


@cli.command("serve_transformations")
Expand Down
4 changes: 2 additions & 2 deletions sdk/python/feast/feature_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ async def get_online_features(request: Request):
return app


def start_server(store: "feast.FeatureStore", port: int):
def start_server(store: "feast.FeatureStore", host: str, port: int):
app = get_app(store)
click.echo(
"This is an "
+ click.style("experimental", fg="yellow", bold=True, underline=True)
+ " feature. It's intended for early testing and feedback, and could change without warnings in future releases."
)
uvicorn.run(app, host="127.0.0.1", port=port)
uvicorn.run(app, host=host, port=port)
4 changes: 2 additions & 2 deletions sdk/python/feast/feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -1360,12 +1360,12 @@ def _get_feature_views_to_use(
return views_to_use

@log_exceptions_and_usage
def serve(self, port: int) -> None:
def serve(self, host: str, port: int) -> None:
"""Start the feature consumption server locally on a given port."""
if not flags_helper.enable_python_feature_server(self.config):
raise ExperimentalFeatureNotEnabled(flags.FLAG_PYTHON_FEATURE_SERVER_NAME)

feature_server.start_server(self, port)
feature_server.start_server(self, host, port)

@log_exceptions_and_usage
def get_feature_server_endpoint(self) -> Optional[str]:
Expand Down