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

Examples of org.apache.uima.ducc.transport.event.common.IDuccState.JobState


          }
          // state: Received
          stateJobAccounting.stateChange(duccWorkJob, JobState.Received);
          OrchestratorCheckpoint.getInstance().saveState();
          // state: WaitingForServices
          JobState nextState = JobState.WaitingForServices;
          if(duccWorkJob.getServiceDependencies() == null) {
            String message = messages.fetch("bypass")+" "+nextState;
            logger.debug(methodName, duccWorkJob.getDuccId(), message);
            nextState = JobState.WaitingForResources;
          }
View Full Code Here


          case NotRunning:
            break;
          case Initializing: 
            switch(duccWorkJob.getJobState()) {
            case WaitingForDriver:
              JobState nextState = JobState.WaitingForServices;
              if(duccWorkJob.getServiceDependencies() == null) {
                String message = messages.fetch("bypass")+" "+nextState;
                logger.debug(methodName, duccId, message);
                nextState = JobState.WaitingForResources;
              }
View Full Code Here

            logger.debug(methodName, duccId, messages.fetch("processing job..."));
            DuccWorkJob duccWorkJob = (DuccWorkJob) duccWork;
            processPurger(duccWorkJob,rmResourceState.getResources());
            changes += processMapResourcesAdd(duccWorkJob,rmResourceState.getPendingAdditions());
            changes += processMapResourcesDel(duccWorkJob,rmResourceState.getPendingRemovals());
            JobState jobState = duccWorkJob.getJobState();
            logger.debug(methodName, duccId, messages.fetchLabel("job state")+jobState);
            switch(jobState) {
            case Received:
            case WaitingForDriver:
              logger.warn(methodName, duccId, messages.fetchLabel("unexpected state")+jobState);
              break;
            case WaitingForServices:
              logger.debug(methodName, duccId, messages.fetchLabel("unexpected state")+jobState);
              break;
            case WaitingForResources:
              if(rmResourceState.isRefused()) {
                duccWorkJob.getStandardInfo().setDateOfCompletion(TimeStamp.getCurrentMillis());
                duccWorkJob.setCompletionType(JobCompletionType.ResourcesUnavailable);
                duccWorkJob.setCompletionRationale(new Rationale("resource manager refused allocation: "+rmResourceState.getReason()));
                changes += stateChange(duccWorkJob,JobState.Completed);
                logger.warn(methodName, duccId, messages.fetchLabel("refused")+rmResourceState.getReason());
                String userName = duccWorkJob.getStandardInfo().getUser();
                String userLogDir = duccWorkJob.getUserLogsDir()+duccWorkJob.getDuccId().getFriendly()+File.separator;;
                String text = rmResourceState.getReason();
                UserLogging.record(userName, userLogDir, text);
              }
              if(duccWorkJob.getProcessMap().size() > 0) {
                changes += stateChange(duccWorkJob,JobState.Initializing);
                logger.info(methodName, duccId, messages.fetchLabel("resources count")+duccWorkJob.getProcessMap().size());
              }
              break;
            case Initializing:
            case Running:
              if(duccWorkJob.getProcessMap().size() == 0) {
                changes += stateChange(duccWorkJob,JobState.WaitingForResources);
                logger.info(methodName, duccId, messages.fetchLabel("resources count")+duccWorkJob.getProcessMap().size());
              }
              break;
            case Completing:
            case Completed:
              logger.debug(methodName, duccId, messages.fetchLabel("unsuitable state")+jobState);
              break;
            case Undefined:
              logger.warn(methodName, duccId, messages.fetchLabel("unsuitable state")+jobState);
              break;
            }
            break;
          case Reservation:
            logger.debug(methodName, duccId, messages.fetch("processing reservation..."));
            DuccWorkReservation duccWorkReservation = (DuccWorkReservation) duccWork;
            changes += reservationMapResourcesAdd(duccWorkReservation,rmResourceState.getPendingAdditions());
            changes += reservationMapResourcesDel(duccWorkReservation,rmResourceState.getPendingRemovals());
            ReservationState reservationState = duccWorkReservation.getReservationState();
            switch(reservationState) {
            case Received:
              logger.warn(methodName, duccId, messages.fetchLabel("unexpected state")+reservationState);
              break;
            case WaitingForResources:
              if(rmResourceState.isRefused()) {
                String schedulingClass = duccWorkReservation.getSchedulingInfo().getSchedulingClass().trim();
                if(schedulingClass.equals(DuccSchedulerClasses.JobDriver)) {
                  if(!refusedLogged.get()) {
                    logger.warn(methodName, duccId, messages.fetchLabel("refusal ignored")+rmResourceState.getReason());
                    refusedLogged.set(true);
                  }
                }
                else {
                  duccWorkReservation.getStandardInfo().setDateOfCompletion(TimeStamp.getCurrentMillis());
                  duccWorkReservation.setCompletionType(ReservationCompletionType.ResourcesUnavailable);
                  duccWorkReservation.setCompletionRationale(new Rationale("resource manager refused allocation: "+rmResourceState.getReason()));
                  changes += stateChange(duccWorkReservation,ReservationState.Completed);
                  logger.warn(methodName, duccId, messages.fetchLabel("refused")+rmResourceState.getReason());
                }
              }
              else {
                if(rmResourceState.getResources() != null) {
                  if(!rmResourceState.getResources().isEmpty()) {
                    changes += stateChange(duccWorkReservation,ReservationState.Assigned);
                    logger.info(methodName, duccId, messages.fetchLabel("resources count")+rmResourceState.getResources().size());
                  }
                }
                else {
                  logger.info(methodName, duccId, messages.fetch("waiting...no resources?"));
                }
              }
              break;
            case Assigned:
              if(rmResourceState.getResources() != null) {
                if(rmResourceState.getResources().isEmpty()) {
                  changes += stateChange(duccWorkReservation,ReservationState.Completed);
                  logger.info(methodName, duccId, messages.fetchLabel("resources count")+rmResourceState.getResources().size());
                }
              }
              else {
                logger.info(methodName, duccId, messages.fetch("assigned...no resources?"));
              }
              break;
            case Completed:
              logger.debug(methodName, duccId, messages.fetchLabel("unsuitable state")+reservationState);
              break;
            case Undefined:
              logger.warn(methodName, duccId, messages.fetchLabel("unsuitable state")+reservationState);
              break;
            }
            break;
          case Service:
            logger.debug(methodName, duccId, messages.fetch("processing service..."));
            DuccWorkJob duccWorkService = (DuccWorkJob) duccWork;
            processPurger(duccWorkService,rmResourceState.getResources());
            changes += processMapResourcesAdd(duccWorkService,rmResourceState.getPendingAdditions());
            changes += processMapResourcesDel(duccWorkService,rmResourceState.getPendingRemovals());
            JobState serviceState = duccWorkService.getJobState();
            logger.debug(methodName, duccId, messages.fetchLabel("service state")+serviceState);
            switch(serviceState) {
            case Received:
              logger.warn(methodName, duccId, messages.fetchLabel("unexpected state")+serviceState);
              break;
View Full Code Here

      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();
          switch(jobState) {
          case Received:
            logger.warn(methodName, duccId, messages.fetchLabel("unexpected job state")+jobState);
            break;
View Full Code Here

                //
                // I suppose the ServiceManagerHandler could easily track the per-process state change - we'd have to
                // modify the thing in the map it passes in to show 'before' and 'after' states instead of just passing
                // in the DuccWork thing.
                //
                JobState          state = w.getJobState();
                if ( state == JobState.Running ) {         // only if we confirm it's alive
                    sset.resetRunFailures();
                }
            } else {
                JobState          state = w.getJobState();
               
                if ( state == JobState.Completed ) {
                    sset.removeImplementor(id);
                    JobCompletionType jct = w.getCompletionType();
                       
View Full Code Here

      switch(duccType) {
      case Service:
        ServiceDeploymentType sdt = job.getServiceDeploymentType();
        switch(sdt) {
        case other:
          JobState state = job.getJobState();
          switch(state) {
          case Initializing:
            JobState next = JobState.Running;
            JobState prev = state;
            logger.info(methodName, job.getDuccId(),"current["+next+"] previous["+prev+"]"+" "+"-> skipped");
            retVal = stateChange(job, next);
            break;
          default:
            logger.debug(methodName, job.getDuccId(), "State is not "+JobState.Initializing+" state");
View Full Code Here

  }
 
  public boolean stateChange(IDuccWorkJob job, JobState state) {
    String methodName = "stateChange";
    boolean retVal = false;
    JobState prev = job.getJobState();
    JobState next = state;
    switch(prev) {
    case Completing:
      retVal = stateChangeFromCompleting(prev, next);
      break;
    case Completed:
View Full Code Here

    try {
      jobid = job.getDuccId();
      String userName = job.getStandardInfo().getUser();
      String userLogDir = job.getUserLogsDir()+job.getDuccId().getFriendly()+File.separator;
      UserLogging userLogging = new UserLogging(userName, userLogDir);
      JobState jobState = job.getJobState();
      if(jobState != null) {
        text = jobState.toString();
        userLogging.toUserDuccLog(text);
        logger.debug(methodName, job.getDuccId(), text);
      }
    }
    catch(Exception e) {
View Full Code Here

        // first loop synchronized 'friendly_ids' with live jobs comining in
        for ( DuccId id : work.keySet() ) {

            long fid = id.getFriendly();
            if ( friendly_ids.containsKey(fid) ) {
                JobState js = work.get(id);
                implementors.put(id, js);
                newmap.put(fid, id);
            }
        }
View Full Code Here

      sb.append("Lost: ");
      sb.append(lost);
    }
    // extended info live jobs
    sb.append("&nbsp");
    JobState jobState = JobState.Undefined;
    try {
      jobState = job.getJobState();
    }
    catch(Exception e) {
    }
View Full Code Here

TOP

Related Classes of org.apache.uima.ducc.transport.event.common.IDuccState.JobState

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.