Skip to content

Commit 813c420

Browse files
committed
fx
Signed-off-by: Danny Chiao <danny@tecton.ai>
1 parent c8b2080 commit 813c420

2 files changed

Lines changed: 8 additions & 24 deletions

File tree

sdk/python/feast/ui/README.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Example Feast UI App
22

3-
This is an example React App that imports the Feast UI module and relies on a "/projects-list" endpoint to get projects.
3+
This is an example React App that imports the Feast UI module.
44

55
See the module import in `src/index.js`. The main change this implements on top of a vanilla create-react-app is adding:
66

@@ -11,23 +11,15 @@ import "@feast-dev/feast-ui/dist/feast-ui.css";
1111

1212
ReactDOM.render(
1313
<React.StrictMode>
14-
<FeastUI
15-
feastUIConfigs={{
16-
projectListPromise: fetch("http://0.0.0.0:8888/projects-list", {
17-
headers: {
18-
"Content-Type": "application/json",
19-
},
20-
}).then((res) => {
21-
return res.json();
22-
})
23-
}}
24-
/>
14+
<FeastUI />
2515
</React.StrictMode>,
2616
document.getElementById("root")
2717
);
2818
```
2919

30-
It is used by the `feast ui` command to scaffold a local UI server. The feast python package bundles in resources produced from `npm run build --omit=dev
20+
It is used by the `feast ui` command to scaffold a local UI server. The feast python package bundles in resources produced from `npm run build --omit=dev.`
21+
22+
The `feast ui` command will generate the necessary `projects-list.json` file and initialize it for the UI to read.
3123

3224

3325
**Note**: yarn start will not work on this because of the above dependency.

sdk/python/feast/ui_server.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
import threading
33
from typing import Callable, Optional
44

5-
from importlib_resources import files, as_file
65
import uvicorn
76
from fastapi import FastAPI, Response
87
from fastapi.middleware.cors import CORSMiddleware
98
from fastapi.staticfiles import StaticFiles
9+
from importlib_resources import as_file, files
1010

1111
import feast
1212

@@ -19,8 +19,6 @@ def get_app(
1919
host: str,
2020
port: int,
2121
):
22-
ui_dir = files(__package__).joinpath("ui/build/")
23-
2422
app = FastAPI()
2523

2624
app.add_middleware(
@@ -55,9 +53,9 @@ def shutdown_event():
5553

5654
async_refresh()
5755

56+
ui_dir = files(__package__).joinpath("ui/build/")
5857
# Initialize with the projects-list.json file
59-
try:
60-
f = ui_dir.joinpath("projects-list.json").open(mode="w")
58+
with ui_dir.joinpath("projects-list.json").open(mode="w") as f:
6159
projects_dict = {
6260
"projects": [
6361
{
@@ -69,12 +67,6 @@ def shutdown_event():
6967
]
7068
}
7169
f.write(json.dumps(projects_dict))
72-
except Exception as e:
73-
raise RuntimeError(
74-
"Failed to initialize projects-list.json with registry path"
75-
) from e
76-
finally:
77-
f.close()
7870

7971
@app.get("/registry")
8072
def read_registry():

0 commit comments

Comments
 (0)