From 2ef2ebda85f1115cb89bc8ca86768fa4852ab0e7 Mon Sep 17 00:00:00 2001 From: Matthias Boehm Date: Tue, 3 Dec 2024 12:07:52 +0100 Subject: [PATCH] [MINOR] Fix mlcontext debug/trace logging (not in nn tests) This patch fixes the recently enabled debug/trace logging in mlcontext because the application tests timeout. Unfortunately, the nn tests (in applications) inherit from the mlcontext tests and these nn tests execute a log of tiny mini-batch operations where the log output is just way too large. --- .../sysds/test/applications/nn/BaseTest.java | 5 +++++ .../functions/mlcontext/MLContextTestBase.java | 14 +++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/apache/sysds/test/applications/nn/BaseTest.java b/src/test/java/org/apache/sysds/test/applications/nn/BaseTest.java index 2fa9f556793..f8b33fdc3eb 100644 --- a/src/test/java/org/apache/sysds/test/applications/nn/BaseTest.java +++ b/src/test/java/org/apache/sysds/test/applications/nn/BaseTest.java @@ -32,6 +32,11 @@ public abstract class BaseTest extends MLContextTestBase { private static final String ERROR_STRING = "ERROR:"; + public BaseTest() { + //disable debug and trace logging in mlcontext super class since + //the nn tests execute a lot of mini-batch operations + _enableTracing = false; + } protected void run(String name) { run(name, false); diff --git a/src/test/java/org/apache/sysds/test/functions/mlcontext/MLContextTestBase.java b/src/test/java/org/apache/sysds/test/functions/mlcontext/MLContextTestBase.java index 6b5df523f57..b21bcaf54c5 100644 --- a/src/test/java/org/apache/sysds/test/functions/mlcontext/MLContextTestBase.java +++ b/src/test/java/org/apache/sysds/test/functions/mlcontext/MLContextTestBase.java @@ -66,7 +66,8 @@ public abstract class MLContextTestBase extends AutomatedTestBase { protected String testDir = null; protected String testName = null; protected Level _oldLevel = null; - + protected boolean _enableTracing = true; + @Override public void setUp() { Class clazz = this.getClass(); @@ -78,10 +79,12 @@ public void setUp() { //run all mlcontext tests in loglevel trace to improve test coverage //of all logging in various components - _oldLevel = Logger.getLogger("org.apache.sysds").getLevel(); - Logger.getLogger("org.apache.sysds").setLevel( Level.TRACE ); + if( _enableTracing ) { + _oldLevel = Logger.getLogger("org.apache.sysds").getLevel(); + Logger.getLogger("org.apache.sysds").setLevel( Level.TRACE ); + } } - + @BeforeClass public static void setUpClass() { spark = createSystemDSSparkSession("SystemDS MLContext Test", "local"); @@ -93,7 +96,8 @@ public static void setUpClass() { @Override public void tearDown() { super.tearDown(); - Logger.getLogger("org.apache.sysds").setLevel( _oldLevel ); + if(_enableTracing) + Logger.getLogger("org.apache.sysds").setLevel( _oldLevel ); } @AfterClass