-
Notifications
You must be signed in to change notification settings - Fork 978
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Projects optional & Update Feature References (#693)
* Squash and rebase on master Squashed commits: * Update e2e test verify that users can retrieve from multiple featuresets in batch serving * Add e2e test verify that users can retrieve from multiple featuresets in online serving * Remove and Reserve version field in FeatureReference in ServingService proto * Clarify comment in SpecService docs * Update BQ Retriever to only namespace returned features with featureset only when explictly specified in feature reference. * Configure BQ Retriever SQL queries to namespace returned feature column with feature set name * Resolve unresolved rebase markers in Python's SDK client docs * Squash and Rebase on master * history: * Fix batch e2e failing as new SDK does not accept feature refs with projects. * Fix e2e batch tests: remove rebase markers * Fix keyerror in end to end tests * Fix e2e test that still has removed versions * Correct spelling of omitted in SpecService * Squash and rebase on version removal PR * Fix java lint * Remove comments in JobServiceTest that do not comply with JavaDoc * Clarify naming of unit test in SpecServiceTest * Fix python linting * Refactor AccessManagementService's archiveProject() to use guard clauses * Update Go SDK to strip the project part of string feature references returned from serving * Update Java SDK to strip the project part of string feature references returned from serving * Update Python SDK to strip the project part of string feature references returned from serving * Fix java unit tests afeter adding check for duplicate feature references * Remove trailing whitespace to satisfy python lint. * Fix typo in e2e * Add check that multiple feature references in get online/batch features don't refer to the same feature * Fix end to end tests referencing the same feature in different references * Fix typo in call to get_feature_set in e2e tests. * Fix issue in e2e test where client persisted wrong project. Should used default instead. * Remove support of projects in string Feature References in java SDK * Remove support of projects in string Feature References in go SDK * Remove support of projects in string Feature References in python SDK * Fix python SDK linting failures * Update documentation in CoreService proto to document that field names are unique with a featureset * Update E2E tests to check default project and updated feature reference functionality * Fixed Python SDK's FeatureSetRef rendering with missing project * Make Python's SDK client's archive_project() revert to default project on archive. * Make Feast Core throw an error when the user attempts to archive the default project * Apply spotless formatting to java SDK's RequestUtil * Updated python SDK's client's to parse feature refs without projects and with feature sets * Update Go SDK buildFeatureRefs() to parse feature refs without projects and with feature sets * Regenrate go protos for Go SDK using make compile-protos-go * Changes Java SDK's FeastClient defaultProject to project which overrides project in feature refs. * Updated Java SDK's RequestUtil to parse string feature refs without project/with feature set. * Refactor CachedSpecService to support different variations of feature references. * Update RefUtil's generateFeatureStringRef to FeatureReference with featureset name field * Add missing final to make core Project models's DEFAULT_NAME into a constant. * Added feature_set_name field to ServingService's FeatureReference proto * Remove projects from JobUpdateTask's unit tests * Remove projects from ServingServiceGRpcControllerTest's unit tests. * Remove projects from OnlineServingService's unit tests. * Update CachedSpecService's getFeatureToFeatureSetMapping() to match Feature References with no project. * Update RefUtil's generateFeatureStringRef() to properly render refs without a project * Document in CoreService proto that specifying project in list, get, update featureset is optional * Update SpecService's applyFeatureSet() to auto default project if not specified. * Update SpecService's listFeatureSets() to autofill default project if project unspecified. * Remove comment as FeatureSet's id is no longer a String. * Update SpecService's getFeatureSet() to autofill default project if project unspecified. * Config AccessManagementService to create default project in constructor * Document that FeatureReference's project field is optional. * Allow CachedSpecService's getFeatureSets() to match FeatureReferences with no project by autofilling default project * Make CachedSpecService's featureSetCacheLoader a local var instead of private property as its only used once. * Change SpecServiceTest to use global default project constant. * Make AccessManagementService's archiveProject() throw UnimplementOperation error when trying to archive default project. * Correct incorrect documentation on source being ignored on Core's ApplyFeatureSet * Use ValueProto.Value in java SDK's FeastClient lambda instead of generic Object * Clarify how the ignore project param of feature ref to string() worked in docs in SDKs * Correct missing test to check for empty feature refs in java SDK. * Clarified ref_protos to feature_ref_protos to make code clearer * Rename ServingService's FeatureReference proto 'feature_set_name` to `feature_set` * Remove nested function strip_project() with loop with python SDK's client's get_online_features() * Remove extra version paramter in python sdk test's TestFeatureRef * Change CachedSpecService's "hasProject == true" to more concise "!hasProject" * Removed setFeatureSet() calls to OnlineServingServiceTest as it does not need to be set in the unit test * Make client.set_project() without args reset project to default in python SDK * Updated e2e to test for feature set inference for feature ref without feature set specified * Remove unused field max_age in FeatureReference * Fix typo in e2e * Fix error in e2e tests regarding string splits * Optimise Serving's CachedSpecService populateCache() by directly assigning map. * Remove final in CachedSpecService to allow assignment in featureToFeatureSetMapping * Remove unnescessary copy of list in QueryTemplater Co-authored-by: Zhu Zhanyan <zhu.zhanyan@gojek.com>
- Loading branch information
Showing
50 changed files
with
1,688 additions
and
1,214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
core/src/test/java/feast/core/service/AccessManagementServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Copyright 2018-2019 The Feast Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package feast.core.service; | ||
|
||
import static org.mockito.Mockito.verify; | ||
import static org.mockito.Mockito.when; | ||
import static org.mockito.MockitoAnnotations.initMocks; | ||
|
||
import feast.core.dao.ProjectRepository; | ||
import feast.core.model.Project; | ||
import java.util.Optional; | ||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.ExpectedException; | ||
import org.mockito.Mock; | ||
|
||
public class AccessManagementServiceTest { | ||
@Rule public ExpectedException expectedException = ExpectedException.none(); | ||
// mocks | ||
@Mock private ProjectRepository projectRepository; | ||
// dummy models | ||
private Project defaultProject; | ||
private Project testProject; | ||
|
||
// test target | ||
private AccessManagementService accessService; | ||
|
||
@Before | ||
public void setup() { | ||
initMocks(this); | ||
// setup dummy models for testing | ||
this.defaultProject = new Project(Project.DEFAULT_NAME); | ||
this.testProject = new Project("project"); | ||
// setup test target | ||
when(this.projectRepository.existsById(Project.DEFAULT_NAME)).thenReturn(false); | ||
this.accessService = new AccessManagementService(this.projectRepository); | ||
} | ||
|
||
@Test | ||
public void testDefaultProjectCreateInConstructor() { | ||
verify(this.projectRepository).saveAndFlush(this.defaultProject); | ||
} | ||
|
||
@Test | ||
public void testArchiveProject() { | ||
when(this.projectRepository.findById("project")).thenReturn(Optional.of(this.testProject)); | ||
this.accessService.archiveProject("project"); | ||
this.testProject.setArchived(true); | ||
verify(this.projectRepository).saveAndFlush(this.testProject); | ||
// reset archived flag | ||
this.testProject.setArchived(false); | ||
} | ||
|
||
@Test | ||
public void shouldNotArchiveDefaultProject() { | ||
expectedException.expect(IllegalArgumentException.class); | ||
this.accessService.archiveProject(Project.DEFAULT_NAME); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.