Package org.apache.uima.ducc.transport.event.common

Examples of org.apache.uima.ducc.transport.event.common.IDuccReservationMap


      Iterator<DuccId> iteratorR = duccWorkMap.getReservationKeySet().iterator();
      while(iteratorR.hasNext()) {
        DuccId reservationId = iteratorR.next();
        IDuccWorkReservation reservation = (IDuccWorkReservation)duccWorkMap.findDuccWork(reservationId);
        if(reservation.isOperational()) {
          IDuccReservationMap reservationMap = reservation.getReservationMap();
          Iterator<DuccId> iteratorS = reservationMap.keySet().iterator();
          while(iteratorS.hasNext()) {
            DuccId spid = iteratorS.next();
            IDuccReservation rs = reservationMap.get(spid);
            NodeIdentity nodeIdentity = rs.getNodeIdentity();
            String key = nodeIdentity.getIp().trim();
            Integer value = new Integer(0);
            if(!properties.containsKey(key)) {
              properties.put(key, value);
View Full Code Here


                             //processAdjustedMemorySize,
                             jobProcessList ));
        } else if (entry.getValue() instanceof DuccWorkReservation ) {
          String userId = ((DuccWorkReservation) entry.getValue()).getStandardInfo().getUser();
          if ( !"System".equals(userId)) {
            IDuccReservationMap reservationMap =
                    ((DuccWorkReservation) entry.getValue()).getReservationMap();
            reservationList.add(new DuccUserReservation(userId, ((DuccWorkReservation) entry.getValue()).getDuccId(), reservationMap));
            logger.info(methodName,null,"---------------  Added reservation for user:"+userId);
          }
        }
View Full Code Here

                saveState = true;
              }
              break;
            case hot:
              if(jdHostClass.equals(reservation.getSchedulingInfo().getSchedulingClass())) {
                IDuccReservationMap map = reservation.getReservationMap();
                Iterator<Entry<DuccId, IDuccReservation>> entries = map.entrySet().iterator();
                while(entries.hasNext()) {
                  Entry<DuccId, IDuccReservation> entry = entries.next();
                  NodeIdentity node = entry.getValue().getNodeIdentity();
                  hostManager.addNode(node);
                }
View Full Code Here

        properties.put(ReservationRequestProperties.key_id, duccWorkReservation.getId());
        // node list
        properties.put(ReservationRequestProperties.key_node_list, "");
        if(!duccWorkReservation.getReservationMap().isEmpty()) {
          StringBuffer sb = new StringBuffer();
          IDuccReservationMap map = duccWorkReservation.getReservationMap();
          for (DuccId key : map.keySet()) {
            IDuccReservation value = duccWorkReservation.getReservationMap().get(key);
            String node = value.getNodeIdentity().getName();
            sb.append(node);
            sb.append(" ");
          }
View Full Code Here

  private int reservationMapResourcesAdd(DuccWorkReservation duccWorkReservation,Map<DuccId,IResource> resourceMap) {
    String methodName = "reservationMapResourcesAdd";
    logger.trace(methodName, null, messages.fetch("enter"));
    int changes = 0;
    IDuccReservationMap reservationMap = duccWorkReservation.getReservationMap();
    if(resourceMap != null) {
      Iterator<DuccId> resourceMapIterator = resourceMap.keySet().iterator();
      while(resourceMapIterator.hasNext()) {
        DuccId duccId = resourceMapIterator.next();
        IResource resource = resourceMap.get(duccId);
        Node node = resource.getNode();
        NodeIdentity nodeId = node.getNodeIdentity();
        int shares = resource.countShares();
        if(!reservationMap.containsKey(duccId)) {
          DuccReservation reservation = new DuccReservation(duccId, node, shares);
          reservationMap.addReservation(reservation);
          logger.info(methodName, duccId, messages.fetch("add resource")+" "+messages.fetchLabel("name")+nodeId.getName()+" "+messages.fetchLabel("ip")+nodeId.getIp());
          changes++;
        }
        else {
          logger.debug(methodName, duccId, messages.fetch("duplicate resource")+" "+messages.fetchLabel("name")+nodeId.getName()+" "+messages.fetchLabel("ip")+nodeId.getIp());
View Full Code Here

 
  private int reservationMapResourcesDel(DuccWorkReservation duccWorkReservation,Map<DuccId,IResource> resourceMap) {
    String methodName = "processMapResourcesDel";
    logger.trace(methodName, null, messages.fetch("enter"));
    int changes = 0;
    IDuccReservationMap reservationMap = duccWorkReservation.getReservationMap();
    if(resourceMap != null) {
      Iterator<DuccId> resourceMapIterator = resourceMap.keySet().iterator();
      while(resourceMapIterator.hasNext()) {
        DuccId duccId = resourceMapIterator.next();
        Node node = resourceMap.get(duccId).getNode();
        NodeIdentity nodeId = node.getNodeIdentity();
        if(reservationMap.containsKey(duccId)) {
          reservationMap.removeReservation(duccId);
          logger.info(methodName, duccId, messages.fetch("remove resource")+" "+messages.fetchLabel("name")+nodeId.getName()+" "+messages.fetchLabel("ip")+nodeId.getIp());
          changes++;
        }
        else {
          logger.debug(methodName, duccId, messages.fetch("not found resource")+" "+messages.fetchLabel("name")+nodeId.getName()+" "+messages.fetchLabel("ip")+nodeId.getIp());
View Full Code Here

    {
      String methodName = "receiveReservation";
        j.setReservation();

        IDuccWorkReservation dr = (IDuccWorkReservation) job;
        IDuccReservationMap rm = dr.getReservationMap();
        if ( (rm.size() > 0) && !job.isCompleted() ) {          // need to recover, apparently RM crashed. hmph.
            for ( IDuccReservation res : rm.values() ) {       // build up Shares from the incoming state
                NodeIdentity ni = res.getNodeIdentity();
                Machine m = scheduler.getMachine(ni);
                if ( m == null ) {                             // not known, huh? maybe next epoch it will have checked in
                    refuse(j, "Cannot restore reservation because node " + ni.getName() + " is unknown.");
                    return false;                              // so we don't add it to global tables
View Full Code Here

      reservationsSemaphore.acquire();
      if (reserves != null) {
        // clear old entries
        reservations.clear();
        // Only copy reservations for this node
        IDuccReservationMap reserveMap = new DuccReservationMap();
        for (DuccUserReservation r : reserves) {
          reserveMap.clear();
          for (Map.Entry<DuccId, IDuccReservation> entry : r.getUserReservations().entrySet()) {
            if (Utils.isThisNode(getIdentity().getIp(), entry.getValue().getNodeIdentity().getIp())) {
              reserveMap.addReservation(entry.getValue());
            }
          }
          if (reserveMap.getMap().size() > 0) {
            DuccUserReservation reserve = new DuccUserReservation(r.getUserId(), r.getReserveID(),
                    reserveMap);
            reservations.add(reserve);
          }
        }
View Full Code Here

                break;

            case Reservation:
                {
                    IDuccWorkReservation de = (IDuccWorkReservation) w;
                    IDuccReservationMap  rm = de.getReservationMap();
                   
                    for ( Share s : shares.values() ) {
                        IDuccReservation r = rm.get(s.getId());
                        if ( r == null ) {
                            if ( (expanded == null) || (!expanded.containsKey(s)) ) {
                                logger.warn(methodName, j.getId(), "Redrive share assignment:", s);
                                ret.put(s, s);
                            }
View Full Code Here

              .getLocalHost().getHostName());
      NodeAgent agent = new NodeAgent(node);

      List<DuccUserReservation> reserves = new ArrayList<DuccUserReservation>();

      IDuccReservationMap reserveMap = new DuccReservationMap();
      IDuccReservationMap reserveMap2 = new DuccReservationMap();

      NodeIdentity ni1 = node;
      // new NodeIdentity(, name);
      NodeIdentity ni2 = new NodeIdentity("111.111.111.111", "node100");
      NodeIdentity ni3 = node;
      NodeIdentity ni4 = new NodeIdentity("222.222.222.222", "node102");

      DuccId id1 = new DuccId(100);
      DuccId id2 = new DuccId(101);
      DuccId id3 = new DuccId(102);
      DuccId id4 = new DuccId(103);

      IDuccReservation reservation1 = new DuccReservation(id1, ni1, 1);
      reserveMap.addReservation(reservation1);
      IDuccReservation reservation2 = new DuccReservation(id2, ni2, 1);
      reserveMap.addReservation(reservation2);
      IDuccReservation reservation4 = new DuccReservation(id4, ni4, 1);
      reserveMap.addReservation(reservation4);

      IDuccReservation reservation3 = new DuccReservation(id3, ni3, 1);
      reserveMap2.addReservation(reservation3);

      DuccUserReservation reserve = new DuccUserReservation("joe", new DuccId(500), reserveMap);
      DuccUserReservation reserve2 = new DuccUserReservation("jane", new DuccId(500), reserveMap2);
      reserves.add(reserve);
      reserves.add(reserve2);
View Full Code Here

TOP

Related Classes of org.apache.uima.ducc.transport.event.common.IDuccReservationMap

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.