org.apache.hadoop.yarn.api.records.ContainerId - java examples

Here are the examples of the java api org.apache.hadoop.yarn.api.records.ContainerId taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

155 Examples 7

19 View Complete Implementation : NMStateStoreService.java
Copyright Apache License 2.0
Author : apache
/**
 * Record that a container has been resumed at the NM by removing the
 * fact that it has be paused.
 * @param containerId the container ID.
 * @throws IOException IO Exception.
 */
public abstract void removeContainerPaused(ContainerId containerId) throws IOException;

19 View Complete Implementation : NMStateStoreService.java
Copyright Apache License 2.0
Author : apache
/**
 * Record that a container has completed
 * @param containerId the container ID
 * @param exitCode the exit code from the container
 * @throws IOException
 */
public abstract void storeContainerCompleted(ContainerId containerId, int exitCode) throws IOException;

19 View Complete Implementation : ContainerExpiredSchedulerEvent.java
Copyright Apache License 2.0
Author : apache
/**
 * The {@link SchedulerEvent} which notifies that a {@link ContainerId}
 * has expired, sent by {@link ContainerAllocationExpirer}
 */
public clreplaced ContainerExpiredSchedulerEvent extends SchedulerEvent {

    private final ContainerId containerId;

    private final boolean increase;

    public ContainerExpiredSchedulerEvent(ContainerId containerId) {
        this(containerId, false);
    }

    public ContainerExpiredSchedulerEvent(ContainerId containerId, boolean increase) {
        super(SchedulerEventType.CONTAINER_EXPIRED);
        this.containerId = containerId;
        this.increase = increase;
    }

    public ContainerId getContainerId() {
        return containerId;
    }

    public boolean isIncrease() {
        return increase;
    }
}

19 View Complete Implementation : ResourceLocalizationRequestPBImpl.java
Copyright Apache License 2.0
Author : apache
private YarnProtos.ContainerIdProto convertToProtoFormat(ContainerId t) {
    return ((ContainerIdPBImpl) t).getProto();
}

19 View Complete Implementation : NMAuditLogger.java
Copyright Apache License 2.0
Author : apache
/**
 * Create a readable and parseable audit log string for a failed event.
 *
 * @param user User who made the service request.
 * @param operation Operation requested by the user.
 * @param target The target on which the operation is being performed.
 * @param description Some additional information as to why the operation
 *                    failed.
 * @param appId ApplicationId in which operation was performed.
 * @param containerId Container Id in which operation was performed.
 *
 * <br><br>
 * Note that the {@link NMAuditLogger} uses tabs ('\t') as a key-val delimiter
 * and hence the value fields should not contains tabs ('\t').
 */
public static void logFailure(String user, String operation, String target, String description, ApplicationId appId, ContainerId containerId) {
    if (LOG.isWarnEnabled()) {
        LOG.warn(createFailureLog(user, operation, target, description, appId, containerId));
    }
}

19 View Complete Implementation : NMClientAsyncImpl.java
Copyright Apache License 2.0
Author : apache
@Override
public void commitLastReInitializationAsync(ContainerId containerId) {
    if (!(callbackHandler instanceof AbstractCallbackHandler)) {
        LOG.error("Callback handler does not implement container commit last " + "re-initialization callback methods");
        return;
    }
    AbstractCallbackHandler handler = (AbstractCallbackHandler) callbackHandler;
    if (containers.get(containerId) == null) {
        handler.onCommitLastReInitializationError(containerId, RPCUtil.getRemoteException("Container " + containerId + " is not started"));
    }
    try {
        events.put(new ContainerEvent(containerId, client.getNodeIdOfStartedContainer(containerId), null, ContainerEventType.COMMIT_LAST_REINT));
    } catch (InterruptedException e) {
        LOG.warn("Exception when scheduling the event Commit re-initialization" + " of Container " + containerId);
        handler.onCommitLastReInitializationError(containerId, e);
    }
}

19 View Complete Implementation : PreemptionContainerPBImpl.java
Copyright Apache License 2.0
Author : apache
private ContainerIdProto convertToProtoFormat(ContainerId t) {
    return ((ContainerIdPBImpl) t).getProto();
}

19 View Complete Implementation : StopContainersResponsePBImpl.java
Copyright Apache License 2.0
Author : apache
private ContainerIdProto convertToProtoFormat(ContainerId t) {
    return ((ContainerIdPBImpl) t).getProto();
}

19 View Complete Implementation : ProtoUtils.java
Copyright Apache License 2.0
Author : apache
public static ContainerIdProto convertToProtoFormat(ContainerId t) {
    return ((ContainerIdPBImpl) t).getProto();
}

19 View Complete Implementation : ContainersMonitorEvent.java
Copyright Apache License 2.0
Author : apache
public clreplaced ContainersMonitorEvent extends AbstractEvent<ContainersMonitorEventType> {

    private final ContainerId containerId;

    public ContainersMonitorEvent(ContainerId containerId, ContainersMonitorEventType eventType) {
        super(eventType);
        this.containerId = containerId;
    }

    public ContainerId getContainerId() {
        return this.containerId;
    }
}

19 View Complete Implementation : NMContainerStatusPBImpl.java
Copyright Apache License 2.0
Author : apache
private ContainerIdProto convertToProtoFormat(ContainerId t) {
    return ((ContainerIdPBImpl) t).getProto();
}

19 View Complete Implementation : AMRMClientAsyncImpl.java
Copyright Apache License 2.0
Author : apache
/**
 * Release containers replacedigned by the Resource Manager. If the app cannot use
 * the container or wants to give up the container then it can release them.
 * The app needs to make new requests for the released resource capability if
 * it still needs it. eg. it released non-local resources
 * @param containerId
 */
public void releasereplacedignedContainer(ContainerId containerId) {
    client.releasereplacedignedContainer(containerId);
}

19 View Complete Implementation : RMNodeCleanContainerEvent.java
Copyright Apache License 2.0
Author : apache
public clreplaced RMNodeCleanContainerEvent extends RMNodeEvent {

    private ContainerId contId;

    public RMNodeCleanContainerEvent(NodeId nodeId, ContainerId contId) {
        super(nodeId, RMNodeEventType.CLEANUP_CONTAINER);
        this.contId = contId;
    }

    public ContainerId getContainerId() {
        return this.contId;
    }
}

19 View Complete Implementation : NMStateStoreService.java
Copyright Apache License 2.0
Author : apache
/**
 * Record diagnostics for a container
 * @param containerId the container ID
 * @param diagnostics the container diagnostics
 * @throws IOException
 */
public abstract void storeContainerDiagnostics(ContainerId containerId, StringBuilder diagnostics) throws IOException;

19 View Complete Implementation : YarnClient.java
Copyright Apache License 2.0
Author : apache
/**
 * <p>
 * Get a report of the given Container.
 * </p>
 *
 * <p>
 * In secure mode, <code>YARN</code> verifies access to the application, queue
 * etc. before accepting the request.
 * </p>
 *
 * @param containerId
 *          {@link ContainerId} of the container that needs a report
 * @return container report
 * @throws YarnException
 * @throws ContainerNotFoundException if container not found.
 * @throws IOException
 */
public abstract ContainerReport getContainerReport(ContainerId containerId) throws YarnException, IOException;

19 View Complete Implementation : ContainerReportPBImpl.java
Copyright Apache License 2.0
Author : apache
private ContainerIdProto convertToProtoFormat(ContainerId t) {
    return ((ContainerIdPBImpl) t).getProto();
}

19 View Complete Implementation : ContainerEvent.java
Copyright Apache License 2.0
Author : apache
public clreplaced ContainerEvent extends AbstractEvent<ContainerEventType> {

    private final ContainerId containerID;

    public ContainerEvent(ContainerId cID, ContainerEventType eventType) {
        super(eventType, System.currentTimeMillis());
        this.containerID = cID;
    }

    public ContainerId getContainerID() {
        return containerID;
    }
}

19 View Complete Implementation : NMStateStoreService.java
Copyright Apache License 2.0
Author : apache
/**
 * Remove records corresponding to a container
 * @param containerId the container ID
 * @throws IOException
 */
public abstract void removeContainer(ContainerId containerId) throws IOException;

19 View Complete Implementation : ContainersMonitorImpl.java
Copyright Apache License 2.0
Author : apache
private void updateContainerMetrics(ContainersMonitorEvent monitoringEvent) {
    if (!containerMetricsEnabled || monitoringEvent == null) {
        return;
    }
    ContainerId containerId = monitoringEvent.getContainerId();
    ContainerMetrics usageMetrics;
    int vmemLimitMBs;
    int pmemLimitMBs;
    int cpuVcores;
    switch(monitoringEvent.getType()) {
        case START_MONITORING_CONTAINER:
            usageMetrics = ContainerMetrics.forContainer(containerId, containerMetricsPeriodMs, containerMetricsUnregisterDelayMs);
            ContainerStartMonitoringEvent startEvent = (ContainerStartMonitoringEvent) monitoringEvent;
            usageMetrics.recordStateChangeDurations(startEvent.getLaunchDuration(), startEvent.getLocalizationDuration());
            cpuVcores = startEvent.getCpuVcores();
            vmemLimitMBs = (int) (startEvent.getVmemLimit() >> 20);
            pmemLimitMBs = (int) (startEvent.getPmemLimit() >> 20);
            usageMetrics.recordResourceLimit(vmemLimitMBs, pmemLimitMBs, cpuVcores);
            break;
        case STOP_MONITORING_CONTAINER:
            ContainerStopMonitoringEvent stopEvent = (ContainerStopMonitoringEvent) monitoringEvent;
            usageMetrics = ContainerMetrics.getContainerMetrics(containerId);
            if (usageMetrics != null) {
                usageMetrics.finished(stopEvent.isForReInit());
            }
            break;
        case CHANGE_MONITORING_CONTAINER_RESOURCE:
            usageMetrics = ContainerMetrics.forContainer(containerId, containerMetricsPeriodMs, containerMetricsUnregisterDelayMs);
            ChangeMonitoringContainerResourceEvent changeEvent = (ChangeMonitoringContainerResourceEvent) monitoringEvent;
            Resource resource = changeEvent.getResource();
            pmemLimitMBs = (int) resource.getMemorySize();
            vmemLimitMBs = (int) (pmemLimitMBs * vmemRatio);
            cpuVcores = resource.getVirtualCores();
            usageMetrics.recordResourceLimit(vmemLimitMBs, pmemLimitMBs, cpuVcores);
            break;
        default:
            break;
    }
}

19 View Complete Implementation : NMClientAsync.java
Copyright Apache License 2.0
Author : apache
/**
 * <p>Restart the specified container.</p>
 *
 * @param containerId the Id of the container to restart.
 */
public abstract void restartContainerAsync(ContainerId containerId);

19 View Complete Implementation : YarnClient.java
Copyright Apache License 2.0
Author : apache
/**
 * <p>
 * Signal a container identified by given ID.
 * </p>
 *
 * @param containerId
 *          {@link ContainerId} of the container that needs to be signaled
 * @param command the signal container command
 * @throws YarnException
 * @throws IOException
 */
public abstract void signalToContainer(ContainerId containerId, SignalContainerCommand command) throws YarnException, IOException;

19 View Complete Implementation : NMClientAsyncImpl.java
Copyright Apache License 2.0
Author : apache
@Override
public void reInitializeContainerAsync(ContainerId containerId, ContainerLaunchContext containerLaunchContex, boolean autoCommit) {
    if (!(callbackHandler instanceof AbstractCallbackHandler)) {
        LOG.error("Callback handler does not implement container re-initialize " + "callback methods");
        return;
    }
    AbstractCallbackHandler handler = (AbstractCallbackHandler) callbackHandler;
    if (containers.get(containerId) == null) {
        handler.onContainerReInitializeError(containerId, RPCUtil.getRemoteException("Container " + containerId + " is not started"));
    }
    try {
        events.put(new ReInitializeContainerEvevnt(containerId, client.getNodeIdOfStartedContainer(containerId), containerLaunchContex, autoCommit));
    } catch (InterruptedException e) {
        LOG.warn("Exception when scheduling the event of re-initializing of " + "Container " + containerId);
        handler.onContainerReInitializeError(containerId, e);
    }
}

19 View Complete Implementation : TestNMClient.java
Copyright Apache License 2.0
Author : apache
private void testRestartContainer(ContainerId containerId) throws YarnException, IOException {
    try {
        sleep(250);
        nmClient.restartContainer(containerId);
        sleep(250);
    } catch (YarnException e) {
        // NM container will only be in SCHEDULED state, so expect the increase
        // action to fail.
        if (!e.getMessage().contains("can only be changed when a container is in RUNNING state")) {
            throw (replacedertionError) (new replacedertionError("Exception is not expected: " + e).initCause(e));
        }
    }
}

19 View Complete Implementation : ResourceReleaseEvent.java
Copyright Apache License 2.0
Author : apache
public clreplaced ResourceReleaseEvent extends ResourceEvent {

    private final ContainerId container;

    public ResourceReleaseEvent(LocalResourceRequest rsrc, ContainerId container) {
        super(rsrc, ResourceEventType.RELEASE);
        this.container = container;
    }

    public ContainerId getContainer() {
        return container;
    }
}

19 View Complete Implementation : TestNMClient.java
Copyright Apache License 2.0
Author : apache
private void testRollbackContainer(ContainerId containerId, boolean notRollbackable) throws YarnException, IOException {
    try {
        sleep(250);
        nmClient.rollbackLastReInitialization(containerId);
        if (notRollbackable) {
            fail("Should not be able to rollback..");
        }
        sleep(250);
    } catch (YarnException e) {
        // NM container will only be in SCHEDULED state, so expect the increase
        // action to fail.
        if (notRollbackable) {
            replacedert.replacedertTrue(e.getMessage().contains("Nothing to rollback to"));
        } else {
            if (!e.getMessage().contains("can only be changed when a container is in RUNNING state")) {
                throw (replacedertionError) (new replacedertionError("Exception is not expected: " + e).initCause(e));
            }
        }
    }
}

19 View Complete Implementation : ContainerLauncherImpl.java
Copyright Apache License 2.0
Author : apache
private Container getContainer(ContainerLauncherEvent event) {
    ContainerId id = event.getContainerID();
    Container c = containers.get(id);
    if (c == null) {
        c = new Container(event.getTaskAttemptID(), event.getContainerID(), event.getContainerMgrAddress());
        Container old = containers.putIfAbsent(id, c);
        if (old != null) {
            c = old;
        }
    }
    return c;
}

19 View Complete Implementation : TestNMClient.java
Copyright Apache License 2.0
Author : apache
private void testCommitContainer(ContainerId containerId, boolean notCommittable) throws YarnException, IOException {
    try {
        nmClient.commitLastReInitialization(containerId);
        if (notCommittable) {
            fail("Should not be able to commit..");
        }
    } catch (YarnException e) {
        // NM container will only be in SCHEDULED state, so expect the increase
        // action to fail.
        if (notCommittable) {
            replacedert.replacedertTrue(e.getMessage().contains("Nothing to Commit"));
        } else {
            if (!e.getMessage().contains("can only be changed when a container is in RUNNING state")) {
                throw (replacedertionError) (new replacedertionError("Exception is not expected: " + e).initCause(e));
            }
        }
    }
}

19 View Complete Implementation : AHSClient.java
Copyright Apache License 2.0
Author : apache
/**
 * <p>
 * Get a report of the given Container.
 * </p>
 *
 * <p>
 * In secure mode, <code>YARN</code> verifies access to the application, queue
 * etc. before accepting the request.
 * </p>
 *
 * @param containerId
 *          {@link ContainerId} of the container that needs a report
 * @return container report
 * @throws YarnException
 * @throws ContainerNotFoundException if container not found
 * @throws IOException
 */
public abstract ContainerReport getContainerReport(ContainerId containerId) throws YarnException, IOException;

19 View Complete Implementation : TestLogAggregationIndexedFileController.java
Copyright Apache License 2.0
Author : apache
private String logMessage(ContainerId containerId, String logType) {
    return "Hello " + containerId + " in " + logType + "!";
}

19 View Complete Implementation : NMClient.java
Copyright Apache License 2.0
Author : apache
/**
 * Get the NodeId of the node on which container is running. It returns
 * null if the container if container is not found or if it is not running.
 *
 * @param containerId Container Id of the container.
 * @return NodeId of the container on which it is running.
 */
public NodeId getNodeIdOfStartedContainer(ContainerId containerId) {
    return null;
}

19 View Complete Implementation : NMNullStateStoreService.java
Copyright Apache License 2.0
Author : apache
@Override
public void removeContainer(ContainerId containerId) throws IOException {
}

19 View Complete Implementation : RMContainerEvent.java
Copyright Apache License 2.0
Author : apache
public clreplaced RMContainerEvent extends AbstractEvent<RMContainerEventType> {

    private final ContainerId containerId;

    public RMContainerEvent(ContainerId containerId, RMContainerEventType type) {
        super(type);
        this.containerId = containerId;
    }

    public ContainerId getContainerId() {
        return this.containerId;
    }
}

19 View Complete Implementation : NMClient.java
Copyright Apache License 2.0
Author : apache
/**
 * <p>Restart the specified container.</p>
 *
 * @param containerId the Id of the container to restart.
 *
 * @throws YarnException YarnException.
 * @throws IOException IOException.
 */
public abstract void restartContainer(ContainerId containerId) throws YarnException, IOException;

19 View Complete Implementation : DefaultLCEResourcesHandler.java
Copyright Apache License 2.0
Author : apache
public String getResourcesOption(ContainerId containerId) {
    return "cgroups=none";
}

19 View Complete Implementation : NMNullStateStoreService.java
Copyright Apache License 2.0
Author : apache
@Override
public void removeContainerToken(ContainerId containerId) throws IOException {
}

19 View Complete Implementation : NMClientAsyncImpl.java
Copyright Apache License 2.0
Author : apache
@Override
public void restartContainerAsync(ContainerId containerId) {
    if (!(callbackHandler instanceof AbstractCallbackHandler)) {
        LOG.error("Callback handler does not implement container restart " + "callback methods");
        return;
    }
    AbstractCallbackHandler handler = (AbstractCallbackHandler) callbackHandler;
    if (containers.get(containerId) == null) {
        handler.onContainerRestartError(containerId, RPCUtil.getRemoteException("Container " + containerId + " is not started"));
    }
    try {
        events.put(new ContainerEvent(containerId, client.getNodeIdOfStartedContainer(containerId), null, ContainerEventType.RESTART_CONTAINER));
    } catch (InterruptedException e) {
        LOG.warn("Exception when scheduling the event of restart of " + "Container " + containerId);
        handler.onContainerRestartError(containerId, e);
    }
}

19 View Complete Implementation : ContainerMetrics.java
Copyright Apache License 2.0
Author : apache
public synchronized static ContainerMetrics getContainerMetrics(ContainerId containerId) {
    // could be null
    return usageMetrics.get(containerId);
}

19 View Complete Implementation : NMStateStoreService.java
Copyright Apache License 2.0
Author : apache
/**
 * Record that a container has been paused at the NM.
 * @param containerId the container ID.
 * @throws IOException IO Exception.
 */
public abstract void storeContainerPaused(ContainerId containerId) throws IOException;

19 View Complete Implementation : WebServices.java
Copyright Apache License 2.0
Author : apache
protected static ContainerId parseContainerId(String containerId) {
    if (containerId == null || containerId.isEmpty()) {
        throw new NotFoundException("containerId, " + containerId + ", is empty or null");
    }
    ContainerId cid = null;
    try {
        cid = ContainerId.fromString(containerId);
    } catch (Exception e) {
        throw new BadRequestException(e);
    }
    if (cid == null) {
        throw new NotFoundException("containerId is null");
    }
    return cid;
}

19 View Complete Implementation : NetworkPacketTaggingHandlerImpl.java
Copyright Apache License 2.0
Author : apache
/**
 * Reacquires state for a container - reads the clreplacedid from the cgroup
 * being used for the container being reacquired.
 * @param containerId if of the container being reacquired.
 * @return (potentially empty) list of privileged operations
 * @throws ResourceHandlerException
 */
@Override
public List<PrivilegedOperation> reacquireContainer(ContainerId containerId) throws ResourceHandlerException {
    return null;
}

19 View Complete Implementation : NMClientAsyncImpl.java
Copyright Apache License 2.0
Author : apache
@Override
public void rollbackLastReInitializationAsync(ContainerId containerId) {
    if (!(callbackHandler instanceof AbstractCallbackHandler)) {
        LOG.error("Callback handler does not implement container rollback " + "callback methods");
        return;
    }
    AbstractCallbackHandler handler = (AbstractCallbackHandler) callbackHandler;
    if (containers.get(containerId) == null) {
        handler.onRollbackLastReInitializationError(containerId, RPCUtil.getRemoteException("Container " + containerId + " is not started"));
    }
    try {
        events.put(new ContainerEvent(containerId, client.getNodeIdOfStartedContainer(containerId), null, ContainerEventType.ROLLBACK_LAST_REINIT));
    } catch (InterruptedException e) {
        LOG.warn("Exception when scheduling the event Rollback re-initialization" + " of Container " + containerId);
        handler.onRollbackLastReInitializationError(containerId, e);
    }
}

18 View Complete Implementation : LogHandlerContainerFinishedEvent.java
Copyright Apache License 2.0
Author : apache
public clreplaced LogHandlerContainerFinishedEvent extends LogHandlerEvent {

    private final ContainerId containerId;

    private final ContainerType containerType;

    private final int exitCode;

    public LogHandlerContainerFinishedEvent(ContainerId containerId, ContainerType containerType, int exitCode) {
        super(LogHandlerEventType.CONTAINER_FINISHED);
        this.containerId = containerId;
        this.containerType = containerType;
        this.exitCode = exitCode;
    }

    public ContainerId getContainerId() {
        return this.containerId;
    }

    public ContainerType getContainerType() {
        return containerType;
    }

    public int getExitCode() {
        return this.exitCode;
    }
}

18 View Complete Implementation : LocalizerContext.java
Copyright Apache License 2.0
Author : apache
public clreplaced LocalizerContext {

    private final String user;

    private final ContainerId containerId;

    private final Credentials credentials;

    private final LoadingCache<Path, Future<FileStatus>> statCache;

    public LocalizerContext(String user, ContainerId containerId, Credentials credentials) {
        this(user, containerId, credentials, null);
    }

    public LocalizerContext(String user, ContainerId containerId, Credentials credentials, LoadingCache<Path, Future<FileStatus>> statCache) {
        this.user = user;
        this.containerId = containerId;
        this.credentials = credentials;
        this.statCache = statCache;
    }

    public String getUser() {
        return user;
    }

    public ContainerId getContainerId() {
        return containerId;
    }

    public Credentials getCredentials() {
        return credentials;
    }

    public LoadingCache<Path, Future<FileStatus>> getStatCache() {
        return statCache;
    }
}

18 View Complete Implementation : ContainerManagementProtocolProxy.java
Copyright Apache License 2.0
Author : apache
public synchronized ContainerManagementProtocolProxyData getProxy(String containerManagerBindAddr, ContainerId containerId) throws InvalidToken {
    // This get call will update the map which is working as LRU cache.
    ContainerManagementProtocolProxyData proxy = cmProxy.get(containerManagerBindAddr);
    while (proxy != null && !proxy.token.getIdentifier().equals(nmTokenCache.getToken(containerManagerBindAddr).getIdentifier())) {
        LOG.debug("Refreshing proxy as NMToken got updated for node : {}", containerManagerBindAddr);
        // Token is updated. check if anyone has already tried closing it.
        if (!proxy.scheduledForClose) {
            // try closing the proxy. Here if someone is already using it
            // then we might not close it. In which case we will wait.
            removeProxy(proxy);
        } else {
            try {
                this.wait();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        if (proxy.activeCallers < 0) {
            proxy = cmProxy.get(containerManagerBindAddr);
        }
    }
    if (proxy == null) {
        proxy = new ContainerManagementProtocolProxyData(rpc, containerManagerBindAddr, containerId, nmTokenCache.getToken(containerManagerBindAddr));
        if (maxConnectedNMs > 0) {
            addProxyToCache(containerManagerBindAddr, proxy);
        }
    }
    // This is to track active users of this proxy.
    proxy.activeCallers++;
    updateLRUCache(containerManagerBindAddr);
    return proxy;
}

18 View Complete Implementation : SchedulerUtils.java
Copyright Apache License 2.0
Author : apache
/**
 * Utility to create a {@link ContainerStatus} during exceptional
 * cirreplacedstances.
 *
 * @param containerId {@link ContainerId} of returned/released/lost container.
 * @param diagnostics diagnostic message
 * @return <code>ContainerStatus</code> for an returned/released/lost
 *         container
 */
public static ContainerStatus createPreemptedContainerStatus(ContainerId containerId, String diagnostics) {
    return createAbnormalContainerStatus(containerId, ContainerExitStatus.PREEMPTED, diagnostics);
}

18 View Complete Implementation : MockRM.java
Copyright Apache License 2.0
Author : apache
/**
 * Wait until a container has reached a specified state.
 * The timeout is 10 seconds.
 * @param nms array of mock nodemanagers
 * @param containerId the id of a container
 * @param containerState the container state waited
 * @return if reach the state before timeout; false otherwise.
 * @throws Exception
 *         if interrupted while waiting for the state transition
 *         or an unexpected error while MockNM is hearbeating.
 */
public boolean waitForState(Collection<MockNM> nms, ContainerId containerId, RMContainerState containerState) throws Exception {
    return waitForState(nms, containerId, containerState, TIMEOUT_MS_FOR_CONTAINER_AND_NODE);
}

18 View Complete Implementation : NumaResourceAllocator.java
Copyright Apache License 2.0
Author : apache
/**
 * Release replacedigned NUMA resources for the container.
 *
 * @param containerId the container ID
 */
public synchronized void releaseNumaResource(ContainerId containerId) {
    LOG.info("Releasing the replacedigned NUMA resources for " + containerId);
    for (NumaNodeResource numaNode : numaNodesList) {
        numaNode.releaseResources(containerId);
    }
}

18 View Complete Implementation : MockRM.java
Copyright Apache License 2.0
Author : apache
/**
 * Wait until a container has reached a specified state.
 * The timeout is 10 seconds.
 * @param nm A mock nodemanager
 * @param containerId the id of a container
 * @param containerState the container state waited
 * @return if reach the state before timeout; false otherwise.
 * @throws Exception
 *         if interrupted while waiting for the state transition
 *         or an unexpected error while MockNM is hearbeating.
 */
public boolean waitForState(MockNM nm, ContainerId containerId, RMContainerState containerState) throws Exception {
    return waitForState(nm, containerId, containerState, TIMEOUT_MS_FOR_CONTAINER_AND_NODE);
}

18 View Complete Implementation : LogAggregationWebUtils.java
Copyright Apache License 2.0
Author : apache
/**
 * Verify and parse containerId.
 * @param html the html
 * @param containerIdStr the containerId string
 * @return the {@link ContainerId}
 */
public static ContainerId verifyAndGetContainerId(Block html, String containerIdStr) {
    if (containerIdStr == null || containerIdStr.isEmpty()) {
        html.h1().__("Cannot get container logs without a ContainerId").__();
        return null;
    }
    ContainerId containerId = null;
    try {
        containerId = ContainerId.fromString(containerIdStr);
    } catch (IllegalArgumentException e) {
        html.h1().__("Cannot get container logs for invalid containerId: " + containerIdStr).__();
        return null;
    }
    return containerId;
}

18 View Complete Implementation : ComponentInstanceEvent.java
Copyright Apache License 2.0
Author : apache
public clreplaced ComponentInstanceEvent extends AbstractEvent<ComponentInstanceEventType> {

    private ContainerId id;

    private ContainerStatus status;

    private boolean shouldDestroy = false;

    public ComponentInstanceEvent(ContainerId containerId, ComponentInstanceEventType componentInstanceEventType) {
        super(componentInstanceEventType);
        Preconditions.checkNotNull(containerId);
        this.id = containerId;
    }

    public ContainerId getContainerId() {
        return id;
    }

    public ContainerStatus getStatus() {
        return this.status;
    }

    public ComponentInstanceEvent setStatus(ContainerStatus status) {
        this.status = status;
        return this;
    }

    public void setShouldDestroy() {
        shouldDestroy = true;
    }

    public boolean shouldDestroy() {
        return shouldDestroy;
    }
}