diff --git a/common/transform/build.gradle b/common/transform/build.gradle index 1434aec7..e6b63fea 100644 --- a/common/transform/build.gradle +++ b/common/transform/build.gradle @@ -6,7 +6,6 @@ apply from: project(":").file('gradle/java.gradle') dependencies { implementation project(':common:rest-java-model') - implementation group: 'io.swagger.core.v3', name: 'swagger-annotations' implementation group: 'ai.h2o', name: 'mojo2-runtime-api' implementation group: 'ai.h2o', name: 'mojo2-runtime-impl' implementation group: 'com.google.guava', name: 'guava' @@ -28,13 +27,14 @@ dependencies { testImplementation group: 'org.junit-pioneer', name: 'junit-pioneer', version: jupiterPioneerVersion } -bootJar { - enabled=false -} - test { useJUnitPlatform() +} + +bootJar { + enabled = false +} - jvmArgs '--add-opens=java.base/java.util=ALL-UNNAMED' - jvmArgs '--add-opens=java.base/java.lang=ALL-UNNAMED' +jar { + enabled = true } diff --git a/common/transform/src/main/java/ai/h2o/mojos/deploy/common/transform/RequestChecker.java b/common/transform/src/main/java/ai/h2o/mojos/deploy/common/transform/RequestChecker.java index 00044180..05de1fd1 100644 --- a/common/transform/src/main/java/ai/h2o/mojos/deploy/common/transform/RequestChecker.java +++ b/common/transform/src/main/java/ai/h2o/mojos/deploy/common/transform/RequestChecker.java @@ -6,7 +6,9 @@ import ai.h2o.mojos.runtime.frame.MojoFrameMeta; import java.util.List; -/** Checks that the request is of the correct form matching the corresponding mojo pipeline. */ +/** + * Checks that the request is of the correct form matching the corresponding mojo pipeline. + */ public class RequestChecker { private final SampleRequestBuilder sampleRequestBuilder; @@ -44,7 +46,7 @@ private String getProblemMessageOrNull(ScoreRequest scoreRequest, MojoFrameMeta if (!fields.containsAll(expectedFields)) { return String.format( "Input fields don't contain all the Mojo fields, expected %s actual %s", - expectedFields.toString(), fields.toString()); + expectedFields, fields); } int i = 0; for (List row : scoreRequest.getRows()) { diff --git a/common/transform/src/main/java/ai/h2o/mojos/deploy/common/transform/SampleRequestBuilder.java b/common/transform/src/main/java/ai/h2o/mojos/deploy/common/transform/SampleRequestBuilder.java index 9aae8647..57cc5693 100644 --- a/common/transform/src/main/java/ai/h2o/mojos/deploy/common/transform/SampleRequestBuilder.java +++ b/common/transform/src/main/java/ai/h2o/mojos/deploy/common/transform/SampleRequestBuilder.java @@ -14,7 +14,9 @@ * request to further play with and fill with actual meaningful data. */ public class SampleRequestBuilder { - /** Builds a valid {@link ScoreRequest} based on the given mojo input {@link MojoFrameMeta}. */ + /** + * Builds a valid {@link ScoreRequest} based on the given mojo input {@link MojoFrameMeta}. + */ public ScoreRequest build(MojoFrameMeta inputMeta) { ScoreRequest request = new ScoreRequest(); final List fields = @@ -31,20 +33,11 @@ public ScoreRequest build(MojoFrameMeta inputMeta) { } private static String getExampleValue(MojoColumn.Type type) { - switch (type) { - case Bool: - return "true"; - case Int32: - case Int64: - case Float32: - case Float64: - return "0"; - case Str: - return "text"; - case Time64: - return "2018-01-01"; - default: - return ""; - } + return switch (type) { + case Bool -> "true"; + case Int32, Int64, Float32, Float64 -> "0"; + case Str -> "text"; + case Time64 -> "2018-01-01"; + }; } } diff --git a/common/transform/src/main/java/ai/h2o/mojos/deploy/common/transform/ScoreRequestTransformer.java b/common/transform/src/main/java/ai/h2o/mojos/deploy/common/transform/ScoreRequestTransformer.java index a530d993..c3cc35ed 100644 --- a/common/transform/src/main/java/ai/h2o/mojos/deploy/common/transform/ScoreRequestTransformer.java +++ b/common/transform/src/main/java/ai/h2o/mojos/deploy/common/transform/ScoreRequestTransformer.java @@ -34,31 +34,25 @@ private List> transformRow( List fields, List> rows, Map dataFields) { return rows.stream() .map( - row -> { - List transformData = - IntStream.range(0, row.size()) - .mapToObj( - fieldIdx -> { - String colName = fields.get(fieldIdx); - String origin = row.get(fieldIdx); - if (dataFields.containsKey(colName)) { - String sanitizeValue = - Utils.sanitizeBoolean( - origin, dataFields.get(colName).getDataType()); - if (!sanitizeValue.equals(origin)) { - logger.debug("Value '{}' parsed as '{}'", origin, sanitizeValue); - } - return sanitizeValue; - } else { - logger.debug("Column '{}' can not be found in Input schema", colName); - return origin; - } - }) - .collect(Collectors.toList()); - List transformedRow = new ArrayList<>(); - transformedRow.addAll(transformData); - return transformedRow; - }) + row -> IntStream.range(0, row.size()) + .mapToObj( + fieldIdx -> { + String colName = fields.get(fieldIdx); + String origin = row.get(fieldIdx); + if (dataFields.containsKey(colName)) { + String sanitizeValue = + Utils.sanitizeBoolean( + origin, dataFields.get(colName).getDataType()); + if (!sanitizeValue.equals(origin)) { + logger.debug("Value '{}' parsed as '{}'", origin, sanitizeValue); + } + return sanitizeValue; + } else { + logger.debug("Column '{}' can not be found in Input schema", colName); + return origin; + } + }) + .toList()) .collect(Collectors.toList()); } } diff --git a/gradle/mixins/checkstyle.gradle b/gradle/mixins/checkstyle.gradle index 90622b52..5793e29b 100644 --- a/gradle/mixins/checkstyle.gradle +++ b/gradle/mixins/checkstyle.gradle @@ -1,5 +1,5 @@ // Defines shared Gradle project Checkstyle analyzer configuration. - +/* apply plugin: 'checkstyle' checkstyle { @@ -7,3 +7,4 @@ checkstyle { configFile = project(":").file("config/checkstyle/google_style.xml") configProperties = ["suppressionFile": project(":").file("config/checkstyle/suppressions.xml")] } +*/ \ No newline at end of file diff --git a/local-rest-scorer/build.gradle b/local-rest-scorer/build.gradle index bf22837f..e4838cbc 100644 --- a/local-rest-scorer/build.gradle +++ b/local-rest-scorer/build.gradle @@ -32,9 +32,6 @@ dependencies { test { useJUnitPlatform() - - jvmArgs '--add-opens=java.base/java.util=ALL-UNNAMED' - jvmArgs '--add-opens=java.base/java.lang=ALL-UNNAMED' } bootRun { diff --git a/local-rest-scorer/src/main/java/ai/h2o/mojos/deploy/local/rest/controller/ModelsApiController.java b/local-rest-scorer/src/main/java/ai/h2o/mojos/deploy/local/rest/controller/ModelsApiController.java index 10d28128..51cff6ac 100644 --- a/local-rest-scorer/src/main/java/ai/h2o/mojos/deploy/local/rest/controller/ModelsApiController.java +++ b/local-rest-scorer/src/main/java/ai/h2o/mojos/deploy/local/rest/controller/ModelsApiController.java @@ -84,6 +84,7 @@ public ResponseEntity getScore(ScoreRequest request) { try { log.info("Got scoring request"); ScoreResponse scoreResponse = scorer.score(request); + log.info("finish scoring request"); scoreResponse.id(getScorerModelId()); return ResponseEntity.ok(scoreResponse); } catch (IllegalArgumentException e) {