Package org.apache.hama.ipc

Examples of org.apache.hama.ipc.GroomProtocol


  }

  private void updateGroomServersKey(GroomServerStatus old,
      GroomServerStatus newKey) {
    synchronized (groomServers) {
      GroomProtocol worker = groomServers.remove(old);
      groomServers.put(newKey, worker);
    }
  }
View Full Code Here


            } else if (jip.getStatus().getRunState() == JobStatus.RUNNING) {
              jip.getStatus().setProgress(ts.getSuperstepCount());
              jip.getStatus().setSuperstepCount(ts.getSuperstepCount());
            } else if (jip.getStatus().getRunState() == JobStatus.KILLED) {
             
              GroomProtocol worker = findGroomServer(tmpStatus);
              Directive d1 = new DispatchTasksDirective(
                  new GroomServerAction[] { new KillTaskAction(ts.getTaskId()) });
              try {
                worker.dispatch(d1);
              } catch (IOException ioe) {
                throw new DirectiveException("Error when dispatching kill task"
                    + " action.", ioe);
              }
            }
View Full Code Here

      LOG.error("No groom server status.");
      throw new NullPointerException("No groom server status.");
    }
    Throwable e = null;
    try {
      GroomProtocol wc = (GroomProtocol) RPC.waitForProxy(GroomProtocol.class,
          HamaRPCProtocolVersion.versionID,
          resolveWorkerAddress(status.getRpcServer()), this.conf);
      if (null == wc) {
        LOG.warn("Fail to create Worker client at host");
        return false;
View Full Code Here

  }

  private void updateGroomServersKey(GroomServerStatus old,
      GroomServerStatus newKey) {
    synchronized (groomServers) {
      GroomProtocol worker = groomServers.remove(old);
      groomServers.put(newKey, worker);
    }
  }
View Full Code Here

            } else if (jip.getStatus().getRunState() == JobStatus.RUNNING) {
              jip.getStatus().setProgress(ts.getSuperstepCount());
              jip.getStatus().setSuperstepCount(ts.getSuperstepCount());
            } else if (jip.getStatus().getRunState() == JobStatus.KILLED) {

              GroomProtocol worker = findGroomServer(tmpStatus);
              Directive d1 = new DispatchTasksDirective(
                  new GroomServerAction[] { new KillTaskAction(ts.getTaskId()) });
              try {
                worker.dispatch(d1);
              } catch (IOException ioe) {
                throw new DirectiveException("Error when dispatching kill task"
                    + " action.", ioe);
              }
            }
View Full Code Here

  private void execute(TaskInProgress tip, GroomServerStatus status) {
    Task task = tip.constructTask(status);

    GroomServerAction[] actions;
    GroomProtocol worker = groomServerManager.get().findGroomServer(status);

    if (!recoveryTasks.contains(tip)) {
      actions = new GroomServerAction[1];
      actions[0] = new LaunchTaskAction(task);
    } else {
      LOG.trace("Executing a recovery task");
      recoveryTasks.remove(tip);
      HashMap<String, GroomServerStatus> groomStatuses = new HashMap<String, GroomServerStatus>(
          1);
      groomStatuses.put(status.hostName, status);
      Map<GroomServerStatus, List<GroomServerAction>> actionMap = new HashMap<GroomServerStatus, List<GroomServerAction>>(
          2 * groomStatuses.size());
      try {
        tip.getJob().recoverTasks(groomStatuses, actionMap);
      } catch (IOException e) {
        LOG.warn("Task recovery failed", e);
      }

      List<GroomServerAction> actionList = actionMap.get(status);
      actions = new GroomServerAction[actionList.size()];
      actionList.toArray(actions);
    }
    Directive d1 = new DispatchTasksDirective(actions);
    try {
      worker.dispatch(d1);
    } catch (IOException ioe) {
      LOG.error(
          "Fail to dispatch tasks to GroomServer " + status.getGroomName(), ioe);
    }
  }
View Full Code Here

      LOG.error("No groom server status.");
      throw new NullPointerException("No groom server status.");
    }
    Throwable e = null;
    try {
      GroomProtocol wc = (GroomProtocol) RPC.waitForProxy(GroomProtocol.class,
          HamaRPCProtocolVersion.versionID,
          resolveWorkerAddress(status.getRpcServer()), this.conf);
      if (null == wc) {
        LOG.warn("Fail to create Worker client at host");
        return false;
View Full Code Here

  }

  private void updateGroomServersKey(GroomServerStatus old,
      GroomServerStatus newKey) {
    synchronized (groomServers) {
      GroomProtocol worker = groomServers.remove(old);
      groomServers.put(newKey, worker);
    }
  }
View Full Code Here

            } else if (jip.getStatus().getRunState() == JobStatus.RUNNING) {
              jip.getStatus().setProgress(ts.getSuperstepCount());
              jip.getStatus().setSuperstepCount(ts.getSuperstepCount());
            } else if (jip.getStatus().getRunState() == JobStatus.KILLED) {

              GroomProtocol worker = findGroomServer(tmpStatus);
              Directive d1 = new DispatchTasksDirective(
                  new GroomServerAction[] { new KillTaskAction(ts.getTaskId()) });
              try {
                worker.dispatch(d1);
              } catch (IOException ioe) {
                throw new DirectiveException("Error when dispatching kill task"
                    + " action.", ioe);
              }
             
View Full Code Here

          && groomIter.hasNext()) {

        GroomServerStatus groomStatus = groomIter.next();
        List<GroomServerAction> actionList = actionMap.get(groomStatus);

        GroomProtocol worker = groomServerManager.get()
            .findGroomServer(groomStatus);
        try {
          // dispatch() to the groom server
          GroomServerAction[] actions = new GroomServerAction[actionList
                                                              .size()];
          actionList.toArray(actions);
          Directive d1 = new DispatchTasksDirective(actions);
          worker.dispatch(d1);
        } catch (IOException ioe) {
          LOG.error("Fail to dispatch tasks to GroomServer "
              + groomStatus.getGroomName(), ioe);
          return Boolean.FALSE;
        }
View Full Code Here

TOP

Related Classes of org.apache.hama.ipc.GroomProtocol

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.