Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jacoco] Uses jacoco aggregation report plugin #421

Merged
merged 2 commits into from
Jan 9, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Gradle
run: ./gradlew --refresh-dependencies build jRR jRV
run: ./gradlew --refresh-dependencies build :jacoco:testCodeCoverageReport
- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public final boolean runBenchmark(String[] args) {
Metrics metrics = new Metrics(); // Reset Metrics for each test loop.
progressBar = new ProgressBar("Iteration", iteration);
float[] lastResult = predict(arguments, metrics, iteration);
if (lastResult == null) {
if (lastResult.length == 0) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions benchmark/src/main/java/ai/djl/benchmark/Arguments.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ String getModelName() {

Map<String, String> getModelOptions() {
if (modelOptions == null) {
return null;
return null; // NOPMD
}
Map<String, String> map = new ConcurrentHashMap<>();
for (String option : modelOptions.split(",")) {
Expand All @@ -306,7 +306,7 @@ Map<String, String> getModelOptions() {

Map<String, Object> getModelArguments() {
if (modelArguments == null) {
return null;
return null; // NOPMD
}

Map<String, Object> map = new ConcurrentHashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public float[] predict(Arguments arguments, Metrics metrics, int iteration)
models.forEach(ZooModel::close);
if (successThreads != numOfThreads) {
logger.error("Only {}/{} threads finished.", successThreads, numOfThreads);
return null;
return new float[0];
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public float[] predict(Arguments arguments, Metrics metrics, int iteration) {

if (successfulResults != iteration) {
logger.error("Only {}/{} results successfully finished.", successfulResults, iteration);
return null;
return new float[0];
}

return results[0].join();
Expand Down
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,3 @@ configure(javaProjects()) {
}

apply from: file("${rootProject.projectDir}/tools/gradle/publish.gradle")
apply from: file("${rootProject.projectDir}/tools/gradle/jacoco.gradle")
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private CodecUtils() {}
public static byte[] readBytes(ByteBuf in, int maxLength) {
int len = in.readInt();
if (len < 0) {
return null;
return null; // NOPMD
}
if (len > maxLength) {
throw new CorruptedFrameException("Message size exceed limit: " + len);
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
34 changes: 34 additions & 0 deletions jacoco/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
plugins {
id "base"
id "jacoco-report-aggregation"
}

repositories {
mavenCentral()
}

dependencies {
jacocoAggregation project(":benchmark")
// TODO: Add unit test for central and console
// jacocoAggregation project(":central")
jacocoAggregation project(":engines:python")
jacocoAggregation project(":engines:java")
jacocoAggregation project(":plugins:kserve")
// jacocoAggregation project(":plugins:management-console")
jacocoAggregation project(":plugins:plugin-management-plugin")
jacocoAggregation project(":plugins:static-file-plugin")
jacocoAggregation project(":serving")
jacocoAggregation project(":wlm")
}

reporting {
reports {
testCodeCoverageReport(JacocoCoverageReport) {
testType = TestSuiteType.UNIT_TEST
}
}
}

tasks.named("check") {
dependsOn tasks.named("testCodeCoverageReport", JacocoReport)
}
1 change: 1 addition & 0 deletions jacoco/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,7 @@ public boolean acceptInboundMessage(Object msg) {
return PATTERN.matcher(req.uri()).matches();
}

/**
* {@inheritDoc}
*
* @return
*/
/** {@inheritDoc} */
@Override
public Void handleRequest(
ChannelHandlerContext ctx,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ public void testKServeTensor() {
Shape shape = new Shape(1);
try (NDManager manager = NDManager.newBaseManager()) {
for (DataType type : DataType.values()) {
if (type != DataType.STRING && type != DataType.UNKNOWN) {
if (type != DataType.STRING
&& type != DataType.UNKNOWN
&& type != DataType.COMPLEX64) {
KServeTensor tensor = getKServeTensor(shape, type);
tensor.toTensor(manager);
}
Expand Down
12 changes: 6 additions & 6 deletions serving/src/main/java/ai/djl/serving/util/OpenSslKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private OpenSslKey() {}
*/
public static byte[] convertPrivateKey(byte[] keySpec) {
if (keySpec == null) {
return null;
return null; // NOPMD
}

byte[] bytes = new byte[keySpec.length];
Expand All @@ -55,7 +55,7 @@ public static byte[] convertPrivateKey(byte[] keySpec) {

private static byte[] encodeOID(int[] oid) {
if (oid == null) {
return null;
return null; // NOPMD
}

int oLen = 1;
Expand All @@ -82,7 +82,7 @@ private static byte[] encodeOID(int[] oid) {

private static byte[] encodeOctetString(byte[] bytes) {
if (bytes == null) {
return null;
return null; // NOPMD
}

int oLen = bytes.length; // one byte for unused bits field
Expand All @@ -94,7 +94,7 @@ private static byte[] encodeOctetString(byte[] bytes) {
int offset = writeLengthField(newBytes, oLen);

if (len - oLen != offset) {
return null;
return null; // NOPMD
}

System.arraycopy(bytes, 0, newBytes, offset, oLen);
Expand All @@ -103,7 +103,7 @@ private static byte[] encodeOctetString(byte[] bytes) {

private static byte[] encodeSequence(byte[][] byteArrays) {
if (byteArrays == null) {
return null;
return null; // NOPMD
}

int oLen = 0;
Expand All @@ -122,7 +122,7 @@ private static byte[] encodeSequence(byte[][] byteArrays) {
int offset = writeLengthField(bytes, oLen);

if (len - oLen != offset) {
return null;
return null; // NOPMD
}

for (byte[] b : byteArrays) {
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ include ':plugins:plugin-management-plugin'
include ':plugins:static-file-plugin'
include ':serving'
include ':wlm'
include ':jacoco'
50 changes: 0 additions & 50 deletions tools/gradle/jacoco.gradle

This file was deleted.