Skip to content

Commit

Permalink
fixed issues with test and project creation moved to init
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhargav Dodla committed Sep 29, 2023
1 parent 1e8ec3a commit 8b2c5ca
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 121 deletions.
13 changes: 12 additions & 1 deletion sdk/python/feast/infra/registry/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def __init__(
headers={"Content-Type": "application/json"},
)
self.project = project
self.apply_project(self.project)
self.cached_registry_proto = self.proto()
proto_registry_utils.init_project_metadata(self.cached_registry_proto, project)
self.cached_registry_proto_created = datetime.utcnow()
self._refresh_lock = Lock()
self.cached_registry_proto_ttl = timedelta(
Expand All @@ -102,6 +102,17 @@ def _send_request(self, method: str, url: str, params=None, data=None):
except Exception as exception:
self._handle_exception(exception)

def apply_project(
self, entity: Entity, project: str, commit: bool = True
) -> ProjectMetadataModel:
try:
url = f"{self.base_url}/projects"
params = {"project": project, "commit": commit}
response_data = self._send_request("PUT", url, params=params)
return ProjectMetadataModel.parse_obj(response_data)
except Exception as exception:
self._handle_exception(exception)

def apply_entity(self, entity: Entity, project: str, commit: bool = True):
try:
url = f"{self.base_url}/projects/{project}/entities"
Expand Down
Loading

0 comments on commit 8b2c5ca

Please sign in to comment.