Package org.apache.uima.ducc.common.utils.id

Examples of org.apache.uima.ducc.common.utils.id.DuccId


    int changes = 0;
    Iterator<DuccId> serviceMapIterator = serviceMap.keySet().iterator();
    long t0 = System.currentTimeMillis();
    synchronized(workMap) {
      while(serviceMapIterator.hasNext()) {
        DuccId duccId = serviceMapIterator.next();
        ServiceDependency services = serviceMap.get(duccId);
        DuccWorkJob duccWorkJob = (DuccWorkJob) workMap.findDuccWork(duccId);
        if(duccWorkJob != null) {
          JobState jobState = duccWorkJob.getJobState();
          ServiceState serviceState = services.getState();
View Full Code Here


    logger.trace(methodName, null, messages.fetch("enter"));
    Iterator<DuccId> iterator = inventoryProcessMap.keySet().iterator();
    long t0 = System.currentTimeMillis();
    synchronized(workMap) {
      while(iterator.hasNext()) {
        DuccId processId = iterator.next();
        IDuccProcess inventoryProcess = inventoryProcessMap.get(processId);
        List<IUimaPipelineAEComponent> upcList = inventoryProcess.getUimaPipelineComponents();
        if(upcList != null) {
          Iterator<IUimaPipelineAEComponent> upcIterator = upcList.iterator();
          while(upcIterator.hasNext()) {
            IUimaPipelineAEComponent upc = upcIterator.next();
            logger.debug(methodName, null, processId, "pipelineInfo: "+inventoryProcess.getNodeIdentity()+" "+inventoryProcess.getPID()+" "+upc.getAeName()+" "+upc.getAeState()+" "+upc.getInitializationTime());
          }
        }
        ProcessType processType = inventoryProcess.getProcessType();
        if(processType != null) {
          DuccId jobId = OrchestratorCommonArea.getInstance().getProcessAccounting().getJobId(processId);
          if(jobId != null) {
            IDuccWork duccWork = workMap.findDuccWork(jobId);
            if(duccWork != null) {
              DuccType jobType = duccWork.getDuccType();
              switch(jobType) {
              case Job:
                switch(processType) {
                case Pop:
                  OrchestratorCommonArea.getInstance().getProcessAccounting().setStatus(inventoryProcess);
                  DuccWorkJob job = (DuccWorkJob) duccWork;
                  switch(inventoryProcess.getProcessState()) {
                  case Failed:
                    if(inventoryProcess.getDuccId().getFriendly() == 0) {
                      jobTerminate(job, JobCompletionType.DriverProcessFailed, new Rationale(inventoryProcess.getReasonForStoppingProcess()), inventoryProcess.getProcessDeallocationType());
                    }
                    else {
                      jobTerminate(job, JobCompletionType.ProcessFailure, new Rationale(inventoryProcess.getReasonForStoppingProcess()), inventoryProcess.getProcessDeallocationType());
                    }
                    break;
                  default:
                    if(inventoryProcess.isComplete()) {
                      OrchestratorCommonArea.getInstance().getProcessAccounting().deallocate(job,ProcessDeallocationType.Stopped);
                      IRationale rationale = new Rationale("state manager reported as normal completion");
                      int errors = job.getSchedulingInfo().getIntWorkItemsError();
                      int lost = job.getSchedulingInfo().getIntWorkItemsLost();
                      if(errors > 0) {
                        setCompletionIfNotAlreadySet(job, JobCompletionType.Error, new Rationale("state manager detected error work items="+errors));
                      }
                      else if(lost > 0) {
                        setCompletionIfNotAlreadySet(job, JobCompletionType.Lost, new Rationale("state manager detected lost work items="+lost));
                      }
                      // <UIMA-3337>
                      else {
                        setCompletionIfNotAlreadySet(job, JobCompletionType.EndOfJob, rationale);
                      }
                      // </UIMA-3337>
                      completeJob(job, rationale);
                    }
                    break;
                  }
                  break;
                case Service:
                  logger.warn(methodName, jobId, processId, "unexpected process type: "+processType);
                  break;
                case Job_Uima_AS_Process:
                  OrchestratorCommonArea.getInstance().getProcessAccounting().setStatus(inventoryProcess);
                  break;
                }
                break;
              case Service:
                DuccWorkJob service = (DuccWorkJob) duccWork;
                switch(processType) {
                case Pop:
                  OrchestratorCommonArea.getInstance().getProcessAccounting().setStatus(inventoryProcess);
                  if(inventoryProcess.isComplete()) {
                    OrchestratorCommonArea.getInstance().getProcessAccounting().deallocate(service,ProcessDeallocationType.Stopped);
                  }
                  if(!service.hasAliveProcess()) {
                    completeManagedReservation(service, new Rationale("state manager reported no viable service process exists, type="+processType));
                  }
                  break;
                case Service:
                  OrchestratorCommonArea.getInstance().getProcessAccounting().setStatus(inventoryProcess);
                  if(inventoryProcess.isComplete()) {
                    OrchestratorCommonArea.getInstance().getProcessAccounting().deallocate(service,ProcessDeallocationType.Stopped);
                  }
                  if(!service.hasAliveProcess()) {
                    completeService(service, new Rationale("state manager reported no viable service process exists, type="+processType));
                  }
                  break;
                case Job_Uima_AS_Process:
                  OrchestratorCommonArea.getInstance().getProcessAccounting().setStatus(inventoryProcess);
                  if(inventoryProcess.isComplete()) {
                    OrchestratorCommonArea.getInstance().getProcessAccounting().deallocate(service,ProcessDeallocationType.Stopped);
                  }
                  if(!service.hasAliveProcess()) {
                    completeService(service, new Rationale("state manager reported no viable service process exists, type="+processType));
                  }
                  break;
                }
                break;
              }
            }
            else {
              StringBuffer sb = new StringBuffer();
              sb.append("node:"+inventoryProcess.getNodeIdentity().getName());
              sb.append(" ");
              sb.append("PID:"+inventoryProcess.getPID());
              sb.append(" ");
              sb.append("type:"+inventoryProcess.getProcessType());
              logger.debug(methodName, jobId, sb);
            }
          }
          else {
            StringBuffer sb = new StringBuffer();
            sb.append("node:"+inventoryProcess.getNodeIdentity().getName());
            sb.append(" ");
            sb.append("PID:"+inventoryProcess.getPID());
            sb.append(" ");
            sb.append("type:"+inventoryProcess.getProcessType());
            logger.debug(methodName, jobId, sb);
          }
        }
        else {
          DuccId jobId = null;
          StringBuffer sb = new StringBuffer();
          sb.append("node:"+inventoryProcess.getNodeIdentity().getName());
          sb.append(" ");
          sb.append("PID:"+inventoryProcess.getPID());
          sb.append(" ");
View Full Code Here

    }
  }
 
  private void completeManagedReservation(DuccWorkJob service, IRationale rationale) {
    String location = "completeManagedReservation";
    DuccId jobid = null;
    try {
      jobid = service.getDuccId();
      Map<DuccId, IDuccProcess> map = service.getProcessMap().getMap();
      int size = map.size();
      if(size != 1) {
        logger.warn(location, jobid, "size: "+size);
        completeJob(service, rationale);
      }
      else {
        Iterator<DuccId> iterator = map.keySet().iterator();
        while(iterator.hasNext()) {
          DuccId key = iterator.next();
          IDuccProcess process = map.get(key);
          int code = process.getProcessExitCode();
          IRationale exitCode = new Rationale("code="+code);
          switch(service.getCompletionType()) {
          case Undefined:
View Full Code Here

    }
  }
 
  private void completeService(DuccWorkJob service, IRationale rationale) {
    String location = "completeService";
    DuccId jobid = service.getDuccId();
    if(service.getProcessFailureCount() > 0) {
      service.setCompletion(JobCompletionType.Warning, new Rationale("process failure(s) occurred"));
      logger.debug(location, jobid, service.getCompletionRationale().getText()+", "+"ProcessFailureCount="+service.getProcessFailureCount());
    }
    else if(service.getProcessInitFailureCount() > 0) {
View Full Code Here

    advanceToCompleted(service);
  }
 
  private void completeJob(DuccWorkJob job, IRationale rationale) {
    String location = "completeJob";
    DuccId jobid = null;
    switch(job.getCompletionType()) {
    case Undefined:
      job.setCompletion(JobCompletionType.Undefined, rationale);
      job.getStandardInfo().setDateOfCompletion(TimeStamp.getCurrentMillis());
      break;
View Full Code Here

    return retVal;
  }
 
  private void setDebugPorts(CommonConfiguration common, JobRequestProperties jobRequestProperties,  DuccWorkJob job) {
    String location = "setDebugPorts";
    DuccId jobid = job.getDuccId();
    String portDriver = jobRequestProperties.getProperty(JobSpecificationProperties.key_driver_debug);
    if(portDriver != null) {
      try {
        long port = Long.parseLong(portDriver);
        job.setDebugPortDriver(port);
View Full Code Here

    // Log directory
    driverCommandLine.setLogDirectory(jobRequestProperties.getProperty(JobSpecificationProperties.key_log_directory));
    driver.setCommandLine(driverCommandLine);
    //
    NodeIdentity nodeIdentity = hostManager.getNode();
    DuccId duccId = jdIdFactory.next();
    duccId.setFriendly(0);
    DuccProcess driverProcess = new DuccProcess(duccId,nodeIdentity,ProcessType.Pop);
    CGroupManager.assign(job.getDuccId(), driverProcess, driver_max_size_in_bytes);
    driverProcess.setResourceState(ResourceState.Allocated);
    driverProcess.setNodeIdentity(nodeIdentity);
    driver.getProcessMap().put(driverProcess.getDuccId(), driverProcess);
View Full Code Here

    DuccData duccData = DuccData.getInstance();
    ConcurrentSkipListMap<JobInfo, JobInfo> jobs = duccData.getSortedJobs();
    for(JobInfo jobInfo : jobs.descendingKeySet()) {
      DuccWorkJob job = jobInfo.getJob();
      if(job.isOperational()) {
        DuccId duccId = job.getDuccId();
        String[] dependencies = job.getServiceDependencies();
        if(dependencies != null) {
          for(String dependency : dependencies) {
            if(!map.containsKey(dependency)) {
              map.put(dependency, new ArrayList<DuccId>());
View Full Code Here

    return map;
  }
 
  private String getServiceId(DuccId serviceId) {
    String methodName = "getServiceId";
    DuccId jobid = null;
    duccLogger.trace(methodName, jobid, "enter");
    String retVal = null;
    ServicesRegistry servicesRegistry = ServicesRegistry.getInstance();
    ServicesRegistryMap map = servicesRegistry.getMap();
    for(Integer key : map.getDescendingKeySet()) {
View Full Code Here

    return retVal;
  }
 
  public TreeMap<String,ArrayList<String>> getServiceToServicesUsageMap() {
    String methodName = "getServiceToServicesUsageMap";
    DuccId jobid = null;
    duccLogger.trace(methodName, jobid, "enter");
    TreeMap<String,ArrayList<String>> map = new TreeMap<String,ArrayList<String>>();
    DuccData duccData = DuccData.getInstance();
    ConcurrentSkipListMap<JobInfo, JobInfo> jobs = duccData.getSortedServices();
    for(JobInfo jobInfo : jobs.descendingKeySet()) {
      DuccWorkJob service = jobInfo.getJob();
      if(service.isOperational()) {
        ServiceDeploymentType type = service.getServiceDeploymentType();
        if(type != null) {
          switch(type) {
          case uima:
          case custom:
            DuccId duccId = service.getDuccId();
            String serviceId = getServiceId(duccId);
            if(serviceId != null) {
              String[] dependencies = service.getServiceDependencies();
              if(dependencies != null) {
                for(String dependency : dependencies) {
View Full Code Here

TOP

Related Classes of org.apache.uima.ducc.common.utils.id.DuccId

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.