@GET @Path(RMWSConsts.APPS_APPID_PRIORITY) @Produces({ MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8, MediaType.APPLICATION_XML + "; " + JettyUtils.UTF_8 }) @Override public AppPriority getAppPriority(@Context HttpServletRequest hsr, @PathParam(RMWSConsts.APPID) String appId) throws AuthorizationException { initForReadableEndpoints(); UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true); String userName = "UNKNOWN-USER"; if (callerUGI != null) { userName = callerUGI.getUserName(); } RMApp app = null; try { app = getRMAppForAppId(appId); } catch (NotFoundException e) { RMAuditLogger.logFailure(userName, AuditConstants.GET_APP_PRIORITY, "UNKNOWN", "RMWebService", "Trying to get priority of an absent application " + appId); throw e; } AppPriority ret = new AppPriority(); ret.setPriority(app.getApplicationPriority().getPriority()); return ret; }
throw e; Priority priority = app.getApplicationPriority(); if (priority == null || priority.getPriority() != targetPriority.getPriority()) {
new AppPriority(app.getApplicationPriority().getPriority()); return Response.status(Status.OK).entity(ret).build();
newAppPriority, applicationId, future, callerUGI); if (app.getApplicationPriority().equals(appPriority)) { return;
@SuppressWarnings("unchecked") @Override public void appUpdated(RMApp app, long currentTimeMillis) { ApplicationEntity entity = createApplicationEntity(app.getApplicationId()); Map<String, Object> eventInfo = new HashMap<String, Object>(); eventInfo.put(ApplicationMetricsConstants.QUEUE_ENTITY_INFO, app.getQueue()); eventInfo.put(ApplicationMetricsConstants.APPLICATION_PRIORITY_INFO, app.getApplicationPriority().getPriority()); TimelineEvent tEvent = new TimelineEvent(); tEvent.setId(ApplicationMetricsConstants.UPDATED_EVENT_TYPE); tEvent.setTimestamp(currentTimeMillis); tEvent.setInfo(eventInfo); entity.addEvent(tEvent); getDispatcher().getEventHandler().handle(new TimelineV2PublishEvent( SystemMetricsEventType.PUBLISH_ENTITY, entity, app.getApplicationId())); }
@SuppressWarnings("unchecked") @Override public void appUpdated(RMApp app, long updatedTime) { TimelineEntity entity = createApplicationEntity(app.getApplicationId()); Map<String, Object> eventInfo = new HashMap<String, Object>(); eventInfo.put(ApplicationMetricsConstants.QUEUE_ENTITY_INFO, app.getQueue()); eventInfo.put(ApplicationMetricsConstants.APPLICATION_PRIORITY_INFO, app.getApplicationPriority().getPriority()); TimelineEvent tEvent = new TimelineEvent(); tEvent.setEventType(ApplicationMetricsConstants.UPDATED_EVENT_TYPE); tEvent.setTimestamp(updatedTime); tEvent.setEventInfo(eventInfo); entity.addEvent(tEvent); getDispatcher().getEventHandler().handle(new TimelineV1PublishEvent( SystemMetricsEventType.PUBLISH_ENTITY, entity, app.getApplicationId())); }
applicationId); response.setApplicationPriority(application .getApplicationPriority()); return response; response.setApplicationPriority(application.getApplicationPriority()); return response;
.thenReturn(Priority.newInstance(0)); when(app.getApplicationPriority()).thenReturn(Priority.newInstance(10)); ContainerLaunchContext containerLaunchContext = mock(ContainerLaunchContext.class);
when(appSubmissionContext.getAMContainerSpec()) .thenReturn(containerLaunchContext); when(rmApp.getApplicationPriority()).thenReturn(Priority.newInstance(10)); when(rmApp.getApplicationSubmissionContext()) .thenReturn(appSubmissionContext);
.thenReturn(Collections.singletonList(amReq)); when(app.getAmNodeLabelExpression()).thenCallRealMethod(); when(app.getApplicationPriority()).thenReturn(Priority.newInstance(10)); when(app.getCallerContext()) .thenReturn(new CallerContext.Builder("context").build());
app.getApplicationSubmissionContext().getUnmanagedAM()); entityInfo.put(ApplicationMetricsConstants.APPLICATION_PRIORITY_INFO, app.getApplicationPriority().getPriority()); entityInfo.put(ApplicationMetricsConstants.AM_NODE_LABEL_EXPRESSION, app.getAmNodeLabelExpression());
app.getApplicationSubmissionContext().getUnmanagedAM()); entityInfo.put(ApplicationMetricsConstants.APPLICATION_PRIORITY_INFO, app.getApplicationPriority().getPriority()); entity.getConfigs().put( ApplicationMetricsConstants.AM_NODE_LABEL_EXPRESSION,
this.masterNodeId = ""; if (app.getApplicationPriority() != null) { this.priority = app.getApplicationPriority().getPriority();
when(asc.getAMContainerSpec()).thenReturn(containerLaunchContext); when(app.getApplicationSubmissionContext()).thenReturn(asc); when(app.getApplicationPriority()).thenReturn(Priority.newInstance(1)); metricsPublisher.appUpdated(app, 4L); } else {
Assert.assertEquals(appPriority2, loadedApp.getApplicationPriority());
appPriority, app1.getApplicationPriority().getPriority());