From 86e737d7bad09d3c4e21a0deb360c8158537f443 Mon Sep 17 00:00:00 2001 From: Sebastian Baunsgaard Date: Wed, 6 Sep 2023 10:33:53 +0200 Subject: [PATCH] [MINOR] FileSystemConfig refinement This commit change the loading of the filesystem to return a future to guarantee that we do not launch multiple filesystem requests at once. Also included is a cleanup in pom.xml that fixes some space vs tabs introduced. --- pom.xml | 28 +++++++++++-------- .../sysds/conf/ConfigurationManager.java | 19 +++++++++---- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index 69942a2fbc0..4fc1dd2ccdc 100644 --- a/pom.xml +++ b/pom.xml @@ -235,9 +235,9 @@ lib/ org.apache.sysds.performance.Main - - SystemDS.jar ${project.build.directory}/${project.artifactId}-${project.version}-tests.jar - + + SystemDS.jar ${project.build.directory}/${project.artifactId}-${project.version}-tests.jar + @@ -309,7 +309,7 @@ maven-compiler-plugin ${maven-compiler-plugin.version} - -Xlint:unchecked + -Xlint:unchecked ${java.level} ${java.level} ${java.level} @@ -408,12 +408,12 @@ file ${project.build.directory}/jacoco.exec - - ${project.build.directory} - - */jacoco.exec - - + + ${project.build.directory} + + */jacoco.exec + + @@ -655,6 +655,7 @@ src/test/scripts/functions/jmlc/tfmtd_example/dummycoded.column.names src/test/scripts/functions/jmlc/tfmtd_example2/column.names src/test/scripts/functions/jmlc/tfmtd_frame_example/tfmtd_frame + src/test/scripts/applications/entity_resolution/connected_components/expected/** src/test/scripts/functions/io/csv/in/** @@ -1488,5 +1489,10 @@ log4j-core ${log4j.version} + + ch.randelshofer + fastdoubleparser + 0.9.0 + - \ No newline at end of file + diff --git a/src/main/java/org/apache/sysds/conf/ConfigurationManager.java b/src/main/java/org/apache/sysds/conf/ConfigurationManager.java index 088545b8ed8..a4b5c0ffecd 100644 --- a/src/main/java/org/apache/sysds/conf/ConfigurationManager.java +++ b/src/main/java/org/apache/sysds/conf/ConfigurationManager.java @@ -20,6 +20,7 @@ package org.apache.sysds.conf; import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -56,17 +57,20 @@ public class ConfigurationManager{ /** Local compiler configuration for thead-local config updates */ private static ThreadLocalCompilerConfig _lcconf = new ThreadLocalCompilerConfig(); + /** Indicate if the filesystem is loaded or not */ + private static Future loaded; + //global static initialization static { _rJob = new JobConf(); //initialization after job conf in order to prevent cyclic initialization issues - //ConfigManager -> OptimizerUtils -> InfrastructureAnalyer -> ConfigManager + //ConfigManager -> OptimizerUtils -> InfrastructureAnalyzer -> ConfigManager _dmlconf = new DMLConfig(); _cconf = new CompilerConfig(); final ExecutorService pool = CommonThreadPool.get(); - pool.submit(() ->{ + loaded = pool.submit(() ->{ try{ IOUtilFunctions.getFileSystem(_rJob); } @@ -74,19 +78,24 @@ public class ConfigurationManager{ LOG.warn(e.getMessage()); } }); - // pool.shutdown(); } /** * Returns a cached JobConf object, intended for global use by all operations * with read-only access to job conf. This prevents to read the hadoop conf files - * over and over again from classpath. However, + * over and over again from classpath. * * @return the cached JobConf */ public static JobConf getCachedJobConf() { - return _rJob; + try{ + loaded.get(); + return _rJob; + } + catch(Exception e){ + throw new RuntimeException(e); + } } public static void setCachedJobConf(JobConf job) {