Package org.apache.uima.ducc.common.node.metrics

Examples of org.apache.uima.ducc.common.node.metrics.NodeUsersInfo


          if ( agent != null ) {
            // check if this process is in any of the cgroups. If so, this process is not rogue
            if ( ((NodeAgent)agent).useCgroups && ((NodeAgent)agent).cgroupsManager.isPidInCGroup(pid) ) {
              continue; // not rogue, this process is in a cgroup
            }
            NodeUsersInfo nui = null;
            //  Check if user record is already in the map. May have been done above in
            //  copyAllUserReservations().
            if ( map.containsKey(user)) {
              nui = map.get(user);
            } else {
              nui = new NodeUsersInfo(user);
              map.put(user, nui);
            }
            if ( logger == null ) {
          //    System.out.println(
           //           "User:"+user+" Reservations:"+nui.getReservations().size()+" Rogue Processes:"+nui.getRogueProcesses().size());
            } else {
              logger.info(location, null, "User:"+user+" Reservations:"+nui.getReservations().size()+" Rogue Processes:"+nui.getRogueProcesses().size());
            }
            // add a process to a list of processes currently running on the node. The list will be used
            // to remove stale rogue processes at the end of this method
           // currentPids.add(tokens[1]);
            currentPids.add(pid);
            if ( logger == null ) {
            } else {
              logger.trace(location, null,"Current Process (Before Calling aggregate() - PID:"+pid+" PPID:"+ppid+" Process List Size:"+processList.size());
            }
            NodeUsersCollector.ProcessInfo pi =
                    new NodeUsersCollector.ProcessInfo(Integer.parseInt(pid),Integer.parseInt(ppid));
            // add the process to the list of processes. If this process has a parent, it will be added as a child. Compose
            // hierarchy of processes so that we can use it later to determine if any given process has a parent that is rogue
            aggregate(processList, pi);
           
            // fetch user reservations
            List<IDuccId> userReservations = nui.getReservations();
            //  if user has reservations on the node, any process found is not a rogue process
            if ( userReservations.size() > 0 ) {
              boolean found = false;
              //  check if this process has previously been marked as rogue
              for( NodeProcess rogue : nui.getRogueProcesses() ) {
                if ( rogue.getPid().equals(pid)) {
                  found = true;
                  break;
                }
              }
             
              if ( !found && !agent.isManagedProcess(processList, pi)) {
                // code keeps count of java and non-java processes separately, so pass the type of process (java or not)
                // to allow distinct accounting
                nui.addPid(pid, ppid, cmd.endsWith("java"));
              }
              continue// all we know that the user has a reservation and there is a process running. If there
                         // are reservations, we cant determine which user process is a rogue process
            }
          
            //  detect if this is a rogue process and add it to the rogue process list. First check if the current process
            //  has a parent and if so, check if the parent is rogue. Second, if parent is not rogue (or no parent)
            //  check if the process is in agent's inventory. If its not, we have a rogue process.
            if ( agent.isRogueProcess(user, processList, pi) ) {
              if ( nui.getRogueProcesses().size() == 0 || !inRogueList(nui.getRogueProcesses(),pid) ) {
                pi.setRogue(true);
//                agent.getRogueProcessReaper().submitRogueProcessForKill(user, pid, ppid, cmd.endsWith("java"));
              }
              agent.getRogueProcessReaper().submitRogueProcessForKill(user, pid, ppid, cmd.endsWith("java"));
            }
View Full Code Here


    }
    else {
      try {
        TreeMap<String, NodeUsersInfo> map = ipToNodeUsersInfoMap.get(ip.toString());
        if(map != null) {
          NodeUsersInfo nodeUsersInfo = map.get(user.toString());
          if(nodeUsersInfo != null) {
            for( NodeProcess process : nodeUsersInfo.getReserveProcesses() ) {
              retVal.add(process.getPid());
            }
//            retVal = nodeUsersInfo.getPids();
          }
        }
View Full Code Here

                "+++++++++++ Copying User Reservations - List Size:" + reservations.size());
        for (DuccUserReservation r : reservations) {
          if ("System".equals(r.getUserId())) {
            continue;
          }
          NodeUsersInfo nui = null;
          if (map.containsKey(r.getUserId())) {
            nui = map.get(r.getUserId());
          } else {
            nui = new NodeUsersInfo(r.getUserId());
            map.put(r.getUserId(), nui);
          }
          nui.addReservation(r.getReserveID());
        }
      } else {
        logger.info("copyAllUserReservations", null, " ***********  No Reservations");
      }
    } catch (InterruptedException e) {
View Full Code Here

    for (Map.Entry<String, RogueProcessEntry> entry : userRogueProcessMap.entrySet()) {
      if (!entry.getValue().isRogue()) {
        continue;
      }
      NodeUsersInfo nui;
      if (map.containsKey(entry.getValue().getUser())) {
        nui = map.get(entry.getValue().getUser());
      } else {
        nui = new NodeUsersInfo(entry.getValue().getUser());
        map.put(entry.getValue().getUser(), nui);
      }
      nui.addRogueProcess(entry.getKey(), entry.getValue().getPpid(), entry.getValue().isJava());
    }
    for (String entryToRemove : entryCleanupList) {
      if (logger == null) {
        System.out.println("Removing Expired Entry From RogueProcessMap for PID:" + entryToRemove);
View Full Code Here

  public List<ProcessInfo> getRogueProcessInfoList() {
    List<ProcessInfo> retVal = new ArrayList<ProcessInfo>();
    TreeMap<String,NodeUsersInfo> nodeUsersMap = getNodeUsersMap();
    if(nodeUsersMap != null) {
      for(Entry<String, NodeUsersInfo> entry : nodeUsersMap.entrySet()) {
        NodeUsersInfo nodeUsersInfo = entry.getValue();
        String uid = nodeUsersInfo.getUid();
        List<NodeProcess> rogueList = nodeUsersInfo.getRogueProcesses();
        for( NodeProcess rogue : rogueList ) {
          ProcessInfo processInfo = new ProcessInfo(uid,rogue.getPid(), rogue.isJava());
          retVal.add(processInfo);
        }
      }
View Full Code Here

TOP

Related Classes of org.apache.uima.ducc.common.node.metrics.NodeUsersInfo

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.