@@ -168,8 +168,8 @@ public void testApplicationLifetimeMonitor(Class schedulerParameter)
168
168
rm .sendAMLaunched (app1 .getCurrentAppAttempt ().getAppAttemptId ());
169
169
am1 .registerAppAttempt ();
170
170
rm .waitForState (app1 .getApplicationId (), RMAppState .KILLED );
171
- assertTrue (
172
- ( System . currentTimeMillis () - app1 . getSubmitTime ()) > 10000 , "Application killed before lifetime value" );
171
+ assertTrue (( System . currentTimeMillis () - app1 . getSubmitTime ()) > 10000 ,
172
+ "Application killed before lifetime value" );
173
173
174
174
Map <ApplicationTimeoutType , String > updateTimeout =
175
175
new HashMap <ApplicationTimeoutType , String >();
@@ -197,8 +197,8 @@ public void testApplicationLifetimeMonitor(Class schedulerParameter)
197
197
long afterUpdate =
198
198
applicationTimeouts .get (ApplicationTimeoutType .LIFETIME );
199
199
200
- assertTrue (
201
- afterUpdate > beforeUpdate , "Application lifetime value not updated" );
200
+ assertTrue (afterUpdate > beforeUpdate ,
201
+ "Application lifetime value not updated" );
202
202
203
203
// verify for application report.
204
204
RecordFactory recordFactory =
@@ -209,17 +209,16 @@ public void testApplicationLifetimeMonitor(Class schedulerParameter)
209
209
Map <ApplicationTimeoutType , ApplicationTimeout > appTimeouts = rm
210
210
.getRMContext ().getClientRMService ().getApplicationReport (appRequest )
211
211
.getApplicationReport ().getApplicationTimeouts ();
212
- assertTrue (
213
- !appTimeouts .isEmpty (), "Application Timeout are empty." );
212
+ assertTrue (!appTimeouts .isEmpty (), "Application Timeout are empty." );
214
213
ApplicationTimeout timeout =
215
214
appTimeouts .get (ApplicationTimeoutType .LIFETIME );
216
- assertTrue (
217
- timeout . getRemainingTime () > 0 , "Application remaining time is incorrect" );
215
+ assertTrue (timeout . getRemainingTime () > 0 ,
216
+ "Application remaining time is incorrect" );
218
217
219
218
rm .waitForState (app2 .getApplicationId (), RMAppState .KILLED );
220
219
// verify for app killed with updated lifetime
221
- assertTrue (
222
- app2 . getFinishTime () > afterUpdate , "Application killed before lifetime value" );
220
+ assertTrue (app2 . getFinishTime () > afterUpdate ,
221
+ "Application killed before lifetime value" );
223
222
224
223
if (scheduler .equals (CapacityScheduler .class )) {
225
224
// Supported only on capacity scheduler
@@ -229,11 +228,10 @@ public void testApplicationLifetimeMonitor(Class schedulerParameter)
229
228
// so killed after queue max lifetime.
230
229
rm .waitForState (app4 .getApplicationId (), RMAppState .KILLED );
231
230
long totalTimeRun = app4 .getFinishTime () - app4 .getSubmitTime ();
232
- assertTrue (
233
- totalTimeRun > (maxLifetime * 1000 ), "Application killed before lifetime value" );
234
- assertTrue (
235
-
236
- totalTimeRun < ((maxLifetime + 10L ) * 1000 ), "Application killed before lifetime value " + totalTimeRun );
231
+ assertTrue (totalTimeRun > (maxLifetime * 1000 ),
232
+ "Application killed before lifetime value" );
233
+ assertTrue (totalTimeRun < ((maxLifetime + 10L ) * 1000 ),
234
+ "Application killed before lifetime value " + totalTimeRun );
237
235
}
238
236
} finally {
239
237
stopRM (rm );
@@ -314,9 +312,8 @@ public void testApplicationLifetimeOnRMRestart(Class schedulerParameter) throws
314
312
315
313
// wait for app life time and application to be in killed state.
316
314
rm2 .waitForState (recoveredApp1 .getApplicationId (), RMAppState .KILLED );
317
- assertTrue (
318
- recoveredApp1 .getFinishTime () > (recoveredApp1 .getSubmitTime ()
319
- + appLifetime * 1000 ), "Application killed before lifetime value" );
315
+ assertTrue (recoveredApp1 .getFinishTime () > (recoveredApp1 .getSubmitTime ()
316
+ + appLifetime * 1000 ), "Application killed before lifetime value" );
320
317
}
321
318
322
319
@ Timeout (value = 60 )
@@ -382,21 +379,21 @@ public synchronized void updateApplicationStateInternal(
382
379
fail ("Update application should fail." );
383
380
} catch (YarnException e ) {
384
381
// expected
385
- assertTrue (
386
- e . getMessage (). contains ( app1 . getApplicationId (). toString ()), "State-store exception does not containe appId" );
382
+ assertTrue (e . getMessage (). contains ( app1 . getApplicationId (). toString ()),
383
+ "State-store exception does not containe appId" );
387
384
}
388
385
389
386
applicationTimeouts = app1 .getApplicationTimeouts ();
390
387
// has old timeout time
391
388
long afterUpdate =
392
389
applicationTimeouts .get (ApplicationTimeoutType .LIFETIME );
393
390
394
- assertEquals (beforeUpdate
395
- , afterUpdate , "Application timeout is updated" );
391
+ assertEquals (beforeUpdate , afterUpdate ,
392
+ "Application timeout is updated" );
396
393
rm1 .waitForState (app1 .getApplicationId (), RMAppState .KILLED );
397
394
// verify for app killed with updated lifetime
398
- assertTrue (
399
- app1 . getFinishTime () > afterUpdate , "Application killed before lifetime value" );
395
+ assertTrue (app1 . getFinishTime () > afterUpdate ,
396
+ "Application killed before lifetime value" );
400
397
} finally {
401
398
stopRM (rm1 );
402
399
}
@@ -446,21 +443,20 @@ public void testInheritAppLifetimeFromParentQueue(Class schedulerParameter) thro
446
443
rm .waitForState (app1 .getApplicationId (), RMAppState .KILLED );
447
444
long totalTimeRun = app1 .getFinishTime () - app1 .getSubmitTime ();
448
445
// Child queue should have inherited parent max and default lifetimes.
449
- assertEquals (
450
- maxRootLifetime
451
- , csched . getQueue ( CQ1 ). getMaximumApplicationLifetime (), "Child queue max lifetime should have overridden"
446
+ assertEquals (maxRootLifetime ,
447
+ csched . getQueue ( CQ1 ). getMaximumApplicationLifetime (),
448
+ "Child queue max lifetime should have overridden"
452
449
+ " parent value" );
453
- assertEquals (
454
- defaultRootLifetime
455
- , csched . getQueue ( CQ1 ). getDefaultApplicationLifetime (), "Child queue default lifetime should have"
450
+ assertEquals (defaultRootLifetime ,
451
+ csched . getQueue ( CQ1 ). getDefaultApplicationLifetime (),
452
+ "Child queue default lifetime should have"
456
453
+ " overridden parent value" );
457
454
// app1 (run in the 'child1' queue) should have run longer than the
458
455
// default lifetime but less than the max lifetime.
459
- assertTrue (
460
- totalTimeRun > (defaultRootLifetime * 1000 ), "Application killed before default lifetime value" );
461
- assertTrue (
462
-
463
- totalTimeRun < (maxRootLifetime * 1000 ), "Application killed after max lifetime value " + totalTimeRun );
456
+ assertTrue (totalTimeRun > (defaultRootLifetime * 1000 ),
457
+ "Application killed before default lifetime value" );
458
+ assertTrue (totalTimeRun < (maxRootLifetime * 1000 ),
459
+ "Application killed after max lifetime value " + totalTimeRun );
464
460
}
465
461
} finally {
466
462
stopRM (rm );
@@ -514,14 +510,12 @@ public void testOverrideParentQueueMaxAppLifetime(Class schedulerParameter) thro
514
510
rm .waitForState (app1 .getApplicationId (), RMAppState .KILLED );
515
511
long totalTimeRun = app1 .getFinishTime () - app1 .getSubmitTime ();
516
512
// Child queue's max lifetime can override parent's and be larger.
517
- assertTrue (
518
- (maxRootLifetime < maxChildLifetime )
519
- && (totalTimeRun > (maxChildLifetime * 1000 )), "Application killed before default lifetime value" );
520
- assertEquals (
521
- maxRootLifetime
522
- , csched .getRootQueue ().getMaximumApplicationLifetime (), "Root queue max lifetime property set incorrectly" );
523
- assertEquals (maxChildLifetime
524
- , csched .getQueue (CQ1 ).getMaximumApplicationLifetime (), "Child queue max lifetime should have overridden"
513
+ assertTrue ((maxRootLifetime < maxChildLifetime ) && (totalTimeRun > (maxChildLifetime * 1000 )),
514
+ "Application killed before default lifetime value" );
515
+ assertEquals (maxRootLifetime , csched .getRootQueue ().getMaximumApplicationLifetime (),
516
+ "Root queue max lifetime property set incorrectly" );
517
+ assertEquals (maxChildLifetime , csched .getQueue (CQ1 ).getMaximumApplicationLifetime (),
518
+ "Child queue max lifetime should have overridden"
525
519
+ " parent value" );
526
520
}
527
521
} finally {
@@ -577,18 +571,16 @@ public void testOverrideParentQueueDefaultAppLifetime(
577
571
long totalTimeRun = app1 .getFinishTime () - app1 .getSubmitTime ();
578
572
// app1 (run in 'child1' queue) should have overridden the parent's
579
573
// default lifetime.
580
- assertTrue (
581
- totalTimeRun > ( defaultChildLifetime * 1000 ), "Application killed before default lifetime value" );
574
+ assertTrue (totalTimeRun > ( defaultChildLifetime * 1000 ),
575
+ "Application killed before default lifetime value" );
582
576
// Root and child queue's max lifetime should be -1.
583
- assertEquals (
584
- maxRootLifetime
585
- , csched .getRootQueue ().getMaximumApplicationLifetime (), "Root queue max lifetime property set incorrectly" );
586
- assertEquals (
587
- maxChildLifetime
588
- , csched .getQueue (CQ1 ).getMaximumApplicationLifetime (), "Child queue max lifetime property set incorrectly" );
577
+ assertEquals (maxRootLifetime , csched .getRootQueue ().getMaximumApplicationLifetime (),
578
+ "Root queue max lifetime property set incorrectly" );
579
+ assertEquals (maxChildLifetime , csched .getQueue (CQ1 ).getMaximumApplicationLifetime (),
580
+ "Child queue max lifetime property set incorrectly" );
589
581
// 'child1' queue's default lifetime should have overridden parent's.
590
- assertEquals (defaultChildLifetime
591
- , csched . getQueue ( CQ1 ). getDefaultApplicationLifetime (), "Child queue default lifetime should have"
582
+ assertEquals (defaultChildLifetime , csched . getQueue ( CQ1 ). getDefaultApplicationLifetime (),
583
+ "Child queue default lifetime should have"
592
584
+ " overridden parent value" );
593
585
}
594
586
} finally {
0 commit comments