/** * Compute the expired date partition, using the underlying clock in UTC time. */ private static void computeExpiredDatePtn(long ttl) { // Use UTC date to ensure reader date is same on all timezones. LocalDate expiredDate = LocalDateTime.ofEpochSecond((clock.getTime() - ttl) / 1000, 0, ZoneOffset.UTC).toLocalDate(); expiredDatePtn = "date=" + DateTimeFormatter.ISO_LOCAL_DATE.format(expiredDate); }
public ContainerImpl(Configuration conf, Dispatcher dispatcher, ContainerLaunchContext launchContext, Credentials creds, NodeManagerMetrics metrics, ContainerTokenIdentifier containerTokenIdentifier, Context context) { this(conf, dispatcher, launchContext, creds, metrics, containerTokenIdentifier, context, SystemClock.getInstance().getTime()); }
public void turnOnAppActivitiesRecording(ApplicationId applicationId, double maxTime) { long startTS = SystemClock.getInstance().getTime(); long endTS = startTS + (long) (maxTime * 1000); recordingAppActivitiesUntilSpecifiedTime.put(applicationId, endTS); }
public AppActivitiesInfo(String errorMessage, String applicationId) { this.diagnostic = errorMessage; this.applicationId = applicationId; Date date = new Date(); date.setTime(SystemClock.getInstance().getTime()); this.timeStamp = date.toString(); }
@Override public long getLastHeartbeatTime() { return clock.getTime(); } @Override
public AppActivitiesInfo(List<AppAllocation> appAllocations, ApplicationId applicationId) { this.applicationId = applicationId.toString(); this.allocations = new ArrayList<>(); if (appAllocations == null) { diagnostic = "waiting for display"; Date date = new Date(); date.setTime(SystemClock.getInstance().getTime()); this.timeStamp = date.toString(); } else { for (int i = appAllocations.size() - 1; i > -1; i--) { AppAllocation appAllocation = appAllocations.get(i); AppAllocationInfo appAllocationInfo = new AppAllocationInfo( appAllocation); this.allocations.add(appAllocationInfo); } } } }
@Override public void onContainerStarted(ContainerId containerId, Map<String, ByteBuffer> allServiceResponse) { if (LOG.isDebugEnabled()) { LOG.debug("Succeeded to start Container " + containerId); } Container container = containers.get(containerId); if (container != null) { applicationMaster.nmClientAsync.getContainerStatusAsync( containerId, container.getNodeId()); } if (applicationMaster.timelineServiceV2Enabled) { long startTime = SystemClock.getInstance().getTime(); applicationMaster.getContainerStartTimes().put(containerId, startTime); applicationMaster.publishContainerStartEventOnTimelineServiceV2( container, startTime); } if (applicationMaster.timelineServiceV1Enabled) { applicationMaster.publishContainerStartEvent( applicationMaster.timelineClient, container, applicationMaster.domainId, applicationMaster.appSubmitterUgi); } }
Map.Entry<NodeId, List<NodeAllocation>> nodeAllocation = ite.next(); List<NodeAllocation> allocations = nodeAllocation.getValue(); long currTS = SystemClock.getInstance().getTime(); if (allocations.size() > 0 && allocations.get(0).getTimeStamp() - currTS > timeThreshold) {
void finishAppAllocationRecording(ApplicationId applicationId, ContainerId containerId, ActivityState appState, String diagnostic) { if (shouldRecordThisApp(applicationId)) { long currTS = SystemClock.getInstance().getTime(); AppAllocation appAllocation = appsAllocation.remove(applicationId); appAllocation.updateAppContainerStateAndTime(containerId, appState, currTS, diagnostic); List<AppAllocation> appAllocations; if (completedAppAllocations.containsKey(applicationId)) { appAllocations = completedAppAllocations.get(applicationId); } else { appAllocations = new ArrayList<>(); completedAppAllocations.put(applicationId, appAllocations); } if (appAllocations.size() == 1000) { appAllocations.remove(0); } appAllocations.add(appAllocation); if (recordingAppActivitiesUntilSpecifiedTime.get(applicationId) <= currTS) { turnOffActivityMonitoringForApp(applicationId); } } }
void finishNodeUpdateRecording(NodeId nodeID) { List<NodeAllocation> value = recordingNodesAllocation.get(nodeID); long timeStamp = SystemClock.getInstance().getTime(); if (value != null) { if (value.size() > 0) { lastAvailableNodeActivities = value; for (NodeAllocation allocation : lastAvailableNodeActivities) { allocation.transformToTree(); allocation.setTimeStamp(timeStamp); } if (recordNextAvailableNode) { recordNextAvailableNode = false; } } if (shouldRecordThisNode(nodeID)) { recordingNodesAllocation.remove(nodeID); completedNodeAllocations.put(nodeID, value); stopRecordNodeUpdateActivities(nodeID); } } }
containerStartTimes.get(containerStatus.getContainerId()); if (containerStartTime == null) { containerStartTime = SystemClock.getInstance().getTime(); containerStartTimes.put(containerStatus.getContainerId(), containerStartTime);
private CSAssignment allocateFromReservedContainer(Resource clusterResource, CandidateNodeSet<FiCaSchedulerNode> candidates, ResourceLimits currentResourceLimits, SchedulingMode schedulingMode) { // Considering multi-node scheduling, its better to iterate through // all candidates and stop once we get atleast one good node to allocate // where reservation was made earlier. In normal case, there is only one // node and hence there wont be any impact after this change. for (FiCaSchedulerNode node : candidates.getAllNodes().values()) { RMContainer reservedContainer = node.getReservedContainer(); if (reservedContainer != null) { FiCaSchedulerApp application = getApplication( reservedContainer.getApplicationAttemptId()); if (null != application) { ActivitiesLogger.APP.startAppAllocationRecording(activitiesManager, node, SystemClock.getInstance().getTime(), application); CSAssignment assignment = application.assignContainers( clusterResource, candidates, currentResourceLimits, schedulingMode, reservedContainer); return assignment; } } } return null; }
.thenReturn(clock.getTime()); canCommit = listener.canCommit(tid); assertTrue(canCommit);
YarnServerSecurityUtils.parseCredentials(launchContext); long containerStartTime = SystemClock.getInstance().getTime(); Container container = new ContainerImpl(getConfig(), this.dispatcher,
rmhh.setLastHeartbeatTime(clock.getTime()); timeToWaitMs = 5000; while (jeh.numCommitCompletedEvents != 1 && timeToWaitMs > 0) {
node, SystemClock.getInstance().getTime(), application);
private void setupCluster() throws IOException { resourceManager = new MockRM(conf); scheduler = (FairScheduler) resourceManager.getResourceScheduler(); // YARN-6249, FSLeafQueue#lastTimeAtMinShare is initialized to the time in // the real world, so we should keep the clock up with it. clock.setTime(SystemClock.getInstance().getTime()); scheduler.setClock(clock); resourceManager.start(); // Create and add two nodes to the cluster, with capacities // disproportional to the container requests. addNode(NODE_CAPACITY_MULTIPLE * GB, 3 * NODE_CAPACITY_MULTIPLE); addNode(NODE_CAPACITY_MULTIPLE * GB, 3 * NODE_CAPACITY_MULTIPLE); // Reinitialize the scheduler so DRF policy picks up cluster capacity // TODO (YARN-6194): One shouldn't need to call this scheduler.reinitialize(conf, resourceManager.getRMContext()); // Verify if child-1 and child-2 are preemptable FSQueue child1 = scheduler.getQueueManager().getQueue("nonpreemptable.child-1"); assertFalse(child1.isPreemptable()); FSQueue child2 = scheduler.getQueueManager().getQueue("nonpreemptable.child-2"); assertFalse(child2.isPreemptable()); }