/** * Check if a container is OPPORTUNISTIC or not. A container is * considered OPPORTUNISTIC only if its execution type is not * null and is OPPORTUNISTIC. */ private static boolean isOpportunistic(Container container) { return container.getContainerTokenIdentifier() != null && ExecutionType.OPPORTUNISTIC.equals( container.getContainerTokenIdentifier().getExecutionType()); } }
private void stopContainer(ContainerId containerId, int exitCode) { // A container is complete. Put this containers' logs up for aggregation if // this containers' logs are needed. AppLogAggregator aggregator = this.appLogAggregators.get( containerId.getApplicationAttemptId().getApplicationId()); if (aggregator == null) { LOG.warn("Log aggregation is not initialized for " + containerId + ", did it fail to start?"); return; } Container container = context.getContainers().get(containerId); if (null == container) { LOG.warn("Log aggregation cannot be started for " + containerId + ", as its an absent container"); return; } ContainerType containerType = container.getContainerTokenIdentifier().getContainerType(); aggregator.startContainerLogAggregation( new ContainerLogContext(containerId, containerType, exitCode)); }
private void startContainer(Container container) { LOG.info("Starting container [" + container.getContainerId()+ "]"); // Skip to put into runningContainers and addUtilization when recover if (!runningContainers.containsKey(container.getContainerId())) { runningContainers.put(container.getContainerId(), container); this.utilizationTracker.addContainerResources(container); } if (container.getContainerTokenIdentifier().getExecutionType() == ExecutionType.OPPORTUNISTIC) { this.metrics.startOpportunisticContainer(container.getResource()); } container.sendLaunchEvent(); }
private void reapDockerContainerNoPid(String user) throws IOException { String containerIdStr = container.getContainerTokenIdentifier().getContainerID().toString(); LOG.info("Unable to obtain pid, but docker container request detected. " + "Attempting to reap container " + containerIdStr); boolean result = exec.reapContainer( new ContainerReapContext.Builder() .setContainer(container) .setUser(container.getUser()) .build()); if (LOG.isDebugEnabled()) { LOG.debug("Sent signal to docker container " + containerIdStr + " as user " + user + ", result=" + (result ? "success" : "failed")); } } }
!hasSufficientResources(resourcesToFreeUp)) { Container runningCont = lifoIterator.next(); if (runningCont.getContainerTokenIdentifier().getExecutionType() == ExecutionType.OPPORTUNISTIC) {
LOG.debug("From NM Context container " + container.getContainerId()); if (container.getContainerId().getApplicationAttemptId().equals( attemptId) && container.getContainerTokenIdentifier() != null) { LOG.debug("Container type " + container.getContainerTokenIdentifier().getContainerType()); if (container.getContainerTokenIdentifier() .getContainerType() == ContainerType.APPLICATION_MASTER) { LOG.info("AM container {} found in context, has credentials: {}",
if (container.getContainerTokenIdentifier().getExecutionType() == ExecutionType.GUARANTEED) { queuedGuaranteedContainers.put(container.getContainerId(), container); if (resourceReleased) { this.utilizationTracker.subtractContainerResource(container); if (container.getContainerTokenIdentifier().getExecutionType() == ExecutionType.OPPORTUNISTIC) { this.metrics.completeOpportunisticContainer(container.getResource());
private boolean enqueueContainer(Container container) { boolean isGuaranteedContainer = container.getContainerTokenIdentifier(). getExecutionType() == ExecutionType.GUARANTEED;
try { int containerVCores = containerResource.getVirtualCores(); ContainerTokenIdentifier id = container.getContainerTokenIdentifier(); if (id != null && id.getExecutionType() == ExecutionType.OPPORTUNISTIC) {
CGroupsHandler.CGROUP_PARAM_MEMORY_HARD_LIMIT_BYTES, String.valueOf(containerHardLimit) + "M"); ContainerTokenIdentifier id = container.getContainerTokenIdentifier(); if (id != null && id.getExecutionType() == ExecutionType.OPPORTUNISTIC) {
throws IOException { ContainerId containerId = container.getContainerTokenIdentifier().getContainerID(); String containerIdStr = containerId.toString(); String user = container.getUser();
throws IOException { ContainerId containerId = container.getContainerTokenIdentifier().getContainerID(); String containerIdStr = containerId.toString(); String user = container.getUser();
@VisibleForTesting protected void scheduleContainer(Container container) { boolean isGuaranteedContainer = container.getContainerTokenIdentifier(). getExecutionType() == ExecutionType.GUARANTEED;
.get(this.appId).getContainers().values()) { ContainerType containerType = container.getContainerTokenIdentifier().getContainerType(); if (shouldUploadLogs(new ContainerLogContext( container.getContainerId(), containerType, 0))) {
RecoveredContainerState rcs) { ExecutionType execType = container.getContainerTokenIdentifier().getExecutionType(); if (rcs.getStatus() == RecoveredContainerStatus.QUEUED || rcs.getStatus() == RecoveredContainerStatus.PAUSED) {
private Container preReInitializeOrLocalizeCheck(ContainerId containerId, ReInitOp op) throws YarnException { UserGroupInformation remoteUgi = getRemoteUgi(); NMTokenIdentifier nmTokenIdentifier = selectNMTokenIdentifier(remoteUgi); authorizeUser(remoteUgi, nmTokenIdentifier); if (!nmTokenIdentifier.getApplicationAttemptId().getApplicationId() .equals(containerId.getApplicationAttemptId().getApplicationId())) { throw new YarnException("ApplicationMaster not authorized to perform " + "["+ op + "] on Container [" + containerId + "]!!"); } Container container = context.getContainers().get(containerId); if (container == null) { throw new YarnException("Specified " + containerId + " does not exist!"); } if (!container.isRunning() || container.isReInitializing() || container.getContainerTokenIdentifier().getExecutionType() == ExecutionType.OPPORTUNISTIC) { throw new YarnException("Cannot perform " + op + " on [" + containerId + "]. Current state is [" + container.getContainerState() + ", " + "isReInitializing=" + container.isReInitializing() + "]. Container" + " Execution Type is [" + container.getContainerTokenIdentifier() .getExecutionType() + "]."); } return container; }
event.getUser(), event.getContainer().getContainerId(), event.getContainer().getResource(), event.getContainer() .getContainerTokenIdentifier().getContainerType())); } catch (Throwable th) { logWarningWhenAuxServiceThrowExceptions(serv, event.getUser(), event.getContainer().getContainerId(), event.getContainer().getResource(), event.getContainer() .getContainerTokenIdentifier().getContainerType())); } catch (Throwable th) { logWarningWhenAuxServiceThrowExceptions(serv,
event.getContainer().getContainerId(), event.getContainer().getResource(), event.getContainer() .getContainerTokenIdentifier().getContainerType())); } catch (Throwable th) { logWarningWhenAuxServiceThrowExceptions(serv, event.getUser(), event.getContainer().getContainerId(), event.getContainer().getResource(), event.getContainer() .getContainerTokenIdentifier().getContainerType())); } catch (Throwable th) { logWarningWhenAuxServiceThrowExceptions(serv,
int currentVersion = container.getContainerTokenIdentifier().getVersion(); if (containerTokenIdentifier.getVersion() <= currentVersion) { throw RPCUtil.getRemoteException("Container " + containerId.toString() container.getContainerTokenIdentifier().getExecutionType(); boolean isResourceChange = false; boolean isExecTypeUpdate = false;
container.getContainerTokenIdentifier().getExecutionType().name(); this.containerLogsShortLink = ujoin("containerlogs", this.id, container.getUser());