コード例 #1
0
ファイル: MonitorThread.java プロジェクト: ml-smores/fast
  public void run() {
    try {
      while (!stop) {
        if (LogInfo.writeToStdout) readAndProcessCommand();

        // Input commands
        Execution.inputMap.readEasy(Execution.getFile("input.map"));

        boolean killed = Execution.create && new File(Execution.getFile("kill")).exists();
        if (killed) Execution.setExecStatus("killed", true);

        // Output status
        Execution.putOutput("log.note", LogInfo.note);
        Execution.putOutput("exec.memory", SysInfoUtils.getUsedMemoryStr());
        Execution.putOutput(
            "exec.time", new StopWatch(LogInfo.getWatch().getCurrTimeLong()).toString());
        Execution.putOutput("exec.errors", "" + LogInfo.getNumErrors());
        Execution.putOutput("exec.warnings", "" + LogInfo.getNumWarnings());
        Execution.setExecStatus("running", false);
        Execution.printOutputMap(Execution.getFile("output.map"));

        if (killed) throw new RuntimeException("Killed by 'kill' file");

        Utils.sleep(timeInterval);
      }
    } catch (Exception e) {
      e.printStackTrace();
      System.exit(1); // Die completely
    }
  }
コード例 #2
0
  public static void finish() {
    if (!makeThunk) {
      Record.finish();

      if (monitor) monitorThread.finish();
      setExecStatus("done", false);
      outputMap.printEasy(getFile("output.map"));
      StopWatch.getStats().printEasy(getFile("time.map"));
      if (create) stderr.println(virtualExecDir);
      if (LogInfo.getNumErrors() > 0 || LogInfo.getNumWarnings() > 0)
        stderr.printf("%d errors, %d warnings\n", LogInfo.getNumErrors(), LogInfo.getNumWarnings());
      if (startMainTrack) end_track();
    }

    System.exit(exitCode);
  }