<commit_before>package com.twitter.heron.scheduler.aurora;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

import com.twitter.heron.spi.common.ShellUtils;

/**
 * This file defines Utils methods used by Aurora
 */
public class AuroraUtils {
  private static final Logger LOG = Logger.getLogger(AuroraUtils.class.getName());

  // Create an aurora job
  public static boolean createAuroraJob(String jobName, String cluster, String role, String env,
                                        String auroraFilename, Map<String, String> bindings,
                                        boolean isVerbose) {
    List<String> auroraCmd = Arrays.asList("aurora", "job", "create", "--wait-until", "RUNNING");

    for (Map.Entry<String, String> binding : bindings.entrySet()) {
      auroraCmd.add("--bind");
      auroraCmd.add(String.format("%s=%s", binding.getKey(), binding.getValue()));
    }

    String jobSpec = String.format("%s/%s/%s/%s", cluster, role, env, jobName);
    auroraCmd.add(jobSpec);
    auroraCmd.add(auroraFilename);

    if (isVerbose) {
      auroraCmd.add("--verbose");
    }

    return 0 == ShellUtils.runProcess(
        isVerbose, (String[]) auroraCmd.toArray(), new StringBuilder(), new StringBuilder());
  }

  // Kill an aurora job
  public static boolean killAuroraJob(String jobName, String cluster, String role, String env,
                                      boolean isVerbose) {
    List<String> auroraCmd = Arrays.asList("aurora", "job", "killall");
    String jobSpec = String.format("%s/%s/%s/%s", cluster, role, env, jobName);
    auroraCmd.add(jobSpec);

    appendAuroraCommandOptions(auroraCmd, isVerbose);

    return 0 == ShellUtils.runProcess(
        isVerbose, (String[]) auroraCmd.toArray(), new StringBuilder(), new StringBuilder());
  }

  // Restart an aurora job
  public static boolean restartAuroraJob(String jobName, String cluster, String role, String env,
                                         int containerId, boolean isVerbose) {
    List<String> auroraCmd = Arrays.asList("aurora", "job", "restart");
    String jobSpec = String.format("%s/%s/%s/%s", cluster, role, env, jobName);
    if (containerId != -1) {
      jobSpec = String.format("%s/%s", jobSpec, "" + containerId);
    }
    auroraCmd.add(jobSpec);

    appendAuroraCommandOptions(auroraCmd, isVerbose);

    return 0 == ShellUtils.runProcess(
        isVerbose, (String[]) auroraCmd.toArray(), new StringBuilder(), new StringBuilder());
  }

  // Static method to append verbose and batching options if needed
  public static void appendAuroraCommandOptions(List<String> auroraCmd,
                                                boolean isVerbose) {
    if (isVerbose) {
      auroraCmd.add("--verbose");
    }
    auroraCmd.add("--no-batching");

    return;
  }
}<commit_msg>Fix  UnsupportedOperationException in AuroraUtils<commit_after>package com.twitter.heron.scheduler.aurora;

import com.twitter.heron.spi.common.ShellUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

/**
 * This file defines Utils methods used by Aurora
 */
public class AuroraUtils {
  private static final Logger LOG = Logger.getLogger(AuroraUtils.class.getName());

  // Create an aurora job
  public static boolean createAuroraJob(String jobName, String cluster, String role, String env,
                                        String auroraFilename, Map<String, String> bindings,
                                        boolean isVerbose) {
    List<String> auroraCmd = new ArrayList<>(Arrays.asList("aurora", "job", "create", "--wait-until", "RUNNING"));

    for (Map.Entry<String, String> binding : bindings.entrySet()) {
      auroraCmd.add("--bind");
      auroraCmd.add(String.format("%s=%s", binding.getKey(), binding.getValue()));
    }

    String jobSpec = String.format("%s/%s/%s/%s", cluster, role, env, jobName);
    auroraCmd.add(jobSpec);
    auroraCmd.add(auroraFilename);

    if (isVerbose) {
      auroraCmd.add("--verbose");
    }

    return 0 == ShellUtils.runProcess(
        isVerbose, auroraCmd.toArray(new String[0]), new StringBuilder(), new StringBuilder());
  }

  // Kill an aurora job
  public static boolean killAuroraJob(String jobName, String cluster, String role, String env,
                                      boolean isVerbose) {
    List<String> auroraCmd = new ArrayList<>(Arrays.asList("aurora", "job", "killall"));
    String jobSpec = String.format("%s/%s/%s/%s", cluster, role, env, jobName);
    auroraCmd.add(jobSpec);

    appendAuroraCommandOptions(auroraCmd, isVerbose);

    return 0 == ShellUtils.runProcess(
        isVerbose, auroraCmd.toArray(new String[0]), new StringBuilder(), new StringBuilder());
  }

  // Restart an aurora job
  public static boolean restartAuroraJob(String jobName, String cluster, String role, String env,
                                         int containerId, boolean isVerbose) {
    List<String> auroraCmd = new ArrayList<>(Arrays.asList("aurora", "job", "restart"));
    String jobSpec = String.format("%s/%s/%s/%s", cluster, role, env, jobName);
    if (containerId != -1) {
      jobSpec = String.format("%s/%s", jobSpec, "" + containerId);
    }
    auroraCmd.add(jobSpec);

    appendAuroraCommandOptions(auroraCmd, isVerbose);

    return 0 == ShellUtils.runProcess(
        isVerbose, auroraCmd.toArray(new String[0]), new StringBuilder(), new StringBuilder());
  }

  // Static method to append verbose and batching options if needed
  public static void appendAuroraCommandOptions(List<String> auroraCmd,
                                                boolean isVerbose) {
    if (isVerbose) {
      auroraCmd.add("--verbose");
    }
    auroraCmd.add("--no-batching");

    return;
  }
}
{'fraction_non_alphanumeric': 0.13067306045555746, 'fraction_numerical': 0.001883884226751156, 'mean_word_length': 2.9727891156462585, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4629915', 'n_tokens_mistral': 1724, 'n_tokens_neox': 1688, 'n_words': 416}