use of com.cloudera.api.swagger.CommandsResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerTemplateInstallationChecker method doStatusCheck.
@Override
protected boolean doStatusCheck(ClouderaManagerCommandPollerObject pollerObject) throws ApiException {
CommandsResourceApi commandsResourceApi = clouderaManagerApiPojoFactory.getCommandsResourceApi(pollerObject.getApiClient());
ApiCommand apiCommand = commandsResourceApi.readCommand(pollerObject.getId());
if (apiCommand.getActive()) {
LOGGER.debug("Command [" + getCommandName() + "] with id [" + pollerObject.getId() + "] is active, so it hasn't finished yet");
return false;
} else if (apiCommand.getSuccess()) {
return true;
} else {
fail("", apiCommand, commandsResourceApi, pollerObject.getStack().getType());
}
return false;
}
use of com.cloudera.api.swagger.CommandsResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerTemplateInstallationChecker method handleTimeout.
@Override
public void handleTimeout(ClouderaManagerCommandPollerObject pollerObject) {
String msg = "Installation of CDP with Cloudera Manager has timed out (command id: " + pollerObject.getId() + ").";
try {
CommandsResourceApi commandsResourceApi = clouderaManagerApiPojoFactory.getCommandsResourceApi(pollerObject.getApiClient());
ApiCommand apiCommand = commandsResourceApi.readCommand(pollerObject.getId());
fail(msg, apiCommand, commandsResourceApi, pollerObject.getStack().getType());
} catch (ApiException e) {
LOGGER.info("Cloudera Manager had run into a timeout, and we were unable to determine the failure reason", e);
}
throw new ClouderaManagerOperationFailedException(msg);
}
use of com.cloudera.api.swagger.CommandsResourceApi in project cloudbreak by hortonworks.
the class AbstractClouderaManagerCommandCheckerTask method doStatusCheck.
protected boolean doStatusCheck(T pollerObject) throws ApiException {
CommandsResourceApi commandsResourceApi = clouderaManagerApiPojoFactory.getCommandsResourceApi(pollerObject.getApiClient());
ApiCommand apiCommand = commandsResourceApi.readCommand(pollerObject.getId());
if (apiCommand.getActive()) {
LOGGER.debug("Command [{}] with id [{}] is active, so it hasn't finished yet", getCommandName(), pollerObject.getId());
return false;
} else if (apiCommand.getSuccess()) {
return true;
} else {
List<CommandDetails> commandDetails = ClouderaManagerCommandUtil.getFailedOrActiveCommands(apiCommand, commandsResourceApi);
String message = CommandDetailsFormatter.formatFailedCommands(commandDetails);
LOGGER.debug("Top level command {}. Failed or active commands: {}", CommandDetails.fromApiCommand(apiCommand), commandDetails);
throw new ClouderaManagerOperationFailedException(message);
}
}
use of com.cloudera.api.swagger.CommandsResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerDecomissioner method abortDecommissionWithWarningMessage.
private void abortDecommissionWithWarningMessage(ApiCommand apiCommand, ApiClient client, String warningMessage) throws ApiException {
LOGGER.warn(warningMessage, apiCommand.getId());
CommandsResourceApi commandsResourceApi = clouderaManagerApiFactory.getCommandsResourceApi(client);
commandsResourceApi.abortCommand(apiCommand.getId());
}
use of com.cloudera.api.swagger.CommandsResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerCommandsService method getApiCommand.
public ApiCommand getApiCommand(ApiClient client, BigDecimal commandId) throws ApiException {
CommandsResourceApi commandsResourceApi = clouderaManagerApiFactory.getCommandsResourceApi(client);
ApiCommand apiCommand = commandsResourceApi.readCommand(commandId);
LOGGER.debug("Get Api command by id {} result is {}", commandId, apiCommand);
return apiCommand;
}
Aggregations