Skip to content

Commit 2ef2ebd

Browse files
committed
[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.
1 parent e6d8248 commit 2ef2ebd

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/test/java/org/apache/sysds/test/applications/nn/BaseTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ public abstract class BaseTest extends MLContextTestBase {
3232

3333
private static final String ERROR_STRING = "ERROR:";
3434

35+
public BaseTest() {
36+
//disable debug and trace logging in mlcontext super class since
37+
//the nn tests execute a lot of mini-batch operations
38+
_enableTracing = false;
39+
}
3540

3641
protected void run(String name) {
3742
run(name, false);

src/test/java/org/apache/sysds/test/functions/mlcontext/MLContextTestBase.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ public abstract class MLContextTestBase extends AutomatedTestBase {
6666
protected String testDir = null;
6767
protected String testName = null;
6868
protected Level _oldLevel = null;
69-
69+
protected boolean _enableTracing = true;
70+
7071
@Override
7172
public void setUp() {
7273
Class<? extends MLContextTestBase> clazz = this.getClass();
@@ -78,10 +79,12 @@ public void setUp() {
7879

7980
//run all mlcontext tests in loglevel trace to improve test coverage
8081
//of all logging in various components
81-
_oldLevel = Logger.getLogger("org.apache.sysds").getLevel();
82-
Logger.getLogger("org.apache.sysds").setLevel( Level.TRACE );
82+
if( _enableTracing ) {
83+
_oldLevel = Logger.getLogger("org.apache.sysds").getLevel();
84+
Logger.getLogger("org.apache.sysds").setLevel( Level.TRACE );
85+
}
8386
}
84-
87+
8588
@BeforeClass
8689
public static void setUpClass() {
8790
spark = createSystemDSSparkSession("SystemDS MLContext Test", "local");
@@ -93,7 +96,8 @@ public static void setUpClass() {
9396
@Override
9497
public void tearDown() {
9598
super.tearDown();
96-
Logger.getLogger("org.apache.sysds").setLevel( _oldLevel );
99+
if(_enableTracing)
100+
Logger.getLogger("org.apache.sysds").setLevel( _oldLevel );
97101
}
98102

99103
@AfterClass

0 commit comments

Comments
 (0)