Example #1
0
  /** Check 'pidRegex' */
  public void checkPidRegex() {
    // PID regex matcher
    String pidPatternStr = config.getPidRegex("");

    if (pidPatternStr.isEmpty()) {
      System.err.println("Cannot find 'pidRegex' entry in config file.");
      System.exit(1);
    }

    Executioner executioner = Executioners.getInstance().get(ExecutionerType.CLUSTER);

    // Show pattern
    System.out.println("Matching pidRegex '" + pidPatternStr + "'");

    // Read STDIN and check pattern
    try {
      BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
      String line;
      while ((line = in.readLine()) != null) {
        String pid = executioner.parsePidLine(line);
        System.out.println("Input line:\t'" + line + "'\tMatched: '" + pid + "'");
      }
    } catch (IOException e) {
      e.printStackTrace();
    }

    executioner.kill(); // Kill executioner
  }
Example #2
0
  /** Run script */
  public int run() {
    // Initialize
    Executioners executioners = Executioners.getInstance(config);
    TaskDependecies.reset();

    // Check PID regex
    if (checkPidRegex) {
      checkPidRegex();
      return 0;
    }

    // ---
    // Run
    // ---
    int exitValue = 0;
    switch (bdsAction) {
      case RUN_CHECKPOINT:
        exitValue = runCheckpoint();
        break;

      case INFO_CHECKPOINT:
        exitValue = infoCheckpoint();
        break;

      case TEST:
        exitValue = runTests();
        break;

      default:
        exitValue = runCompile(); // Compile & run
    }
    if (verbose) Timer.showStdErr("Finished. Exit code: " + exitValue);

    // ---
    // Kill all executioners
    // ---
    for (Executioner executioner : executioners.getAll()) executioner.kill();

    config.kill(); // Kill 'tail' and 'monitor' threads

    return exitValue;
  }