private GridProcessStatusInfo fillProcess(GridProcess process) {

    WorkerStatusInfo workerInfo =
        new WorkerStatusInfo(
            process.getWorkerEntry().getWorkerSpecification(),
            process.getHandle(),
            process.getWorkerEntry().getWorkerID(),
            process.getState().toString());

    GridProcessStatusInfoResult result = null;

    if (process.getResult() != null) {

      String error = "";
      String errorCause = null;

      GridProcessError executionError = process.getResult().getExecutionError();
      if (executionError != null) {
        error = executionError.getType().getName();

        if (executionError.getErrorCause() != null) {
          errorCause = executionError.getErrorCause().getMessage();
        }
      }

      result =
          new GridProcessStatusInfoResult(
              error,
              errorCause,
              process.getResult().getInitData().getElapsedTimeInMillis(),
              process.getResult().getRemoteData().getElapsedTimeInMillis(),
              process.getResult().getFinalData().getElapsedTimeInMillis(),
              process.getResult().getExecutorResult());

      SabotageCheckResult sabotageCheckResult = process.getResult().getSabotageCheckResult();
      if (sabotageCheckResult != null) {
        result.setSabotageCheck(sabotageCheckResult.toString());
      }
    }

    GridProcessStatusInfo info =
        new GridProcessStatusInfo(
            process.getId(),
            process.getTaskId(),
            process.getJobId(),
            process.getState().toString(),
            process.getCurrentPhase().toString(),
            workerInfo,
            result,
            process.getHandle());

    info.setCreationTime(process.getCreationTime());
    info.setFinalizationTime(process.getFinalizationTime());

    return info;
  }
Ejemplo n.º 2
0
  @Override
  public boolean equals(Object o) {

    if (o instanceof GridProcess) {
      GridProcess otherReplica = (GridProcess) o;
      return otherReplica.getHandle().equals(this.getHandle());
    }

    return false;
  }