Examples of IDuccProcess


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

    HashMap<DuccId, IDuccProcess> map = duccEvent.getProcesses();
    if(map != null) {
      Iterator<Entry<DuccId, IDuccProcess>> iterator = map.entrySet().iterator();
      if(iterator.hasNext()) {
        Entry<DuccId, IDuccProcess> entry = iterator.next();
        IDuccProcess jp = entry.getValue();
        NodeIdentity nodeIdentity = jp.getNodeIdentity();
        String ip = nodeIdentity.getIp();
        String name = nodeIdentity.getName();
        String details = "ip:"+ip+" "+"name:"+name+" "+"jp-count:"+map.size();
        log(exchange, defaultLogType, exchId, event, details);
        timex(exchange, exchId, event);
View Full Code Here

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

              IDuccWorkJob job = null;
              if(duccWork instanceof IDuccWorkJob) {
                job = (IDuccWorkJob)duccWork;
              }
              IDuccProcessMap processMap = duccWorkExecutable.getProcessMap();
              IDuccProcess process = processMap.get(processId);
              if(process == null) {
                if(job != null) {
                  process = job.getDriver().getProcessMap().get(processId);
                }
              }
              if(process != null) {
                // PID
                copyInventoryPID(job, inventoryProcess, process);
                // Scheduler State
                setResourceStateAndReason(job, inventoryProcess, process);
                // Process State
                copyInventoryProcessState(job, inventoryProcess, process);
                // Process Reason
                copyReasonForStoppingProcess(job, inventoryProcess, process);
                // Process Exit code
                copyProcessExitCode(job, inventoryProcess, process);
                // Process Init & Run times
                updateProcessTime(job, inventoryProcess, process);
                // Process Initialization State
                switch(inventoryProcess.getProcessState()) {
                case Running:
                  process.setInitialized();
                  if(job != null) {
                    switch(job.getDuccType()) {
                    case Service:
                      switch(job.getJobState()) {
                      case Initializing:
View Full Code Here

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

    logger.trace(methodName, job.getDuccId(), messages.fetch("enter"));
    if(processMap != null) {
      Collection<IDuccProcess> processCollection = processMap.values();
      Iterator<IDuccProcess> iterator = processCollection.iterator();
      while(iterator.hasNext()) {
        IDuccProcess process = iterator.next();
        switch(process.getResourceState()) {
        case Allocated:
          process.setResourceState(ResourceState.Deallocated);
          process.setProcessDeallocationType(processDeallocationType);
          logger.info(methodName, job.getDuccId(), process.getDuccId(), type);
          if(processState != null) {
            logger.debug(methodName, job.getDuccId(), process.getProcessState()+" -> "+processState);
            process.advanceProcessState(processState);
          }
          break;
        case Deallocated: 
          if(processState != null) {
            logger.debug(methodName, job.getDuccId(), process.getProcessState()+" -> "+processState);
            process.advanceProcessState(processState);
          }
          break;
        }
      }
    }
View Full Code Here

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

        // force the publish, since there was a change.
        for( Map.Entry<DuccId, IDuccProcess> currentProcess: inventory.entrySet()) {
          //  Check if a process in the current inventory exists in a previous
          //  inventory snapshot
          if ( previousInventory.containsKey(currentProcess.getKey())) {
            IDuccProcess previousProcess =
                previousInventory.get(currentProcess.getKey());
            //  check if either PID or process state has changed
            if ( currentProcess.getValue().getPID() != null &&
                previousProcess.getPID() == null) {
              inventoryChanged = true;
              break;
            } else if ( !currentProcess.getValue().getProcessState().equals(previousProcess.getProcessState())) {
              inventoryChanged = true;
              break;
            }
          } else {
            // New inventory contains a process not in the previous snapshot
View Full Code Here

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

  }
 
  private void count(PagingInfo pagingInfo, IDuccProcessMap pMap) {
    if(pMap != null) {
      for(DuccId pId : pMap.keySet()) {
        IDuccProcess process = pMap.get(pId);
        total += process.getMajorFaults();
        procs += 1;
      }
    }
  }
View Full Code Here

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

                         String.format("Process %5s", p.getPID()),
                         "Completion:", s.toString());
        }

        for( DuccMapValueDifference<IDuccProcess> pd: diffmap ) {
            IDuccProcess pl = pd.getLeft();
            IDuccProcess pr = pd.getRight();

            Share sl = scheduler.getShare(pl.getDuccId());
            Share sr = scheduler.getShare(pr.getDuccId());

            String shareL = ( sl == null ) ? "<none>" : sl.toString();
            String shareR = ( sr == null ) ? "<none>" : sr.toString();

            ITimeWindow initL = pl.getTimeWindowInit();
            ITimeWindow initR = pr.getTimeWindowInit();
            long init_timeL = (initL == null) ? 0 : initL.getElapsedMillis();
            long init_timeR = (initR == null) ? 0 : initR.getElapsedMillis();

            /** extreme debugging only*/
            if ( logger.isTrace() ) {
                logger.trace(methodName, jobid,
                             "\n\tReconciling. incoming.(pid, mem, state, share, initTime)",
                             pl.getPID(),
                             pl.getResidentMemory(),
                             pl.getProcessState(),
                             shareL,
                             init_timeL,
                             "\n\tReconciling. existing.(pid, mem, state, share, initTime)",
                             pr.getPID(),
                             pr.getResidentMemory(),
                             pr.getProcessState(),
                             shareR,
                             init_timeR
                             );
            } else {
                if ( (pr.getPID() == null) && (pl.getPID() != null) ) {
                    logger.trace(methodName, jobid,
                                String.format("Process %5s", pl.getPID()),
                                "PID assignement for share", shareL);
                }
                if ( pl.getProcessState() != pr.getProcessState() ) {
                    logger.info(methodName, jobid,
                                String.format("Process %5s", pl.getPID()), sl.toString(),
                                "State:", pr.getProcessState(), "->", pl.getProcessState(),
                                getElapsedTime(pr.getTimeWindowInit()), getElapsedTime(pr.getTimeWindowRun()));
                }
            }

            long mem = pl.getResidentMemory();
            ProcessState state = pl.getProcessState();
View Full Code Here

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

                {
                    IDuccWorkExecutable de = (IDuccWorkExecutable) w;
                    IDuccProcessMap pm = de.getProcessMap();
                   
                    for ( Share s : shares.values() ) {
                        IDuccProcess p = pm.get(s.getId());
                        if ( p == null ) {
                            if ( (expanded == null) || (!expanded.containsKey(s)) ) {
                                logger.warn(methodName, j.getId(), "Redrive share assignment: ", s);
                                ret.put(s, s);
                            }
View Full Code Here

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

    String methodName = "reconcileProcessStateAndTakeAction";
    try {
      inventorySemaphore.acquire();
      // Check if process exists in agent's inventory
      if (getInventoryRef().containsKey(process.getDuccId())) {
        IDuccProcess agentManagedProcess = getInventoryRef().get(process.getDuccId());
        // check if process is Running, Initializing, or Starting
        if (isAlive(agentManagedProcess)) {
          // Stop the process if it has been deallocated
          if (process.isDeallocated() && isAlive(process)) {
            agentManagedProcess.setResourceState(ResourceState.Deallocated);
            logger.info(
                    methodName,
                    workDuccId,
                    "<<<<<<<< Agent Stopping Process:" + process.getDuccId() + " PID:"
                            + process.getPID() + " Reason: Ducc Deallocated the Process.");
View Full Code Here

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

   * ducc.properties. The agent will find the biggest (in terms of memory) process in its inventory
   * and stop it.
   */
  public void killProcessDueToLowSwapSpace(long minSwapThreshold) {
    String methodName = "killProcessDueToLowSwapSpace";
    IDuccProcess biggestProcess = null;
    try {
      inventorySemaphore.acquire();
      // find the fattest process
      for (Entry<DuccId, IDuccProcess> processEntry : getInventoryRef().entrySet()) {
        if (isProcessRunning(processEntry.getValue()) &&
            isOverSwapLimit(processEntry.getValue())
                && (biggestProcess == null || biggestProcess.getResidentMemory() < processEntry
                        .getValue().getResidentMemory())) {
          biggestProcess = processEntry.getValue();
        }
      }
    } catch (InterruptedException e) {
      logger.error(methodName, null, e);
    } finally {
      inventorySemaphore.release();
    }
    if (biggestProcess != null) {
      biggestProcess.setReasonForStoppingProcess(ReasonForStoppingProcess.LowSwapSpace.toString());
      logger.info(methodName, null, "Stopping Process:" + biggestProcess.getDuccId() + " PID:"
              + biggestProcess.getPID()
              + " Due to a low swap space. Process' RSS exceeds configured swap threshold of "
              + minSwapThreshold
              + " Defined in ducc.properties. Check ducc.node.min.swap.threshold property");
      stopProcess(biggestProcess);
    }
View Full Code Here

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

   *
   */
  public void stopProcess(IDuccProcess process) {
    String methodName = "stopProcess";
    try {
      IDuccProcess invProcess = null;
      if ((invProcess = getInventoryRef().get(process.getDuccId())) != null && isAlive(invProcess)) {
        logger.info(methodName, null, "Undeploing Process with PID:" + process.getPID());
        undeployProcess(process);
      } else if (invProcess == null) { // process not in inventory
        logger.info(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.