Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions common-test/src/main/java/feast/common/it/DataGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,28 @@ public static Triple<String, String, Boolean> getDefaultSubscription() {
return defaultSubscription;
}

public static String valueToString(ValueProto.Value v) {
String stringRepr;
switch (v.getValCase()) {
case STRING_VAL:
stringRepr = v.getStringVal();
break;
case INT64_VAL:
stringRepr = String.valueOf(v.getInt64Val());
break;
case INT32_VAL:
stringRepr = String.valueOf(v.getInt32Val());
break;
case BYTES_VAL:
stringRepr = v.getBytesVal().toString();
break;
default:
throw new RuntimeException("Type is not supported to be entity");
}

return stringRepr;
}

public static StoreProto.Store getDefaultStore() {
return defaultStore;
}
Expand Down Expand Up @@ -247,6 +269,18 @@ public static ServingAPIProto.GetOnlineFeaturesRequestV2.EntityRow createEntityR
.build();
}

public static ServingAPIProto.GetOnlineFeaturesRequestV2.EntityRow createCompoundEntityRow(
ImmutableMap<String, ValueProto.Value> entityNameValues, long seconds) {
ServingAPIProto.GetOnlineFeaturesRequestV2.EntityRow.Builder entityRow =
ServingAPIProto.GetOnlineFeaturesRequestV2.EntityRow.newBuilder()
.setTimestamp(Timestamp.newBuilder().setSeconds(seconds));

entityNameValues.entrySet().stream()
.forEach(entry -> entityRow.putFields(entry.getKey(), entry.getValue()));

return entityRow.build();
}

public static DataSource createKinesisDataSourceSpec(
String region, String streamName, String classPath, String timestampColumn) {
return DataSource.newBuilder()
Expand Down
37 changes: 36 additions & 1 deletion serving/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,26 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>dev.feast</groupId>
<artifactId>feast-storage-connector-bigtable</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>dev.feast</groupId>
<artifactId>feast-common</artifactId>
<version>${project.version}</version>
</dependency>


<dependency>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this dependency be inside connector?

<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-bigtable-emulator</artifactId>
<version>0.130.2</version>
<scope>test</scope>
</dependency>


<!-- TODO: SLF4J is being used via Lombok, but also jog4j - pick one -->
<dependency>
<groupId>org.slf4j</groupId>
Expand Down Expand Up @@ -129,6 +143,14 @@
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<version>2.3.1.RELEASE</version>
<scope>test</scope>
</dependency>

<!--compile "io.grpc:grpc-services:${grpc.version}"-->
<dependency>
<groupId>io.grpc</groupId>
Expand Down Expand Up @@ -234,6 +256,13 @@
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.avro/avro -->
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
<version>1.10.2</version>
</dependency>

<!-- Utilities -->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
Expand Down Expand Up @@ -307,6 +336,12 @@
<version>1.15.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>gcloud</artifactId>
<version>1.15.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import feast.common.auth.config.SecurityProperties.AuthorizationProperties;
import feast.common.auth.credentials.CoreAuthenticationProperties;
import feast.common.logging.config.LoggingProperties;
import feast.storage.connectors.bigtable.retriever.BigTableStoreConfig;
import feast.storage.connectors.redis.retriever.RedisClusterStoreConfig;
import feast.storage.connectors.redis.retriever.RedisStoreConfig;
import io.lettuce.core.ReadFrom;
Expand Down Expand Up @@ -269,7 +270,7 @@ public void setName(String name) {
}

/**
* Gets the store type. Example are REDIS or REDIS_CLUSTER
* Gets the store type. Example are REDIS, REDIS_CLUSTER or BIGTABLE
*
* @return the store type as a String.
*/
Expand Down Expand Up @@ -311,6 +312,10 @@ public RedisStoreConfig getRedisConfig() {
Boolean.valueOf(this.config.getOrDefault("ssl", "false")));
}

public BigTableStoreConfig getBigtableConfig() {
return new BigTableStoreConfig(this.config.get("project_id"), this.config.get("instance_id"));
}

/**
* Sets the store config. Please protos/feast/core/Store.proto for the specific options for each
* store.
Expand All @@ -323,6 +328,7 @@ public void setConfig(Map<String, String> config) {
}

public enum StoreType {
BIGTABLE,
REDIS,
REDIS_CLUSTER;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,47 @@
*/
package feast.serving.config;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.cloud.bigtable.data.v2.BigtableDataClient;
import com.google.cloud.bigtable.data.v2.BigtableDataSettings;
import feast.serving.service.OnlineServingServiceV2;
import feast.serving.service.ServingServiceV2;
import feast.serving.specs.CachedSpecService;
import feast.storage.api.retriever.OnlineRetrieverV2;
import feast.storage.connectors.bigtable.retriever.BigTableOnlineRetriever;
import feast.storage.connectors.bigtable.retriever.BigTableStoreConfig;
import feast.storage.connectors.redis.retriever.*;
import io.opentracing.Tracer;
import java.io.IOException;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;

@Configuration
public class ServingServiceConfigV2 {
private static final Logger log = org.slf4j.LoggerFactory.getLogger(ServingServiceConfigV2.class);

@Autowired private ApplicationContext context;

@Bean
@Lazy(true)
public BigtableDataClient bigtableClient(FeastProperties feastProperties) throws IOException {
BigTableStoreConfig config = feastProperties.getActiveStore().getBigtableConfig();
String projectId = config.getProjectId();
String instanceId = config.getInstanceId();

return BigtableDataClient.create(
BigtableDataSettings.newBuilder()
.setProjectId(projectId)
.setInstanceId(instanceId)
.build());
}

@Bean
public ServingServiceV2 servingServiceV2(
FeastProperties feastProperties, CachedSpecService specService, Tracer tracer)
throws InvalidProtocolBufferException, JsonProcessingException {
FeastProperties feastProperties, CachedSpecService specService, Tracer tracer) {
ServingServiceV2 servingService = null;
FeastProperties.Store store = feastProperties.getActiveStore();

Expand All @@ -51,6 +72,11 @@ public ServingServiceV2 servingServiceV2(
OnlineRetrieverV2 redisRetriever = new OnlineRetriever(redisClient);
servingService = new OnlineServingServiceV2(redisRetriever, specService, tracer);
break;
case BIGTABLE:
BigtableDataClient bigtableClient = context.getBean(BigtableDataClient.class);
OnlineRetrieverV2 bigtableRetriever = new BigTableOnlineRetriever(bigtableClient);
servingService = new OnlineServingServiceV2(bigtableRetriever, specService, tracer);
break;
}

return servingService;
Expand Down
Loading