Skip to content

Commit

Permalink
feat: Add Go option to feast serve command (#2966)
Browse files Browse the repository at this point in the history
Add Go option to `feast serve` command

Signed-off-by: Felix Wang <wangfelix98@gmail.com>
  • Loading branch information
felixwang9817 committed Jul 21, 2022
1 parent ffab04c commit a36a695
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions sdk/python/feast/cli.py
Expand Up @@ -118,21 +118,24 @@ def version():
"-h",
type=click.STRING,
default="0.0.0.0",
help="Specify a host for the server [default: 0.0.0.0]",
show_default=True,
help="Specify a host for the server",
)
@click.option(
"--port",
"-p",
type=click.INT,
default=8888,
help="Specify a port for the server [default: 8888]",
show_default=True,
help="Specify a port for the server",
)
@click.option(
"--registry_ttl_sec",
"-r",
help="Number of seconds after which the registry is refreshed. Default is 5 seconds.",
help="Number of seconds after which the registry is refreshed",
type=int,
default=5,
show_default=True,
)
@click.pass_context
def ui(ctx: click.Context, host: str, port: int, registry_ttl_sec: int):
Expand Down Expand Up @@ -610,31 +613,42 @@ def init_command(project_directory, minimal: bool, template: str):
"-h",
type=click.STRING,
default="127.0.0.1",
help="Specify a host for the server [default: 127.0.0.1]",
show_default=True,
help="Specify a host for the server",
)
@click.option(
"--port",
"-p",
type=click.INT,
default=6566,
help="Specify a port for the server [default: 6566]",
show_default=True,
help="Specify a port for the server",
)
@click.option(
"--type",
"-t",
"type_",
type=click.STRING,
default="http",
help="Specify a server type: 'http' or 'grpc' [default: http]",
show_default=True,
help="Specify a server type: 'http' or 'grpc'",
)
@click.option(
"--go",
is_flag=True,
show_default=True,
help="Use Go to serve",
)
@click.option(
"--no-access-log",
is_flag=True,
help="Disable the Uvicorn access log.",
show_default=True,
help="Disable the Uvicorn access log",
)
@click.option(
"--no-feature-log",
is_flag=True,
show_default=True,
help="Disable logging served features",
)
@click.pass_context
Expand All @@ -643,6 +657,7 @@ def serve_command(
host: str,
port: int,
type_: str,
go: bool,
no_access_log: bool,
no_feature_log: bool,
):
Expand All @@ -651,6 +666,10 @@ def serve_command(
cli_check_repo(repo)
store = FeatureStore(repo_path=str(repo))

if go:
# Turn on Go feature retrieval.
store.config.go_feature_retrieval = True

store.serve(host, port, type_, no_access_log, no_feature_log)


Expand Down

0 comments on commit a36a695

Please sign in to comment.