From 48670f3399ab9901d3876a405f17ca4cebe5d7e2 Mon Sep 17 00:00:00 2001 From: LSmyrnaios Date: Mon, 28 Mar 2022 14:29:31 +0300 Subject: [PATCH] - Show the percentage of the "NumFullTextsFound", in the logs. - Update dependencies. --- build.gradle | 6 +++--- gradle/wrapper/gradle-wrapper.properties | 2 +- installAndRun.sh | 2 +- .../java/eu/openaire/urls_controller/util/FileUtils.java | 8 +++++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 7e79f99..6668f96 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'org.springframework.boot' version '2.6.4' + id 'org.springframework.boot' version '2.6.5' id 'io.spring.dependency-management' version '1.0.11.RELEASE' id 'java' } @@ -40,12 +40,12 @@ dependencies { implementation "org.projectlombok:lombok:1.18.22" // https://mvnrepository.com/artifact/com.google.guava/guava - implementation group: 'com.google.guava', name: 'guava', version: '31.0.1-jre' + implementation group: 'com.google.guava', name: 'guava', version: '31.1-jre' // https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0' - implementation 'io.minio:minio:8.3.6' + implementation 'io.minio:minio:8.3.7' // https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.9.3' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 41dfb87..00e33ed 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/installAndRun.sh b/installAndRun.sh index c914792..3cf6fc1 100755 --- a/installAndRun.sh +++ b/installAndRun.sh @@ -17,7 +17,7 @@ if [[ justInstall -eq 1 && shouldRunInDocker -eq 1 ]]; then justInstall=0 fi -gradleVersion="7.4" +gradleVersion="7.4.1" if [[ justInstall -eq 0 ]]; then diff --git a/src/main/java/eu/openaire/urls_controller/util/FileUtils.java b/src/main/java/eu/openaire/urls_controller/util/FileUtils.java index 90b4f56..b1113d0 100644 --- a/src/main/java/eu/openaire/urls_controller/util/FileUtils.java +++ b/src/main/java/eu/openaire/urls_controller/util/FileUtils.java @@ -21,6 +21,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.sql.Types; +import java.text.DecimalFormat; import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -88,7 +89,7 @@ public class FileUtils { @Value("services.pdfaggregation.controller.baseTargetLocation") private String baseTargetLocation; - + public static DecimalFormat df = new DecimalFormat("0.00"); private final Pattern FILENAME_WITH_EXTENSION = Pattern.compile(".*/([\\w_:()]+\\.[\\w]{2,10})$"); private final int numOfFullTextsPerBatch = 70; // The HTTP-headers cannot be too large (It failed with 100 fileNames). @@ -107,7 +108,8 @@ public class FileUtils { // Get the file-locations. int numFullTextsFound = 0; int numFilesFoundFromPreviousAssignmentsBatches = 0; - HashMultimap allFileNamesWithPayloads = HashMultimap.create((urlReports.size() / 5), 3); // Holds multiple values for any key, if a fileName(key) has many IDs(values) associated with it. + int urlReportsSize = urlReports.size(); + HashMultimap allFileNamesWithPayloads = HashMultimap.create((urlReportsSize / 5), 3); // Holds multiple values for any key, if a fileName(key) has many IDs(values) associated with it. String getFileLocationForHashQuery = "select `location` from " + databaseName + ".payload where `hash` = ? limit 1" ; final int[] hashArgType = new int[] {Types.VARCHAR}; @@ -167,7 +169,7 @@ public class FileUtils { ImpalaConnector.databaseLock.unlock(); // The remaining work of this function does not use the database. - logger.info("NumFullTextsFound by assignments_" + assignmentsBatchCounter + " = " + numFullTextsFound + " (out of " + urlReports.size() + ")."); + logger.info("NumFullTextsFound by assignments_" + assignmentsBatchCounter + " = " + numFullTextsFound + " (out of " + urlReportsSize + " | about " + df.format(numFullTextsFound * 100.0 / urlReportsSize) + "%)."); logger.debug("NumFilesFoundFromPreviousAssignmentsBatches = " + numFilesFoundFromPreviousAssignmentsBatches); ArrayList allFileNames = new ArrayList<>(allFileNamesWithPayloads.keySet());