Skip to content

Commit 6e0da44

Browse files
committed
Checkpoint
1 parent 6e51785 commit 6e0da44

21 files changed

Lines changed: 1113 additions & 1159 deletions

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<name>Feast Parent</name>
2525

2626
<properties>
27-
<revision>0.1.1</revision>
27+
<revision>0.3.0</revision>
2828
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2929
<protocVersion>3.6.1</protocVersion>
3030
<grpcVersion>1.14.0</grpcVersion>

protos/feast/serving/ServingService.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ message GetFeaturesRequest {
9090
repeated string feature_names = 3;
9191

9292
// The features will be retrieved if:
93-
// user_provided_unix_epoch - max_age <= event_timestamp < user_provided_unix_epoch
93+
// entity_timestamp - max_age <= event_timestamp <= entity_timestamp
9494
//
9595
// If unspecified the default max_age specified in FeatureSetSpec will
9696
// be used.
@@ -125,7 +125,7 @@ message GetFeaturesRequest {
125125
// latest is always retrieved.
126126
//
127127
// The timestamp range is defined as follows:
128-
// entity_timestamp - max_age <= event_timestamp < entity_timestamp
128+
// entity_timestamp - max_age <= event_timestamp <= entity_timestamp
129129
google.protobuf.Timestamp entity_timestamp = 1;
130130

131131
// The entity ids for which the feature values should be retrieved.

serving/pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,22 @@
1919
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2020
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2121
<modelVersion>4.0.0</modelVersion>
22+
23+
<properties>
24+
<revision>0.3.0</revision>
25+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
26+
<protocVersion>3.6.1</protocVersion>
27+
<grpcVersion>1.21.0</grpcVersion>
28+
<protobufVersion>3.6.1</protobufVersion>
29+
<springBootVersion>2.0.9.RELEASE</springBootVersion>
30+
</properties>
31+
2232
<parent>
2333
<groupId>feast</groupId>
2434
<artifactId>feast-parent</artifactId>
2535
<version>${revision}</version>
2636
</parent>
37+
2738
<artifactId>feast-serving</artifactId>
2839
<name>Feast Serving</name>
2940
<packaging>jar</packaging>
@@ -256,6 +267,15 @@
256267
<version>RELEASE</version>
257268
<scope>test</scope>
258269
</dependency>
270+
271+
<!-- Hibernate for formatting SQL string -->
272+
<dependency>
273+
<groupId>org.hibernate</groupId>
274+
<artifactId>hibernate-core</artifactId>
275+
<version>5.4.5.Final</version>
276+
</dependency>
277+
278+
259279
</dependencies>
260280

261281

serving/src/main/java/feast/serving/config/GrpcServerConfigurer.java renamed to serving/src/main/java/feast/serving/config/GrpcServerConfiguration.java

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,30 @@
1717

1818
package feast.serving.config;
1919

20+
import feast.serving.grpc.BigQueryServingService;
21+
import feast.serving.grpc.RedisServingService;
2022
import io.grpc.ServerBuilder;
21-
import java.util.concurrent.ExecutorService;
23+
import io.grpc.protobuf.services.ProtoReflectionService;
2224
import org.lognet.springboot.grpc.GRpcServerBuilderConfigurer;
2325
import org.springframework.stereotype.Component;
2426

25-
/**
26-
* Configuration for Grpc server.
27-
*/
27+
// Configuration for GRPC server.
2828
@Component
29-
public class GrpcServerConfigurer extends GRpcServerBuilderConfigurer {
30-
31-
private final ExecutorService executorService;
32-
33-
public GrpcServerConfigurer(
34-
ExecutorService executorService) {
35-
this.executorService = executorService;
36-
}
29+
public class GrpcServerConfiguration extends GRpcServerBuilderConfigurer {
3730

31+
// private final ExecutorService executorService;
32+
//
33+
// public GrpcServerConfigurer(
34+
// ExecutorService executorService) {
35+
// this.executorService = executorService;
36+
// }
37+
//
3838
@Override
3939
public void configure(ServerBuilder<?> serverBuilder) {
40-
serverBuilder.executor(executorService);
40+
serverBuilder
41+
.addService(new BigQueryServingService())
42+
// Enable server reflection so assist client in runtime construction of requests
43+
// https://github.com/grpc/grpc/blob/master/doc/server-reflection.md
44+
.addService(ProtoReflectionService.newInstance());
4145
}
4246
}
Lines changed: 133 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,133 @@
1-
/*
2-
* Copyright 2018 The Feast Authors
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* https://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*
16-
*/
17-
18-
package feast.serving.config;
19-
20-
import com.google.common.util.concurrent.ListeningExecutorService;
21-
import com.google.common.util.concurrent.MoreExecutors;
22-
import feast.core.StoreProto.Store;
23-
import feast.serving.service.spec.CachedSpecService;
24-
import feast.serving.service.spec.CoreSpecService;
25-
import feast.serving.service.serving.ServingService;
26-
import feast.serving.service.serving.RedisServingService;
27-
import feast.serving.service.spec.SpecService;
28-
import io.opentracing.Tracer;
29-
import io.opentracing.contrib.concurrent.TracedExecutorService;
30-
import java.util.List;
31-
import java.util.concurrent.ExecutorService;
32-
import java.util.concurrent.Executors;
33-
import java.util.concurrent.ScheduledExecutorService;
34-
import java.util.concurrent.TimeUnit;
35-
import lombok.extern.slf4j.Slf4j;
36-
import org.springframework.beans.factory.annotation.Autowired;
37-
import org.springframework.beans.factory.annotation.Value;
38-
import org.springframework.context.annotation.Bean;
39-
import org.springframework.context.annotation.Configuration;
40-
import org.springframework.http.converter.HttpMessageConverter;
41-
import org.springframework.http.converter.protobuf.ProtobufJsonFormatHttpMessageConverter;
42-
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
43-
import redis.clients.jedis.JedisPool;
44-
import redis.clients.jedis.JedisPoolConfig;
45-
46-
/**
47-
* Global bean configuration.
48-
*/
49-
@Slf4j
50-
@Configuration
51-
public class ServingApiConfiguration implements WebMvcConfigurer {
52-
53-
@Autowired
54-
private ProtobufJsonFormatHttpMessageConverter protobufConverter;
55-
56-
private ScheduledExecutorService scheduledExecutorService =
57-
Executors.newSingleThreadScheduledExecutor();
58-
59-
@Bean
60-
public AppConfig getAppConfig(
61-
@Value("${feast.redispool.maxsize}") int redisPoolMaxSize,
62-
@Value("${feast.redispool.maxidle}") int redisPoolMaxIdle,
63-
@Value("${feast.maxentity}") int maxEntityPerBatch,
64-
@Value("${feast.timeout}") int timeout) {
65-
return AppConfig.builder()
66-
.maxEntityPerBatch(maxEntityPerBatch)
67-
.redisMaxPoolSize(redisPoolMaxSize)
68-
.redisMaxIdleSize(redisPoolMaxIdle)
69-
.timeout(timeout)
70-
.build();
71-
}
72-
73-
@Bean
74-
public SpecService getCoreServiceSpecStorage(
75-
@Value("${feast.store.id}") String storeId,
76-
@Value("${feast.core.host}") String coreServiceHost,
77-
@Value("${feast.core.grpc.port}") String coreServicePort,
78-
@Value("${feast.cacheDurationMinute}") int cacheDurationMinute) {
79-
final CachedSpecService cachedSpecStorage =
80-
new CachedSpecService(new CoreSpecService(coreServiceHost, Integer.parseInt(coreServicePort)),
81-
storeId);
82-
83-
// reload all specs including new ones periodically
84-
scheduledExecutorService.schedule(
85-
cachedSpecStorage::populateCache, cacheDurationMinute, TimeUnit.MINUTES);
86-
87-
// load all specs during start up
88-
try {
89-
cachedSpecStorage.populateCache();
90-
} catch (Exception e) {
91-
log.error("Unable to preload feast's spec");
92-
}
93-
return cachedSpecStorage;
94-
}
95-
96-
@Bean
97-
public ServingService getFeastServing(
98-
@Value("${feast.store.id}") String storeId,
99-
@Value("${feast.core.host}") String coreServiceHost,
100-
@Value("${feast.core.grpc.port}") String coreServicePort,
101-
AppConfig appConfig,
102-
Tracer tracer) {
103-
CoreSpecService coreSpecService = new CoreSpecService(coreServiceHost, Integer.parseInt(coreServicePort));
104-
Store store = coreSpecService.getStoreDetails(storeId);
105-
106-
switch (store.getType()) {
107-
case REDIS:
108-
JedisPoolConfig poolConfig = new JedisPoolConfig();
109-
poolConfig.setMaxTotal(appConfig.getRedisMaxPoolSize());
110-
poolConfig.setMaxIdle(appConfig.getRedisMaxIdleSize());
111-
JedisPool jedisPool = new JedisPool(poolConfig, store.getRedisConfig().getHost(),
112-
store.getRedisConfig().getPort());
113-
return new RedisServingService(jedisPool, tracer);
114-
case BIGQUERY:
115-
// TODO: Implement connection to BigQuery
116-
return null;
117-
default:
118-
return null;
119-
}
120-
}
121-
122-
@Bean
123-
public ListeningExecutorService getExecutorService(
124-
Tracer tracer, @Value("${feast.threadpool.max}") int maxPoolSize) {
125-
126-
ExecutorService executor = Executors.newFixedThreadPool(maxPoolSize);
127-
return MoreExecutors.listeningDecorator(new TracedExecutorService(executor, tracer));
128-
}
129-
130-
@Bean
131-
ProtobufJsonFormatHttpMessageConverter protobufHttpMessageConverter() {
132-
return new ProtobufJsonFormatHttpMessageConverter();
133-
}
134-
135-
@Override
136-
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
137-
converters.add(protobufConverter);
138-
}
139-
}
1+
// /*
2+
// * Copyright 2018 The Feast Authors
3+
// *
4+
// * Licensed under the Apache License, Version 2.0 (the "License");
5+
// * you may not use this file except in compliance with the License.
6+
// * You may obtain a copy of the License at
7+
// *
8+
// * https://www.apache.org/licenses/LICENSE-2.0
9+
// *
10+
// * Unless required by applicable law or agreed to in writing, software
11+
// * distributed under the License is distributed on an "AS IS" BASIS,
12+
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// * See the License for the specific language governing permissions and
14+
// * limitations under the License.
15+
// *
16+
// */
17+
//
18+
// package feast.serving.config;
19+
//
20+
// import com.google.common.util.concurrent.ListeningExecutorService;
21+
// import com.google.common.util.concurrent.MoreExecutors;
22+
// import feast.serving.service.spec.CachedSpecService;
23+
// import feast.serving.service.spec.CoreSpecService;
24+
// import feast.serving.service.spec.SpecService;
25+
// import io.opentracing.Tracer;
26+
// import io.opentracing.contrib.concurrent.TracedExecutorService;
27+
// import java.util.List;
28+
// import java.util.concurrent.ExecutorService;
29+
// import java.util.concurrent.Executors;
30+
// import java.util.concurrent.ScheduledExecutorService;
31+
// import java.util.concurrent.TimeUnit;
32+
// import lombok.extern.slf4j.Slf4j;
33+
// import org.springframework.beans.factory.annotation.Value;
34+
// import org.springframework.context.annotation.Bean;
35+
// import org.springframework.context.annotation.Configuration;
36+
// import org.springframework.http.converter.HttpMessageConverter;
37+
// import org.springframework.http.converter.protobuf.ProtobufJsonFormatHttpMessageConverter;
38+
// import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
39+
//
40+
// // Global bean configuration.
41+
// @Slf4j
42+
// @Configuration
43+
// public class ServingApiConfiguration implements WebMvcConfigurer {
44+
// private final ProtobufJsonFormatHttpMessageConverter protobufConverter;
45+
// // private ScheduledExecutorService scheduledExecutorService =
46+
// // Executors.newSingleThreadScheduledExecutor();
47+
//
48+
// public ServingApiConfiguration(ProtobufJsonFormatHttpMessageConverter protobufConverter) {
49+
// this.protobufConverter = protobufConverter;
50+
// }
51+
//
52+
// @Bean
53+
// public AppConfig getAppConfig(
54+
// @Value("${feast.redispool.maxsize}") int redisPoolMaxSize,
55+
// @Value("${feast.redispool.maxidle}") int redisPoolMaxIdle,
56+
// @Value("${feast.maxentity}") int maxEntityPerBatch,
57+
// @Value("${feast.timeout}") int timeout) {
58+
// return AppConfig.builder()
59+
// .maxEntityPerBatch(maxEntityPerBatch)
60+
// .redisMaxPoolSize(redisPoolMaxSize)
61+
// .redisMaxIdleSize(redisPoolMaxIdle)
62+
// .timeout(timeout)
63+
// .build();
64+
// }
65+
//
66+
// @Bean
67+
// public SpecService getCoreServiceSpecStorage(
68+
// @Value("${feast.store.id}") String storeId,
69+
// @Value("${feast.core.host}") String coreServiceHost,
70+
// @Value("${feast.core.grpc.port}") String coreServicePort,
71+
// @Value("${feast.cacheDurationMinute}") int cacheDurationMinute) {
72+
// final CachedSpecService cachedSpecStorage =
73+
// new CachedSpecService(
74+
// new CoreSpecService(coreServiceHost, Integer.parseInt(coreServicePort)), storeId);
75+
//
76+
// // reload all specs including new ones periodically
77+
// // scheduledExecutorService.schedule(
78+
// // cachedSpecStorage::populateCache, cacheDurationMinute, TimeUnit.MINUTES);
79+
//
80+
// // load all specs during start up
81+
// try {
82+
// cachedSpecStorage.populateCache();
83+
// } catch (Exception e) {
84+
// log.error("Unable to preload feast's spec");
85+
// }
86+
// return cachedSpecStorage;
87+
// }
88+
//
89+
// // @Bean
90+
// // public ServingService getFeastServing(
91+
// // @Value("${feast.store.id}") String storeId,
92+
// // @Value("${feast.core.host}") String coreServiceHost,
93+
// // @Value("${feast.core.grpc.port}") String coreServicePort,
94+
// // AppConfig appConfig,
95+
// // Tracer tracer) {
96+
// // CoreSpecService coreSpecService = new CoreSpecService(coreServiceHost,
97+
// // Integer.parseInt(coreServicePort));
98+
// // Store store = coreSpecService.getStoreDetails(storeId);
99+
// //
100+
// // switch (store.getType()) {
101+
// // case REDIS:
102+
// // JedisPoolConfig poolConfig = new JedisPoolConfig();
103+
// // poolConfig.setMaxTotal(appConfig.getRedisMaxPoolSize());
104+
// // poolConfig.setMaxIdle(appConfig.getRedisMaxIdleSize());
105+
// // JedisPool jedisPool = new JedisPool(poolConfig, store.getRedisConfig().getHost(),
106+
// // store.getRedisConfig().getPort());
107+
// // return new RedisServingService(jedisPool, tracer);
108+
// // case BIGQUERY:
109+
// // // TODO: Implement connection to BigQuery
110+
// // return null;
111+
// // default:
112+
// // return null;
113+
// // }
114+
// // }
115+
//
116+
// @Bean
117+
// public ListeningExecutorService getExecutorService(
118+
// Tracer tracer, @Value("${feast.threadpool.max}") int maxPoolSize) {
119+
//
120+
// ExecutorService executor = Executors.newFixedThreadPool(maxPoolSize);
121+
// return MoreExecutors.listeningDecorator(new TracedExecutorService(executor, tracer));
122+
// }
123+
//
124+
// @Bean
125+
// ProtobufJsonFormatHttpMessageConverter protobufHttpMessageConverter() {
126+
// return new ProtobufJsonFormatHttpMessageConverter();
127+
// }
128+
//
129+
// @Override
130+
// public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
131+
// converters.add(protobufConverter);
132+
// }
133+
// }

0 commit comments

Comments
 (0)