Search in sources :

Example 1 with DeleteApplicationRequest

use of com.sequenceiq.cloudbreak.orchestrator.yarn.model.request.DeleteApplicationRequest in project cloudbreak by hortonworks.

the class YarnContainerOrchestrator method deleteContainer.

@Override
public void deleteContainer(List<ContainerInfo> containerInfo, OrchestrationCredential cred) throws CloudbreakOrchestratorException {
    for (ContainerInfo container : containerInfo) {
        DeleteApplicationRequest deleteApplicationRequest = new DeleteApplicationRequest();
        deleteApplicationRequest.setName(container.getName());
        YarnClient yarnHttpClient = new YarnHttpClient(cred.getApiEndpoint());
        try {
            yarnHttpClient.deleteApplication(deleteApplicationRequest);
        } catch (Exception e) {
            throw new CloudbreakOrchestratorFailedException(e.getMessage(), e);
        }
    }
}
Also used : YarnHttpClient(com.sequenceiq.cloudbreak.orchestrator.yarn.client.YarnHttpClient) CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) ContainerInfo(com.sequenceiq.cloudbreak.orchestrator.model.ContainerInfo) DeleteApplicationRequest(com.sequenceiq.cloudbreak.orchestrator.yarn.model.request.DeleteApplicationRequest) YarnClient(com.sequenceiq.cloudbreak.orchestrator.yarn.client.YarnClient) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) ExecutionException(java.util.concurrent.ExecutionException) CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)

Aggregations

CloudbreakOrchestratorException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException)1 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)1 ContainerInfo (com.sequenceiq.cloudbreak.orchestrator.model.ContainerInfo)1 YarnClient (com.sequenceiq.cloudbreak.orchestrator.yarn.client.YarnClient)1 YarnHttpClient (com.sequenceiq.cloudbreak.orchestrator.yarn.client.YarnHttpClient)1 DeleteApplicationRequest (com.sequenceiq.cloudbreak.orchestrator.yarn.model.request.DeleteApplicationRequest)1 ExecutionException (java.util.concurrent.ExecutionException)1