test_class.file: inductor/src/test/java/com/oneops/inductor/ProcessRunnerTest.java
test_class.identifier: ProcessRunnerTest
test_case.body: @Test
  	public void testExecuteProcessRetry() {
  		Config c = new Config();
  		c.setChefTimeout(10);
  		ProcessRunner pr = new ProcessRunner(c);
  		String[] cmd = new String[2];
  		cmd[0] = "echo";
  		cmd[1] = "\"hey there \"";
  		ProcessResult procResult = pr.executeProcessRetry(cmd, "", 3);
  		assertTrue(procResult.getResultCode() == 0);
  	}
test_case.class_method_signature: ProcessRunnerTest.testExecuteProcessRetry()
test_case.full_signature: @Test public void testExecuteProcessRetry()
test_case.identifier: testExecuteProcessRetry
test_case.invocations: setChefTimeout executeProcessRetry assertTrue getResultCode
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testExecuteProcessRetry()
focal_class.declarator: logger = Logger.getLogger(ProcessRunner.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = Logger.getLogger(ProcessRunner.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: LOCAL_CMDS = Arrays.asList("chef-solo", "kitchen")
focal_class.modifier: private static final
focal_class.original_string: private static final List<String> LOCAL_CMDS = Arrays.asList("chef-solo", "kitchen");
focal_class.type: List<String>
focal_class.var_name: LOCAL_CMDS
focal_class.declarator: timeoutInSeconds = 7200
focal_class.modifier: private
focal_class.original_string: private int timeoutInSeconds = 7200;
focal_class.type: int
focal_class.var_name: timeoutInSeconds
focal_class.declarator: config
focal_class.modifier: private
focal_class.original_string: private Config config;
focal_class.type: Config
focal_class.var_name: config
focal_class.file: inductor/src/main/java/com/oneops/inductor/ProcessRunner.java
focal_class.identifier: ProcessRunner
focal_class.class_method_signature: ProcessRunner.ProcessRunner(Config config)
focal_class.full_signature:   ProcessRunner(Config config)
focal_class.identifier: ProcessRunner
focal_class.parameters: (Config config)
focal_class.signature:  ProcessRunner(Config config)
focal_class.class_method_signature: ProcessRunner.getTimeoutInSeconds()
focal_class.full_signature: public int getTimeoutInSeconds()
focal_class.identifier: getTimeoutInSeconds
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getTimeoutInSeconds()
focal_class.class_method_signature: ProcessRunner.setTimeoutInSeconds(int timeoutInSeconds)
focal_class.full_signature: public void setTimeoutInSeconds(int timeoutInSeconds)
focal_class.identifier: setTimeoutInSeconds
focal_class.modifiers: public
focal_class.parameters: (int timeoutInSeconds)
focal_class.return: void
focal_class.signature: void setTimeoutInSeconds(int timeoutInSeconds)
focal_class.class_method_signature: ProcessRunner.executeProcessRetry(ExecutionContext executionContext)
focal_class.full_signature: public ProcessResult executeProcessRetry(ExecutionContext executionContext)
focal_class.identifier: executeProcessRetry
focal_class.modifiers: public
focal_class.parameters: (ExecutionContext executionContext)
focal_class.return: ProcessResult
focal_class.signature: ProcessResult executeProcessRetry(ExecutionContext executionContext)
focal_class.class_method_signature: ProcessRunner.executeProcessRetry(String[] cmd, String logKey, int max_retries)
focal_class.full_signature: public ProcessResult executeProcessRetry(String[] cmd, String logKey, int max_retries)
focal_class.identifier: executeProcessRetry
focal_class.modifiers: public
focal_class.parameters: (String[] cmd, String logKey, int max_retries)
focal_class.return: ProcessResult
focal_class.signature: ProcessResult executeProcessRetry(String[] cmd, String logKey, int max_retries)
focal_class.class_method_signature: ProcessRunner.executeProcessRetry(String[] cmd, String logKey)
focal_class.full_signature: public ProcessResult executeProcessRetry(String[] cmd, String logKey)
focal_class.identifier: executeProcessRetry
focal_class.modifiers: public
focal_class.parameters: (String[] cmd, String logKey)
focal_class.return: ProcessResult
focal_class.signature: ProcessResult executeProcessRetry(String[] cmd, String logKey)
focal_class.class_method_signature: ProcessRunner.executeProcessRetry(String[] cmd, String logKey, int max_retries,
        String ip_attribute)
focal_class.full_signature: public ProcessResult executeProcessRetry(String[] cmd, String logKey, int max_retries,
        String ip_attribute)
focal_class.identifier: executeProcessRetry
focal_class.modifiers: public
focal_class.parameters: (String[] cmd, String logKey, int max_retries,
        String ip_attribute)
focal_class.return: ProcessResult
focal_class.signature: ProcessResult executeProcessRetry(String[] cmd, String logKey, int max_retries,
        String ip_attribute)
focal_class.class_method_signature: ProcessRunner.executeProcess(String[] cmd, String logKey, ProcessResult result,
        Map<String, String> additionalEnvVars, File workingDir)
focal_class.full_signature: public void executeProcess(String[] cmd, String logKey, ProcessResult result,
        Map<String, String> additionalEnvVars, File workingDir)
focal_class.identifier: executeProcess
focal_class.modifiers: public
focal_class.parameters: (String[] cmd, String logKey, ProcessResult result,
        Map<String, String> additionalEnvVars, File workingDir)
focal_class.return: void
focal_class.signature: void executeProcess(String[] cmd, String logKey, ProcessResult result,
        Map<String, String> additionalEnvVars, File workingDir)
focal_class.class_method_signature: ProcessRunner.getEnvVars(String[] cmd, Map<String, String> extraVars)
focal_class.full_signature: public Map<String, String> getEnvVars(String[] cmd, Map<String, String> extraVars)
focal_class.identifier: getEnvVars
focal_class.modifiers: public
focal_class.parameters: (String[] cmd, Map<String, String> extraVars)
focal_class.return: Map<String, String>
focal_class.signature: Map<String, String> getEnvVars(String[] cmd, Map<String, String> extraVars)
focal_method.body: public ProcessResult executeProcessRetry(ExecutionContext executionContext) {
      boolean shutdown = config.hasCloudShutdownFor(executionContext.getWo());
      int maxRetries = executionContext.getRetryCount();
      if (shutdown) {
        // If the cloud is already shutdown, set max retry count to 0.
        // This is to avoid unnecessary command retries for already
        // decommissioned/deleted cloud resources.
        maxRetries = 0;
        // Reduce the rsync timeout (default is 10).
        long timeout = config.getCmdTimeout();
        for (int i = 0; i < executionContext.getCmd().length; i++) {
          if (executionContext.getCmd()[i].startsWith("--timeout=")) {
            executionContext.getCmd()[i] = "--timeout=" + timeout;
          }
        }
      }
      ProcessResult result = executeProcessRetry(executionContext.getCmd(),
          executionContext.getLogKey(), maxRetries, InductorConstants.PRIVATE_IP);
      // Mark the process execution result code to 0 for the shutdown.clouds.
      if (shutdown) {
        logger.warn(executionContext.getLogKey()
            + " ### Set the result code to 0 as the cloud resource for this component is already released.");
        result.setResultCode(0);
      }
      return result;
    }
focal_method.class_method_signature: ProcessRunner.executeProcessRetry(ExecutionContext executionContext)
focal_method.full_signature: public ProcessResult executeProcessRetry(ExecutionContext executionContext)
focal_method.identifier: executeProcessRetry
focal_method.invocations: hasCloudShutdownFor getWo getRetryCount getCmdTimeout getCmd startsWith getCmd getCmd executeProcessRetry getCmd getLogKey warn getLogKey setResultCode
focal_method.modifiers: public
focal_method.parameters: (ExecutionContext executionContext)
focal_method.return: ProcessResult
focal_method.signature: ProcessResult executeProcessRetry(ExecutionContext executionContext)