Visitar URL original
changed shared registry logic · feast-dev/feast@5554f43 · GitHub
Skip to content

Commit 5554f43

Browse files
Vperiodtntkathole
authored andcommitted
changed shared registry logic
Signed-off-by: Vanshika Vanshika <vvanshik@redhat.com> rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED
1 parent 5678f4f commit 5554f43

3 files changed

Lines changed: 51 additions & 17 deletions

File tree

‎sdk/python/feast/cli/cli.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@
5353
from feast.errors import FeastProviderLoginError
5454
from feast.repo_config import load_repo_config
5555
from feast.repo_operations import (
56+
DEFAULT_DEMO_REPOS,
5657
apply_total,
5758
cli_check_repo,
5859
create_feature_store,
59-
DEFAULT_DEMO_REPOS,
6060
generate_project_name,
6161
init_repo,
6262
plan,
@@ -424,6 +424,7 @@ def materialize_incremental_command(ctx: click.Context, end_ts: str, views: List
424424
end_date=utils.make_tzaware(datetime.fromisoformat(end_ts)),
425425
)
426426

427+
427428
@cli.command("init")
428429
@click.argument("PROJECT_DIRECTORY", required=False)
429430
@click.option(
@@ -481,7 +482,12 @@ def init_command(
481482
)
482483
base_path.mkdir(parents=True, exist_ok=True)
483484
for repo_name, template_name in DEFAULT_DEMO_REPOS:
484-
init_repo(repo_name, template_name, str(base_path / repo_name))
485+
init_repo(
486+
repo_name,
487+
template_name,
488+
str(base_path / repo_name),
489+
shared_registry=True,
490+
)
485491
return
486492

487493
init_repo(project_directory, template, repo_path)

‎sdk/python/feast/repo_operations.py‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,17 @@ def cli_check_repo(repo_path: Path, fs_yaml_file: Path):
488488
)
489489
sys.exit(1)
490490

491+
491492
DEFAULT_DEMO_REPOS = [("driver", "local"), ("rag", "rag")]
492493

493-
def init_repo(repo_name: str, template: str, repo_path: Optional[str] = None):
494+
495+
def init_repo(
496+
repo_name: str,
497+
template: str,
498+
repo_path: Optional[str] = None,
499+
*,
500+
shared_registry: bool = False,
501+
):
494502
import os
495503
from pathlib import Path
496504
from shutil import copytree
@@ -555,8 +563,12 @@ def init_repo(repo_name: str, template: str, repo_path: Optional[str] = None):
555563
feature_store_yaml_path, "project: my_project", f"project: {repo_name}"
556564
)
557565

558-
# Default driver+rag demos: shared registry at project root.
559-
if (repo_name, template) in DEFAULT_DEMO_REPOS and feature_store_yaml_path.exists():
566+
# Multi-demo default flow only: shared registry at project root.
567+
if (
568+
shared_registry
569+
and (repo_name, template) in DEFAULT_DEMO_REPOS
570+
and feature_store_yaml_path.exists()
571+
):
560572
with open(feature_store_yaml_path) as f:
561573
config = yaml.safe_load(f)
562574
if config and isinstance(config.get("registry"), str):

‎sdk/python/feast/templates/rag/bootstrap.py‎

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
def bootstrap():
32
# Bootstrap() is called from init_repo() during `feast init`
43
import pathlib
@@ -15,22 +14,39 @@ def bootstrap():
1514
embedding_dim = 384
1615
now = datetime.now().replace(microsecond=0, tzinfo=None)
1716
cities = [
18-
(1, "New York", "New York", "New York City is the most populous city in the United States."),
19-
(2, "Los Angeles", "California", "Los Angeles is the second most populous city in the United States."),
20-
(3, "Chicago", "Illinois", "Chicago is the third most populous city in the United States."),
17+
(
18+
1,
19+
"New York",
20+
"New York",
21+
"New York City is the most populous city in the United States.",
22+
),
23+
(
24+
2,
25+
"Los Angeles",
26+
"California",
27+
"Los Angeles is the second most populous city in the United States.",
28+
),
29+
(
30+
3,
31+
"Chicago",
32+
"Illinois",
33+
"Chicago is the third most populous city in the United States.",
34+
),
2135
]
2236
rows = []
2337
for city_id, city_name, state, wiki_summary in cities:
2438
vec = np.random.randn(embedding_dim).astype(np.float32)
2539
vec = (vec / np.linalg.norm(vec)).tolist()
26-
rows.append({
27-
"city_id": city_id,
28-
"event_timestamp": pd.Timestamp(now),
29-
"vector": vec,
30-
"sentence_chunks": wiki_summary[:200],
31-
"state": f"{city_name}, {state}",
32-
"wiki_summary": wiki_summary,
33-
})
40+
rows.append(
41+
{
42+
"city_id": city_id,
43+
"event_timestamp": pd.Timestamp(now),
44+
"vector": vec,
45+
"sentence_chunks": wiki_summary[:200],
46+
"state": f"{city_name}, {state}",
47+
"wiki_summary": wiki_summary,
48+
}
49+
)
3450
df = pd.DataFrame(rows)
3551
parquet_path = data_path / "city_wikipedia_summaries_with_embeddings.parquet"
3652
df.to_parquet(path=str(parquet_path), index=False)

0 commit comments

Comments
 (0)