Search in sources :

Example 1 with YarnAppBootstrap

use of com.sequenceiq.cloudbreak.orchestrator.yarn.poller.YarnAppBootstrap in project cloudbreak by hortonworks.

the class YarnContainerOrchestrator method runContainer.

@Override
public List<ContainerInfo> runContainer(ContainerConfig config, OrchestrationCredential cred, ContainerConstraint constraint, ExitCriteriaModel exitCriteriaModel) throws CloudbreakOrchestratorException {
    // Create an application per component
    List<ContainerInfo> containerInfos = new ArrayList<>();
    for (int componentNumber = 1; componentNumber <= constraint.getInstances(); componentNumber++) {
        try {
            submitHandler.submitApplication(config, cred, constraint, componentNumber);
            String applicationName = applicationUtils.getApplicationName(constraint, componentNumber);
            OrchestratorBootstrap bootstrap = new YarnAppBootstrap(applicationName, cred.getApiEndpoint());
            Callable<Boolean> runner = runner(bootstrap, getExitCriteria(), exitCriteriaModel);
            Future<Boolean> appFuture = getParallelOrchestratorComponentRunner().submit(runner);
            appFuture.get();
            containerInfos.add(detailHandler.getContainerInfo(config, cred, constraint, componentNumber));
        } catch (CloudbreakOrchestratorException | InterruptedException | ExecutionException e) {
            throw new CloudbreakOrchestratorFailedException(e);
        }
    }
    return containerInfos;
}
Also used : OrchestratorBootstrap(com.sequenceiq.cloudbreak.orchestrator.OrchestratorBootstrap) ArrayList(java.util.ArrayList) ContainerConstraint(com.sequenceiq.cloudbreak.orchestrator.model.ContainerConstraint) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) ContainerInfo(com.sequenceiq.cloudbreak.orchestrator.model.ContainerInfo) ExecutionException(java.util.concurrent.ExecutionException) YarnAppBootstrap(com.sequenceiq.cloudbreak.orchestrator.yarn.poller.YarnAppBootstrap)

Aggregations

OrchestratorBootstrap (com.sequenceiq.cloudbreak.orchestrator.OrchestratorBootstrap)1 CloudbreakOrchestratorException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException)1 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)1 ContainerConstraint (com.sequenceiq.cloudbreak.orchestrator.model.ContainerConstraint)1 ContainerInfo (com.sequenceiq.cloudbreak.orchestrator.model.ContainerInfo)1 YarnAppBootstrap (com.sequenceiq.cloudbreak.orchestrator.yarn.poller.YarnAppBootstrap)1 ArrayList (java.util.ArrayList)1 ExecutionException (java.util.concurrent.ExecutionException)1