From 9d0f19382bebcaa7b9a6c73d56400d9a5ac8da88 Mon Sep 17 00:00:00 2001 From: Adrian Gonzalez-Martin Date: Mon, 21 Oct 2019 14:16:40 +0100 Subject: [PATCH 1/6] Update jackson to v2.10.0 --- engine/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/pom.xml b/engine/pom.xml index 068fb7bc3f..6801c2a358 100644 --- a/engine/pom.xml +++ b/engine/pom.xml @@ -25,7 +25,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs 1.0.0 0.33.0 4.2.0 - 2.9.10 + 2.10.0 6.0.1 From 134615a0c6f634b00f4dbb47d29767f8b0fd946a Mon Sep 17 00:00:00 2001 From: Adrian Gonzalez-Martin Date: Tue, 22 Oct 2019 10:37:52 +0100 Subject: [PATCH 2/6] Fix some deprecations --- .../engine/grpc/GrpcChannelHandler.java | 11 +++++--- .../seldon/engine/grpc/SeldonGrpcServer.java | 2 +- .../predictors/AverageCombinerUnit.java | 3 ++- .../service/InternalPredictionService.java | 26 ++++++++++++------- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/engine/src/main/java/io/seldon/engine/grpc/GrpcChannelHandler.java b/engine/src/main/java/io/seldon/engine/grpc/GrpcChannelHandler.java index 85e2b24f7c..8a05f1b548 100644 --- a/engine/src/main/java/io/seldon/engine/grpc/GrpcChannelHandler.java +++ b/engine/src/main/java/io/seldon/engine/grpc/GrpcChannelHandler.java @@ -19,11 +19,12 @@ public class GrpcChannelHandler { @Autowired TracingProvider tracingProvider; public Channel get(Endpoint endpoint) { - if (store.containsKey(endpoint)) return store.get(endpoint); - else { + if (store.containsKey(endpoint)) { + return store.get(endpoint); + } else { ManagedChannel channel = ManagedChannelBuilder.forAddress(endpoint.getServiceHost(), endpoint.getServicePort()) - .usePlaintext(true) + .usePlaintext() .build(); if (tracingProvider != null && tracingProvider.isActive()) { @@ -32,7 +33,9 @@ public Channel get(Endpoint endpoint) { .withTracer(this.tracingProvider.getTracer()) .build(); store.putIfAbsent(endpoint, tracingInterceptor.intercept(channel)); - } else store.putIfAbsent(endpoint, channel); + } else { + store.putIfAbsent(endpoint, channel); + } return store.get(endpoint); } } diff --git a/engine/src/main/java/io/seldon/engine/grpc/SeldonGrpcServer.java b/engine/src/main/java/io/seldon/engine/grpc/SeldonGrpcServer.java index 51fb04a59b..8e8bfbfcc4 100644 --- a/engine/src/main/java/io/seldon/engine/grpc/SeldonGrpcServer.java +++ b/engine/src/main/java/io/seldon/engine/grpc/SeldonGrpcServer.java @@ -79,7 +79,7 @@ public SeldonGrpcServer( try { maxMessageSize = Integer.parseInt(annotations.get(ANNOTATION_MAX_MESSAGE_SIZE)); logger.info("Setting max message to {}", maxMessageSize); - builder.maxMessageSize(maxMessageSize); + builder.maxInboundMessageSize(maxMessageSize); } catch (NumberFormatException e) { logger.warn( "Failed to parse {} with value {}", diff --git a/engine/src/main/java/io/seldon/engine/predictors/AverageCombinerUnit.java b/engine/src/main/java/io/seldon/engine/predictors/AverageCombinerUnit.java index 9d2dc0381c..9483b798ae 100644 --- a/engine/src/main/java/io/seldon/engine/predictors/AverageCombinerUnit.java +++ b/engine/src/main/java/io/seldon/engine/predictors/AverageCombinerUnit.java @@ -15,7 +15,8 @@ */ package io.seldon.engine.predictors; -import static org.ojalgo.function.PrimitiveFunction.*; +// import static org.ojalgo.function.PrimitiveFunction.*; +import static org.ojalgo.function.constant.PrimitiveMath.DIVIDE; import io.seldon.engine.exception.APIException; import io.seldon.protos.PredictionProtos.DefaultData; diff --git a/engine/src/main/java/io/seldon/engine/service/InternalPredictionService.java b/engine/src/main/java/io/seldon/engine/service/InternalPredictionService.java index 73a02f4051..b9cd76fbb5 100644 --- a/engine/src/main/java/io/seldon/engine/service/InternalPredictionService.java +++ b/engine/src/main/java/io/seldon/engine/service/InternalPredictionService.java @@ -47,6 +47,7 @@ import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; +import java.time.Duration; import java.util.Collections; import java.util.List; import java.util.Map; @@ -138,8 +139,8 @@ public InternalPredictionService( logger.info("REST read timeout set to {}", readTimeout); this.restTemplate = restTemplateBuilder - .setConnectTimeout(connectionTimeout) - .setReadTimeout(readTimeout) + .setConnectTimeout(Duration.ofMillis(connectionTimeout)) + .setReadTimeout(Duration.ofMillis(readTimeout)) .build(); if (tracingProvider.isActive()) { restTemplate.setInterceptors( @@ -370,7 +371,9 @@ public SeldonMessage aggregate(List outputs, PredictiveUnitState } private boolean isDefaultData(SeldonMessage message) { - if (message.getDataOneofCase() == DataOneofCase.DATA) return true; + if (message.getDataOneofCase() == DataOneofCase.DATA) { + return true; + } return false; } @@ -393,8 +396,9 @@ private SeldonMessage queryREST( URI uri; try { final String uriKey = getUriKey(endpoint, path); - if (uriCache.containsKey(uriKey)) uri = uriCache.get(uriKey); - else { + if (uriCache.containsKey(uriKey)) { + uri = uriCache.get(uriKey); + } else { URIBuilder builder = new URIBuilder() .setScheme("http") @@ -413,8 +417,9 @@ private SeldonMessage queryREST( for (int i = 0; i < restRetries; i++) { try { HttpHeaders headers; - if (headersCache.containsKey(state.name)) headers = headersCache.get(state.name); - else { + if (headersCache.containsKey(state.name)) { + headers = headersCache.get(state.name); + } else { headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); headers.add(MODEL_NAME_HEADER, state.name); @@ -430,7 +435,9 @@ private SeldonMessage queryREST( HttpEntity> request = new HttpEntity>(map, headers); - if (logger.isDebugEnabled()) logger.debug("Requesting {}", uri.toString()); + if (logger.isDebugEnabled()) { + logger.debug("Requesting {}", uri.toString()); + } ResponseEntity httpResponse = restTemplate.postForEntity(uri, request, String.class); try { @@ -449,9 +456,10 @@ private SeldonMessage queryREST( String.format("Bad return code %d", httpResponse.getStatusCode())); } } finally { - if (logger.isDebugEnabled()) + if (logger.isDebugEnabled()) { logger.debug( "External prediction server took " + (System.currentTimeMillis() - timeNow) + "ms"); + } } } catch (ResourceAccessException e) { logger.warn("Caught resource access exception ", e); From 3c4b1820e15f783a73795262df079a1441e970fa Mon Sep 17 00:00:00 2001 From: Adrian Gonzalez-Martin Date: Tue, 22 Oct 2019 10:56:27 +0100 Subject: [PATCH 3/6] Update spring-boot to v2.2.0 and micrometer to v1.3.0 --- engine/pom.xml | 4 ++-- .../src/test/java/io/seldon/engine/config/TestConfig.java | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/engine/pom.xml b/engine/pom.xml index 6801c2a358..70ef3f286e 100644 --- a/engine/pom.xml +++ b/engine/pom.xml @@ -6,7 +6,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs org.springframework.boot spring-boot-starter-parent - 2.1.8.RELEASE + 2.2.0.RELEASE io.seldon.engine seldon-engine @@ -20,7 +20,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs 1.8 1.23.0 3.9.2 - 1.1.7 + 1.3.0 io.seldon.engine.App 1.0.0 0.33.0 diff --git a/engine/src/test/java/io/seldon/engine/config/TestConfig.java b/engine/src/test/java/io/seldon/engine/config/TestConfig.java index f8a2bb31be..ec1a82dd6b 100644 --- a/engine/src/test/java/io/seldon/engine/config/TestConfig.java +++ b/engine/src/test/java/io/seldon/engine/config/TestConfig.java @@ -1,6 +1,6 @@ package io.seldon.engine.config; -import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -8,6 +8,7 @@ import io.seldon.engine.service.InternalPredictionService; import io.seldon.engine.tracing.TracingProvider; import java.io.IOException; +import java.time.Duration; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.context.annotation.Bean; @@ -33,8 +34,8 @@ public RestTemplateBuilder restTemplateBuilder() { RestTemplateBuilder rtb = mock(RestTemplateBuilder.class); RestTemplate restTemplate = mock(RestTemplate.class); ClientHttpRequestFactory requestFactory = mock(ClientHttpRequestFactory.class); - when(rtb.setConnectTimeout(anyInt())).thenReturn(rtb); - when(rtb.setReadTimeout(anyInt())).thenReturn(rtb); + when(rtb.setConnectTimeout(any(Duration.class))).thenReturn(rtb); + when(rtb.setReadTimeout(any(Duration.class))).thenReturn(rtb); when(rtb.build()).thenReturn(restTemplate); when(restTemplate.getRequestFactory()).thenReturn(requestFactory); From e366f7100fead1a9ba660dd28c6d4a732d0179ef Mon Sep 17 00:00:00 2001 From: Adrian Gonzalez-Martin Date: Tue, 22 Oct 2019 11:18:27 +0100 Subject: [PATCH 4/6] Update io.grpc packages to v1.24.0 --- engine/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/pom.xml b/engine/pom.xml index 70ef3f286e..b86cca041c 100644 --- a/engine/pom.xml +++ b/engine/pom.xml @@ -18,7 +18,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs UTF-8 1.8 - 1.23.0 + 1.24.0 3.9.2 1.3.0 io.seldon.engine.App From e70bc25e9a3c7acce2f082f3d81dd4e220ed121f Mon Sep 17 00:00:00 2001 From: Adrian Gonzalez-Martin Date: Tue, 22 Oct 2019 11:40:24 +0100 Subject: [PATCH 5/6] Remove spring-boot-properties-migrator --- engine/pom.xml | 5 ----- .../java/io/seldon/engine/api/rest/TestRandomABTest.java | 5 ----- .../api/rest/TestRestClientControllerExternalGraphs.java | 5 ----- 3 files changed, 15 deletions(-) diff --git a/engine/pom.xml b/engine/pom.xml index b86cca041c..759c505861 100644 --- a/engine/pom.xml +++ b/engine/pom.xml @@ -267,11 +267,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs opentracing-api ${opentracing.version} - - org.springframework.boot - spring-boot-properties-migrator - runtime - com.fasterxml.jackson.core jackson-core diff --git a/engine/src/test/java/io/seldon/engine/api/rest/TestRandomABTest.java b/engine/src/test/java/io/seldon/engine/api/rest/TestRandomABTest.java index 6892d69d5e..261909eb3e 100644 --- a/engine/src/test/java/io/seldon/engine/api/rest/TestRandomABTest.java +++ b/engine/src/test/java/io/seldon/engine/api/rest/TestRandomABTest.java @@ -27,7 +27,6 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.util.ReflectionTestUtils; import org.springframework.test.web.servlet.MockMvc; @@ -41,10 +40,6 @@ @ActiveProfiles("test") @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @AutoConfigureMockMvc -@TestPropertySource( - properties = { - "management.security.enabled=false", - }) public class TestRandomABTest { @Autowired private WebApplicationContext context; diff --git a/engine/src/test/java/io/seldon/engine/api/rest/TestRestClientControllerExternalGraphs.java b/engine/src/test/java/io/seldon/engine/api/rest/TestRestClientControllerExternalGraphs.java index 1e23da953c..7cdf11cd3e 100644 --- a/engine/src/test/java/io/seldon/engine/api/rest/TestRestClientControllerExternalGraphs.java +++ b/engine/src/test/java/io/seldon/engine/api/rest/TestRestClientControllerExternalGraphs.java @@ -29,7 +29,6 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.util.ReflectionTestUtils; import org.springframework.test.web.servlet.MockMvc; @@ -43,10 +42,6 @@ @ActiveProfiles("test") @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @AutoConfigureMockMvc -@TestPropertySource( - properties = { - "management.security.enabled=false", - }) public class TestRestClientControllerExternalGraphs { @Autowired private WebApplicationContext context; From 7ef189f0ee9dcbe964b07a978cd660cafca13cb0 Mon Sep 17 00:00:00 2001 From: Adrian Gonzalez-Martin Date: Tue, 22 Oct 2019 11:40:40 +0100 Subject: [PATCH 6/6] Update combined license --- engine/src/license/THIRD-PARTY.properties | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 engine/src/license/THIRD-PARTY.properties diff --git a/engine/src/license/THIRD-PARTY.properties b/engine/src/license/THIRD-PARTY.properties deleted file mode 100644 index 944962a483..0000000000 --- a/engine/src/license/THIRD-PARTY.properties +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by org.codehaus.mojo.license.AddThirdPartyMojo -#------------------------------------------------------------------------------- -# Already used licenses in project : -# - Apache Software License, Version 2.0 -# - BSD License -# - Common Development and Distribution License (CDDL) -# - Eclipse Public License -# - GNU Lesser General Public License (LGPL) -# - MIT License -# - MPL 2.0 or EPL 1.0 -# - Mozilla Public License -# - The Apache License, Version 2.0 -# - The JSON License -#------------------------------------------------------------------------------- -# Please fill the missing licenses for dependencies : -# -# -#Tue Jul 10 08:29:47 BST 2018 -org.apache.zookeeper--zookeeper--3.4.6=Apache Software License, Version 2.0