/** * Get {@link ApplicationAttemptId} of the application master. * @return <code>ApplicationAttemptId</code> of the application master */ public ApplicationAttemptId getApplicationAttemptId() { return appSchedulingInfo.getApplicationAttemptId(); }
/** * Get {@link ApplicationAttemptId} of the application master. * @return <code>ApplicationAttemptId</code> of the application master */ public ApplicationAttemptId getApplicationAttemptId() { return appSchedulingInfo.getApplicationAttemptId(); }
/** * Get {@link ApplicationAttemptId} of the application master. * @return <code>ApplicationAttemptId</code> of the application master */ public ApplicationAttemptId getApplicationAttemptId() { return appSchedulingInfo.getApplicationAttemptId(); }
private static AppSchedulingInfo mockApp(String user) { AppSchedulingInfo app = mock(AppSchedulingInfo.class); when(app.getUser()).thenReturn(user); ApplicationId appId = BuilderUtils.newApplicationId(1, 1); ApplicationAttemptId id = BuilderUtils.newApplicationAttemptId(appId, 1); when(app.getApplicationAttemptId()).thenReturn(id); return app; }
private static AppSchedulingInfo mockApp(String user) { AppSchedulingInfo app = mock(AppSchedulingInfo.class); when(app.getUser()).thenReturn(user); ApplicationId appId = BuilderUtils.newApplicationId(1, 1); ApplicationAttemptId id = BuilderUtils.newApplicationAttemptId(appId, 1); when(app.getApplicationAttemptId()).thenReturn(id); return app; }
private void validateAndSetSchedulingRequest(SchedulingRequest newSchedulingRequest) throws SchedulerInvalidResoureRequestException { // Check sizing exists if (newSchedulingRequest.getResourceSizing() == null || newSchedulingRequest.getResourceSizing().getResources() == null) { throwExceptionWithMetaInfo( "No ResourceSizing found in the scheduling request, please double " + "check"); } // Check execution type == GUARANTEED if (newSchedulingRequest.getExecutionType() != null && newSchedulingRequest.getExecutionType().getExecutionType() != ExecutionType.GUARANTEED) { throwExceptionWithMetaInfo( "Only GUARANTEED execution type is supported."); } this.targetNodePartition = validateAndGetTargetNodePartition( newSchedulingRequest.getPlacementConstraint()); this.schedulingRequest = new SchedulingRequestPBImpl( ((SchedulingRequestPBImpl) newSchedulingRequest).getProto()); LOG.info("Successfully added SchedulingRequest to app=" + appSchedulingInfo.getApplicationAttemptId() + " placementConstraint=[" + schedulingRequest.getPlacementConstraint() + "]. nodePartition=" + targetNodePartition); }
@Before public void setup() throws Exception { // stub app scheduling info. appSchedulingInfo = mock(AppSchedulingInfo.class); when(appSchedulingInfo.getApplicationId()).thenReturn( TestUtils.getMockApplicationId(1)); when(appSchedulingInfo.getApplicationAttemptId()).thenReturn( TestUtils.getMockApplicationAttemptId(1, 1)); // stub RMContext rmContext = TestUtils.getMockRMContext(); // Create allocation tags manager AllocationTagsManager allocationTagsManager = new AllocationTagsManager( rmContext); PlacementConstraintManager placementConstraintManager = new MemoryPlacementConstraintManager(); spyAllocationTagsManager = spy(allocationTagsManager); schedulerRequestKey = new SchedulerRequestKey(Priority.newInstance(1), 2L, TestUtils.getMockContainerId(1, 1)); rmContext.setAllocationTagsManager(spyAllocationTagsManager); rmContext.setPlacementConstraintManager(placementConstraintManager); // Create allocator allocator = new SingleConstraintAppPlacementAllocator(); allocator.initialize(appSchedulingInfo, schedulerRequestKey, rmContext); }