<commit_before>#include <getopt.h>

#include "slave.hpp"
#include "slave_webui.hpp"

using namespace std;
using namespace nexus::internal::slave;


void usage(const char *programName)
{
  cerr << "Usage: " << programName
       << " [--cpus NUM] [--mem NUM] [--isolation TYPE] [--quiet] <master_or_zoo_pid>"
       << endl;
}


int main(int argc, char **argv)
{
  if (argc == 2 && string("--help") == argv[1]) {
    usage(argv[0]);
    exit(1);
  }

  option options[] = {
    {"cpus", required_argument, 0, 'c'},
    {"mem", required_argument, 0, 'm'},
    {"isolation", required_argument, 0, 'i'},
    {"quiet", no_argument, 0, 'q'},
  };

  Resources resources(1, 1 * Gigabyte);
  bool quiet = false;
  string isolation = "process";

  int opt;
  int index;
  while ((opt = getopt_long(argc, argv, "c:m:i:q", options, &index)) != -1) {
    switch (opt) {
      case 'c': 
	resources.cpus = atoi(optarg);
        break;
      case 'm':
	resources.mem = atoll(optarg);
        break;
      case 'i':
	isolation = optarg;
        break;
      case 'q':
        quiet = true;
        break;
      case '?':
        // Error parsing options; getopt prints an error message, so just exit
        exit(1);
        break;
      default:
        break;
    }
  }

  if (!quiet)
    google::SetStderrLogging(google::INFO);

  FLAGS_logbufsecs = 1;
  google::InitGoogleLogging(argv[0]);

  // Check that we have exactly one non-option argument (the master PID)
  if (optind != argc - 1) {
    usage(argv[0]);
    exit(1);
  }

  // Read and resolve the master PID
  string master(argv[optind]);


  istringstream iss(argv[optind]);
  if (!(iss >> master)) {
    cerr << "Failed to resolve master PID " << argv[optind] << endl;
    exit(1);
  }

  LOG(INFO) << "Build: " << BUILD_DATE << " by " << BUILD_USER;
  LOG(INFO) << "Starting Nexus slave";
  PID slave = Process::spawn(new Slave(master, resources, false, isolation));

#ifdef NEXUS_WEBUI
  startSlaveWebUI(slave);
#endif

  Process::wait(slave);
  return 0;
}<commit_msg>bug: extra code that wasn't deleted<commit_after>#include <getopt.h>

#include "slave.hpp"
#include "slave_webui.hpp"

using namespace std;
using namespace nexus::internal::slave;


void usage(const char *programName)
{
  cerr << "Usage: " << programName
       << " [--cpus NUM] [--mem NUM] [--isolation TYPE] [--quiet] <master_or_zoo_pid>"
       << endl;
}


int main(int argc, char **argv)
{
  if (argc == 2 && string("--help") == argv[1]) {
    usage(argv[0]);
    exit(1);
  }

  option options[] = {
    {"cpus", required_argument, 0, 'c'},
    {"mem", required_argument, 0, 'm'},
    {"isolation", required_argument, 0, 'i'},
    {"quiet", no_argument, 0, 'q'},
  };

  Resources resources(1, 1 * Gigabyte);
  bool quiet = false;
  string isolation = "process";

  int opt;
  int index;
  while ((opt = getopt_long(argc, argv, "c:m:i:q", options, &index)) != -1) {
    switch (opt) {
      case 'c': 
	resources.cpus = atoi(optarg);
        break;
      case 'm':
	resources.mem = atoll(optarg);
        break;
      case 'i':
	isolation = optarg;
        break;
      case 'q':
        quiet = true;
        break;
      case '?':
        // Error parsing options; getopt prints an error message, so just exit
        exit(1);
        break;
      default:
        break;
    }
  }

  if (!quiet)
    google::SetStderrLogging(google::INFO);

  FLAGS_logbufsecs = 1;
  google::InitGoogleLogging(argv[0]);

  // Check that we have exactly one non-option argument (the master PID)
  if (optind != argc - 1) {
    usage(argv[0]);
    exit(1);
  }

  // Read and resolve the master PID
  string master(argv[optind]);


  LOG(INFO) << "Build: " << BUILD_DATE << " by " << BUILD_USER;
  LOG(INFO) << "Starting Nexus slave";
  PID slave = Process::spawn(new Slave(master, resources, false, isolation));

#ifdef NEXUS_WEBUI
  startSlaveWebUI(slave);
#endif

  Process::wait(slave);
  return 0;
}
{'fraction_non_alphanumeric': 0.16649642492339123, 'fraction_numerical': 0.009448416751787538, 'mean_word_length': 2.8859126984126986, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5480105', 'n_tokens_mistral': 1440, 'n_tokens_neox': 1368, 'n_words': 363}