Example usage for org.apache.hadoop.yarn.api.records.impl.pb ContainerStatusPBImpl ContainerStatusPBImpl

List of usage examples for org.apache.hadoop.yarn.api.records.impl.pb ContainerStatusPBImpl ContainerStatusPBImpl

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.api.records.impl.pb ContainerStatusPBImpl ContainerStatusPBImpl.

Prototype

public ContainerStatusPBImpl() 

Source Link

Usage

From source file:org.apache.myriad.scheduler.fgs.NMHeartBeatHandlerTest.java

License:Apache License

private ContainerStatus getContainerStatus(RMNode node) {
    ContainerStatus status = new ContainerStatusPBImpl();
    return status;
}

From source file:org.apache.myriad.TestObjectFactory.java

License:Apache License

private static ContainerStatus getContainerStatus(RMNode node) {
    ContainerStatus status = new ContainerStatusPBImpl();
    return status;
}

From source file:oz.hadoop.yarn.api.core.ApplicationContainerLauncherEmulatorImpl.java

License:Apache License

/**
 * /*from ww  w.j av a  2 s  . c o  m*/
 */
@Override
void containerAllocated(final Container allocatedContainer) {
    final ApplicationContainer applicationContainer = applicationContainers.get(allocatedContainer);
    if (logger.isDebugEnabled()) {
        logger.debug("Container allocated");
    }
    final AtomicBoolean errorFlag = new AtomicBoolean();
    this.executor.execute(new Runnable() {
        @Override
        public void run() {
            ContainerStatus containerStatus = new ContainerStatusPBImpl();
            try {
                applicationContainer.launch();
                logger.info("Container finished");
                // TODO implement a better mock so it can show ContainerRequest values

                containerStatus.setExitStatus(0);
                //               rmCallbackHandler.onContainersCompleted(Collections.singletonList(containerStatus));
            } catch (Exception e) {
                logger.error("Application Container failed. ", e);
                //               rmCallbackHandler.onError(e);
                containerStatus.setExitStatus(0);
                errorFlag.set(true);
            } finally {
                rmCallbackHandler.onContainersCompleted(Collections.singletonList(containerStatus));
            }
        }
    });

    this.executor.execute(new Runnable() {
        @Override
        public void run() {
            try {
                //               Field clientField = ReflectionUtils.getFieldAndMakeAccessible(ApplicationContainer.class, "client");
                //               while (clientField.get(applicationContainer) == null && !errorFlag.get()){
                //                  LockSupport.parkNanos(1000000);
                //               }
                awaitApplicationContainerStart(applicationContainer, errorFlag);
                if (!errorFlag.get()) {
                    nmCallbackHandler.onContainerStarted(allocatedContainer.getId(), null);
                    if (logger.isDebugEnabled()) {
                        logger.debug("Container started");
                    }
                }
            } catch (Exception e) {
                logger.error("Should never heppen. Must be a bug. Please report", e);
                e.printStackTrace();
            }
        }
    });
}