@Override public String getAppNodeLabelExpression() { String appNodeLabelExpression = getApplicationSubmissionContext().getNodeLabelExpression(); appNodeLabelExpression = (appNodeLabelExpression == null) ? NodeLabel.NODE_LABEL_EXPRESSION_NOT_SET : appNodeLabelExpression; appNodeLabelExpression = (appNodeLabelExpression.trim().isEmpty()) ? NodeLabel.DEFAULT_NODE_LABEL_PARTITION : appNodeLabelExpression; return appNodeLabelExpression; }
@Test public void testNodeLabelExp() throws Exception { JobConf jobConf = new JobConf(); jobConf.set(MRJobConfig.JOB_NODE_LABEL_EXP, "GPU"); jobConf.set(MRJobConfig.AM_NODE_LABEL_EXP, "highMem"); YARNRunner yarnRunner = new YARNRunner(jobConf); ApplicationSubmissionContext appSubCtx = buildSubmitContext(yarnRunner, jobConf); assertEquals(appSubCtx.getNodeLabelExpression(), "GPU"); assertEquals(appSubCtx.getAMContainerResourceRequest() .getNodeLabelExpression(), "highMem"); }
when(asc.getUnmanagedAM()).thenReturn(false); when(asc.getPriority()).thenReturn(Priority.newInstance(10)); when(asc.getNodeLabelExpression()).thenReturn("high-cpu"); ContainerLaunchContext containerLaunchContext = mock(ContainerLaunchContext.class);
static int getExpectedNumberOfElements(RMApp app) { int expectedNumberOfElements = 40 + 2; // 2 -> resourceRequests if (app.getApplicationSubmissionContext() .getNodeLabelExpression() != null) { expectedNumberOfElements++; } if (app.getAMResourceRequests().get(0).getNodeLabelExpression() != null) { expectedNumberOfElements++; } if (AppInfo .getAmRPCAddressFromRMAppAttempt(app.getCurrentAppAttempt()) != null) { expectedNumberOfElements++; } return expectedNumberOfElements; } }
ApplicationSubmissionContext asContext = mock(ApplicationSubmissionContext.class); when(asContext.getMaxAppAttempts()).thenReturn(1); when(asContext.getNodeLabelExpression()).thenReturn(appNodeLabelExpression); when(asContext.getPriority()).thenReturn(Priority.newInstance(0)); RMAppImpl app =
if (null == req.getNodeLabelExpression() && ResourceRequest.ANY.equals(req.getResourceName())) { req.setNodeLabelExpression(asc.getNodeLabelExpression());
if (null == req.getNodeLabelExpression() && ResourceRequest.ANY.equals(req.getResourceName())) { req.setNodeLabelExpression(asc.getNodeLabelExpression());
unmanagedApplication = appSubmissionContext.getUnmanagedAM(); appNodeLabelExpression = app.getApplicationSubmissionContext().getNodeLabelExpression(); app.getApplicationSubmissionContext().getNodeLabelExpression();
if (null == req.getNodeLabelExpression() && ResourceRequest.ANY.equals(req.getResourceName())) { req.setNodeLabelExpression(asc.getNodeLabelExpression());
when(asc.getUnmanagedAM()).thenReturn(false); when(asc.getPriority()).thenReturn(Priority.newInstance(1)); when(asc.getNodeLabelExpression()).thenReturn("high-cpu"); ContainerLaunchContext containerLaunchContext = mock(ContainerLaunchContext.class); app.getApplicationSubmissionContext().getNodeLabelExpression(), entity.getOtherInfo() .get(ApplicationMetricsConstants.APP_NODE_LABEL_EXPRESSION));
private void pruneAppState(ApplicationStateData appState) { ApplicationSubmissionContext srcCtx = appState.getApplicationSubmissionContext(); ApplicationSubmissionContextPBImpl context = new ApplicationSubmissionContextPBImpl(); // most fields in the ApplicationSubmissionContext are not needed, // but the following few need to be present for recovery to succeed context.setApplicationId(srcCtx.getApplicationId()); context.setResource(srcCtx.getResource()); context.setQueue(srcCtx.getQueue()); context.setAMContainerResourceRequests( srcCtx.getAMContainerResourceRequests()); context.setApplicationName(srcCtx.getApplicationName()); context.setPriority(srcCtx.getPriority()); context.setApplicationTags(srcCtx.getApplicationTags()); context.setApplicationType(srcCtx.getApplicationType()); context.setUnmanagedAM(srcCtx.getUnmanagedAM()); context.setNodeLabelExpression(srcCtx.getNodeLabelExpression()); ContainerLaunchContextPBImpl amContainerSpec = new ContainerLaunchContextPBImpl(); amContainerSpec.setApplicationACLs( srcCtx.getAMContainerSpec().getApplicationACLs()); context.setAMContainerSpec(amContainerSpec); appState.setApplicationSubmissionContext(context); } }
context.setLogAggregationContext(oldAppSubCtxt.getLogAggregationContext()); context.setApplicationType(oldAppSubCtxt.getApplicationType()); context.setNodeLabelExpression(oldAppSubCtxt.getNodeLabelExpression()); this.appSubCtxtCopy.put(oldAppSubCtxt.getApplicationId(), context);
unmanagedApplication); assertEquals("unmanagedApplication doesn't match", app.getApplicationSubmissionContext().getNodeLabelExpression(), appNodeLabelExpression); assertEquals("unmanagedApplication doesn't match",
.getNodeLabelExpression() != null) { assertEquals("appNodeLabelExpression doesn't match", app.getApplicationSubmissionContext().getNodeLabelExpression(), info.getString("appNodeLabelExpression"));
String amNodeLabelExpression = null; if (app.getApplicationSubmissionContext() .getNodeLabelExpression() != null) { expectedNumberOfElements++; appNodeLabelExpression = info.getString("appNodeLabelExpression");
getXmlBoolean(info, "unmanagedApplication")); assertEquals("unmanagedApplication doesn't match", app.getApplicationSubmissionContext().getNodeLabelExpression(), getXmlString(info, "appNodeLabelExpression")); assertEquals("unmanagedApplication doesn't match",