@Override public void handle(RMAppEvent event) { ApplicationId appID = event.getApplicationId(); RMApp rmApp = this.rmContext.getRMApps().get(appID); if (rmApp != null) { try { rmApp.handle(event); } catch (Throwable t) { LOG.error("Error in handling event type " + event.getType() + " for application " + appID, t); } } } }
@Override public void handle(RMAppEvent event) { ApplicationId appID = event.getApplicationId(); RMApp rmApp = this.rmContext.getRMApps().get(appID); if (rmApp != null) { try { rmApp.handle(event); } catch (Throwable t) { LOG.error("Error in handling event type " + event.getType() + " for application " + appID, t); } } } }
@Override public void handle(RMAppEvent event) { ApplicationId appID = event.getApplicationId(); RMApp rmApp = this.rmContext.getRMApps().get(appID); if (rmApp != null) { try { rmApp.handle(event); } catch (Throwable t) { LOG.error("Error in handling event type " + event.getType() + " for application " + appID, t); } } } }
/** * Log the audit event for kill by client. * @param event The {@link RMAppEvent} to be logged */ static void auditLogKillEvent(RMAppEvent event) { if (event instanceof RMAppKillByClientEvent) { RMAppKillByClientEvent killEvent = (RMAppKillByClientEvent) event; UserGroupInformation callerUGI = killEvent.getCallerUGI(); String userName = null; if (callerUGI != null) { userName = callerUGI.getShortUserName(); } InetAddress remoteIP = killEvent.getIp(); RMAuditLogger.logSuccess(userName, AuditConstants.KILL_APP_REQUEST, "RMAppImpl", event.getApplicationId(), remoteIP); } }
/** * Log the audit event for kill by client. * * @param event * The {@link RMAppEvent} to be logged */ static void auditLogKillEvent(RMAppEvent event) { if (event instanceof RMAppKillByClientEvent) { RMAppKillByClientEvent killEvent = (RMAppKillByClientEvent) event; UserGroupInformation callerUGI = killEvent.getCallerUGI(); String userName = null; if (callerUGI != null) { userName = callerUGI.getShortUserName(); } InetAddress remoteIP = killEvent.getIp(); RMAuditLogger.logSuccess(userName, AuditConstants.KILL_APP_REQUEST, "RMAppImpl", event.getApplicationId(), remoteIP); } }
@Override public void handle(RMAppEvent event) { this.writeLock.lock(); try { ApplicationId appID = event.getApplicationId(); LOG.debug("Processing event for " + appID + " of type " + event.getType()); final RMAppState oldState = getState(); try { /* keep the master in sync with the state machine */ this.stateMachine.doTransition(event.getType(), event); } catch (InvalidStateTransitonException e) { LOG.error("Can't handle this event at current state", e); /* TODO fail the application on the failed transition */ } if (oldState != getState()) { LOG.info(appID + " State change from " + oldState + " to " + getState()); } } finally { this.writeLock.unlock(); } }
@Override public void handle(Event rawEvent) { if (rawEvent instanceof RMAppEvent) { RMAppEvent event = (RMAppEvent) rawEvent; if (event.getApplicationId().equals(appId1)) { try { startBarrier.await(); endBarrier.await(); } catch (BrokenBarrierException e) { LOG.warn("Broken Barrier", e); } catch (InterruptedException e) { LOG.warn("Interrupted while awaiting barriers", e); } } } } };
@Override public void handle(Event rawEvent) { if (rawEvent instanceof RMAppEvent) { RMAppEvent event = (RMAppEvent) rawEvent; if (event.getApplicationId().equals(appId1)) { try { startBarrier.await(); endBarrier.await(); } catch (BrokenBarrierException e) { LOG.warn("Broken Barrier", e); } catch (InterruptedException e) { LOG.warn("Interrupted while awaiting barriers", e); } } } } };
@Override public void handle(RMAppEvent event) { this.writeLock.lock(); try { ApplicationId appID = event.getApplicationId(); LOG.debug("Processing event for " + appID + " of type " + event.getType()); final RMAppState oldState = getState(); try { /* keep the master in sync with the state machine */ this.stateMachine.doTransition(event.getType(), event); } catch (InvalidStateTransitonException e) { LOG.error("Can't handle this event at current state", e); /* TODO fail the application on the failed transition */ } if (oldState != getState()) { LOG.info(appID + " State change from " + oldState + " to " + getState() + " on event=" + event.getType()); } } finally { this.writeLock.unlock(); } }
ApplicationId appID = event.getApplicationId(); LOG.debug("Processing event for " + appID + " of type " + event.getType());
@Override public void handle(RMAppEvent event) { ApplicationId appID = event.getApplicationId(); RMApp rmApp = this.rmContext.getRMApps().get(appID); if (rmApp != null) { try { rmApp.handle(event); } catch (Throwable t) { LOG.error("Error in handling event type " + event.getType() + " for application " + appID, t); } } } }
@Override public void handle(RMAppEvent event) { ApplicationId appID = event.getApplicationId(); RMApp rmApp = this.rmContext.getRMApps().get(appID); if (rmApp != null) { try { rmApp.handle(event); } catch (Throwable t) { LOG.error("Error in handling event type " + event.getType() + " for application " + appID, t); } } } }
@Test(timeout=60000) public void testAppRejectionWithCancelledDelegationToken() throws Exception { MyFS dfs = (MyFS)FileSystem.get(conf); LOG.info("dfs="+(Object)dfs.hashCode() + ";conf="+conf.hashCode()); MyToken token = dfs.getDelegationToken("user1"); token.cancelToken(); Credentials ts = new Credentials(); ts.addToken(token.getKind(), token); // register the tokens for renewal ApplicationId appId = BuilderUtils.newApplicationId(0, 0); delegationTokenRenewer.addApplicationAsync(appId, ts, true, "user"); int waitCnt = 20; while (waitCnt-- >0) { if (!eventQueue.isEmpty()) { Event evt = eventQueue.take(); if (evt.getType() == RMAppEventType.APP_REJECTED) { Assert.assertTrue( ((RMAppEvent) evt).getApplicationId().equals(appId)); return; } } else { Thread.sleep(500); } } fail("App submission with a cancelled token should have failed"); }
@Test(timeout=60000) public void testAppRejectionWithCancelledDelegationToken() throws Exception { MyFS dfs = (MyFS)FileSystem.get(conf); LOG.info("dfs="+(Object)dfs.hashCode() + ";conf="+conf.hashCode()); MyToken token = dfs.getDelegationToken("user1"); token.cancelToken(); Credentials ts = new Credentials(); ts.addToken(token.getKind(), token); // register the tokens for renewal ApplicationId appId = BuilderUtils.newApplicationId(0, 0); delegationTokenRenewer.addApplicationAsync(appId, ts, true, "user", new Configuration()); int waitCnt = 20; while (waitCnt-- >0) { if (!eventQueue.isEmpty()) { Event evt = eventQueue.take(); if (evt.getType() == RMAppEventType.APP_REJECTED) { Assert.assertTrue( ((RMAppEvent) evt).getApplicationId().equals(appId)); return; } } else { Thread.sleep(500); } } fail("App submission with a cancelled token should have failed"); }
@Override public void handle(RMAppEvent event) { assertEquals(application.getApplicationId(), event.getApplicationId()); if (event instanceof RMAppFailedAttemptEvent) { transferStateFromPreviousAttempt = ((RMAppFailedAttemptEvent) event) .getTransferStateFromPreviousAttempt(); } try { application.handle(event); } catch (Throwable t) { LOG.error("Error in handling event type " + event.getType() + " for application " + application.getApplicationId(), t); } } }
@Override public void handle(RMAppEvent event) { assertEquals(application.getApplicationId(), event.getApplicationId()); if (event instanceof RMAppFailedAttemptEvent) { transferStateFromPreviousAttempt = ((RMAppFailedAttemptEvent) event) .getTransferStateFromPreviousAttempt(); } try { application.handle(event); } catch (Throwable t) { LOG.error("Error in handling event type " + event.getType() + " for application " + application.getApplicationId(), t); } } }