Examples of ApiCommand


Examples of com.cloudera.api.model.ApiCommand

*/
public class FakeCommandsResource implements CommandsResource {
   @Override
   public ApiCommand readCommand(long l) {
      System.out.println("calling " + this.getClass().getInterfaces()[0].getName() + "#" + Thread.currentThread().getStackTrace()[1].getMethodName());
      ApiCommand command = new ApiCommand();
      command.setEndTime(new Date());
      command.setId(l);
      command.setSuccess(true);
      return command;
   }
View Full Code Here

Examples of com.cloudera.api.model.ApiCommand

         // Install CM agents. TODO: show steps msg
         StatusPoller hostInstallPoller = null;
         try {

            final ApiCommand cmd =  apiResourceRootV6.getClouderaManagerResource().hostInstallCommand(apiHostInstallArguments);
            logger.info("install command id: " + cmd.getId());

            hostInstallPoller = new HostInstallPoller(apiResourceRootV6, cmd.getId(), cluster.getCurrentReport(), reportQueue,
                  ProgressSplit.INSTALL_HOSTS_AGENT.getProgress(), addedNodes, domain, cmUsername, cmPassword);
            executeAndReport("Installing Host Agents", addedNodes, cmd, ProgressSplit.INSTALL_HOSTS_AGENT.getProgress(),
                  cluster.getCurrentReport(), reportQueue, hostInstallPoller, true);
         } catch (Exception e) {
            logger.info(e.getMessage());
View Full Code Here

Examples of com.cloudera.api.model.ApiCommand

      throw ClouderaManagerException.FAIL_FETCH_CM_SERVER_HOST_ID();
   }

   private ApiCommand execute(final ApiBulkCommandList bulkCommand, boolean checkReturn) throws Exception {
      ApiCommand lastCommand = null;
      for (ApiCommand command : bulkCommand) {
         lastCommand = execute(command, checkReturn);
      }
      return lastCommand;
   }
View Full Code Here

Examples of com.cloudera.api.model.ApiCommand

   }

   private ApiCommand executeAndReport(String action, List<String> addedNodes, final ApiBulkCommandList bulkCommand,
         int endProgress, ClusterReport currentReport, ClusterReportQueue reportQueue, boolean checkReturn)
               throws Exception {
      ApiCommand lastCommand = null;
      for (ApiCommand command : bulkCommand) {
         lastCommand = executeAndReport(action, addedNodes, command, endProgress, currentReport, reportQueue, checkReturn);
      }
      return lastCommand;
   }
View Full Code Here

Examples of com.cloudera.api.model.ApiCommand

            currentReport.setClusterAndNodesServiceStatus(ServiceStatus.PROVISIONING);
         }
         reportQueue.addClusterReport(currentReport.clone());
      }

      ApiCommand commandReturn = null;
      poller.waitForComplete();

      if (checkReturn && command != null
            && !(commandReturn = apiResourceRootV6.getCommandsResource().readCommand(command.getId())).getSuccess()) {
         logger.info("Failed to run command: " + command);
         String errorMsg = getSummaryErrorMsg(command, domain);
         logger.error(errorMsg);
         String hostId = (commandReturn.getHostRef() == null) ? null : commandReturn.getHostRef().getHostId();
         throw CommandExecFailException.EXECUTE_COMMAND_FAIL(hostId, errorMsg);
      }

      if (endProgress != INVALID_PROGRESS) {
         if (currentReport.getProgress() < endProgress) {
View Full Code Here

Examples of com.cloudera.api.model.ApiCommand

      return commandReturn;
   }

   private String getSummaryErrorMsg(ApiCommand command, String domain) {
      ApiCommand newCommand = apiResourceRootV6.getCommandsResource().readCommand(command.getId());
      StringBuilder errorMsg = new StringBuilder(newCommand.getResultMessage());
      if (errorMsg.length() > 0) {
         errorMsg.append(". ");
      }
      if (newCommand.getResultDataUrl() != null) {
         errorMsg = errorMsg.append(referCmfUrlMsg(newCommand.getResultDataUrl()));
      } else {
         errorMsg = errorMsg.append(referCmfUrlMsg(domain + "/cmf/command/" + newCommand.getId() + "/details"));
      }
      return errorMsg.toString();
   }
View Full Code Here

Examples of com.cloudera.api.model.ApiCommand

   public void testGetSummaryErrorMsg() {
      Method method = null;
      try {
         method = ClouderaManagerImpl.class.getDeclaredMethod("getSummaryErrorMsg", ApiCommand.class, String.class);
         method.setAccessible(true);
         ApiCommand apiCommand = new ApiCommand();
         apiCommand.setId(new Long(1));
         CommandsResource fakeCommandResource = new CommandsResource() {
            @Override
            public ApiCommand readCommand(long commandId) {
               ApiCommand command = new ApiCommand();
               command.setId(new Long(1));
               command.setResultMessage("TestGetSummaryErrorMsg");
               return command;
            }
            @Override
            public ApiCommand abortCommand(long commandId) {
               return null;
View Full Code Here

Examples of com.cloudera.api.model.ApiCommand

   @Override
   public ApiBulkCommandList hdfsBootstrapStandByCommand(ApiRoleNameList strings) {
      System.out.println("calling " + this.getClass().getInterfaces()[0].getName() + "#" + Thread.currentThread().getStackTrace()[1].getMethodName());
      ApiBulkCommandList commands = new ApiBulkCommandList();
      ApiCommand command = new ApiCommand();
      command.setName("bootstrap standby namenode");
      command.setId(1L);
      commands.add(command);
      return commands;
   }
View Full Code Here

Examples of com.cloudera.api.model.ApiCommand

   @Override
   public ApiBulkCommandList formatCommand(ApiRoleNameList strings) {
      System.out.println("calling " + this.getClass().getInterfaces()[0].getName() + "#" + Thread.currentThread().getStackTrace()[1].getMethodName());
      ApiBulkCommandList commands = new ApiBulkCommandList();
      ApiCommand command = new ApiCommand();
      command.setName("format namenode");
      command.setId(1L);
      commands.add(command);
      return commands;
   }
View Full Code Here

Examples of com.cloudera.api.model.ApiCommand

   @Override
   public ApiBulkCommandList hdfsInitializeAutoFailoverCommand(ApiRoleNameList strings) {
      System.out.println("calling " + this.getClass().getInterfaces()[0].getName() + "#" + Thread.currentThread().getStackTrace()[1].getMethodName());
      ApiBulkCommandList commands = new ApiBulkCommandList();
      ApiCommand command = new ApiCommand();
      command.setName("init auto failover");
      command.setId(1L);
      commands.add(command);
      return commands;
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.