Examples of IDuccWorkJob


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

    sb.append("Id: ");
    String jobId = request.getParameter("id");
    sb.append(jobId);
    sb.append("&nbsp");
    // workitems
    IDuccWorkJob job = findJob(jobId);
    String jobWorkitemsCount = "?";
    if(job != null) {
      jobWorkitemsCount = job.getSchedulingInfo().getWorkItemsTotal();
    }
    sb.append("<th title=\"The total number of work items for this job\">");
    sb.append("Workitems: ");
    sb.append(jobWorkitemsCount);
    sb.append("&nbsp");
    // done
    sb.append("<th title=\"The number of work items that completed successfully\">");
    sb.append("Done: ");
    String done = "0";
    try {
      done = ""+job.getSchedulingInfo().getIntWorkItemsCompleted();
    }
    catch(Exception e) {
    }
    sb.append(done);
    sb.append("&nbsp");
    // error & lost
    int eCount = 0;
    int lCount = 0;
    try {
      eCount = job.getSchedulingInfo().getIntWorkItemsError();
      lCount = job.getSchedulingInfo().getIntWorkItemsLost();
    }
    catch(Exception e) {
    }
    String error = ""+eCount;
    sb.append("<th title=\"The number of work items that failed to complete successfully\">");
    sb.append("Error: ");
    sb.append(error);
    if(lCount > 0) {
      sb.append("&nbsp");
      String lost = ""+lCount;
      sb.append("<th title=\"The number of work items that were lost\">");
      sb.append("Lost: ");
      sb.append(lost);
    }
    // extended info live jobs
    sb.append("&nbsp");
    JobState jobState = JobState.Undefined;
    try {
      jobState = job.getJobState();
    }
    catch(Exception e) {
    }
    switch(jobState) {
    case Completed:
    case Undefined:
      break;
    default:
      int dispatch = 0;
      int unassigned = job.getSchedulingInfo().getCasQueuedMap().size();
      int limbo = job.getSchedulingInfo().getLimboMap().size();
      try {
        dispatch = Integer.parseInt(job.getSchedulingInfo().getWorkItemsDispatched())-unassigned;
      }
      catch(Exception e) {
      }
      // dispatch
      sb.append("<th title=\"The number of work items currently dispatched\">");
View Full Code Here

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

    response.getWriter().println(sb);
    duccLogger.trace(methodName, null, messages.fetch("exit"));
  }
 
  private IDuccWorkJob findJob(String jobno) {
    IDuccWorkJob job = null;
    DuccWorkMap duccWorkMap = DuccData.getInstance().get();
    if(duccWorkMap.getJobKeySet().size()> 0) {
      Iterator<DuccId> iterator = null;
      iterator = duccWorkMap.getJobKeySet().iterator();
      while(iterator.hasNext()) {
View Full Code Here

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

      duccLogger.info(methodName, null, messages.fetchLabel("cancel")+value);
      DuccData duccData = DuccData.getInstance();
      DuccWorkMap duccWorkMap = duccData.get();
      String text;
      String result;
      IDuccWorkJob duccWorkJob = (IDuccWorkJob) duccWorkMap.findDuccWork(DuccType.Job, value);
      if(duccWorkJob != null) {
        String resourceOwnerUserId = duccWorkJob.getStandardInfo().getUser().trim();
        if(isUserAuthorized(request,resourceOwnerUserId)) {
          String arg1 = "-"+name;
          String arg2 = value;
          String userId = duccWebSessionManager.getUserId(request);
          String cp = System.getProperty("java.class.path");
View Full Code Here

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

        duccLogger.info(methodName, null, messages.fetchLabel("cancel")+value);
        DuccData duccData = DuccData.getInstance();
        DuccWorkMap duccWorkMap = duccData.get();
        String text;
        String result;
        IDuccWorkJob duccWorkJob = (IDuccWorkJob) duccWorkMap.findDuccWork(DuccType.Service, value);
        if(duccWorkJob != null) {
          String resourceOwnerUserId = duccWorkJob.getStandardInfo().getUser().trim();
          if(isUserAuthorized(request,resourceOwnerUserId)) {
            String arg1 = "-"+name;
            String arg2 = value;
            String userId = duccWebSessionManager.getUserId(request);
            String cp = System.getProperty("java.class.path");
View Full Code Here

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

    if(workMap != null) {
      Iterator<DuccId> jobKeys = workMap.getJobKeySet().iterator();
      while(jobKeys.hasNext()) {
        DuccId jobKey = jobKeys.next();
        IDuccWork duccWork = workMap.findDuccWork(jobKey);
        IDuccWorkJob job = (IDuccWorkJob)duccWork;
        job.setCommandLine(null);
        job.getDriver().setCommandLine(null);
      }
    }
  }
View Full Code Here

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

 
    private void init(IJobDriver jd, String crxml, String crcfg, CasDispatchMap casDispatchMap) throws IOException, ResourceInitializationException, InvalidXMLException, ResourceConfigurationException {
        String location = "init";
        this.casDispatchMap = casDispatchMap;
        casLimbo = new CasLimbo(jd);
        IDuccWorkJob job = jd.getJob();
        // CR descriptor
        String crDescriptor = crxml;
        //
        // Read and parse the collection reader
        //
        XMLParser xmlParser = UIMAFramework.getXMLParser();
        XMLInputSource in = null;
    try {
      in = UimaUtils.getXMLInputSource(crDescriptor);
    } catch (InvalidXMLException e) {
            duccOut.error(location, job.getDuccId(), e);
            throw e;
    }
        ResourceSpecifier crrs = xmlParser.parseCollectionReaderDescription(in);

        duccOut.debug(location, job.getDuccId(), crcfg);
        // CR overrides
        ResourceCreationSpecifier specifier = (ResourceCreationSpecifier) crrs;
        ConfigurationParameterDeclarations configurationParameterDeclarations = specifier.getMetaData().getConfigurationParameterDeclarations();
        ConfigurationParameterSettings cps = specifier.getMetaData().getConfigurationParameterSettings();
        if(crcfg!= null) {
            // Tokenize override assignments on whitespace, honoring but stripping quotes
            // Then create a map from all of them
            ArrayList<String> toks = QuotedOptions.tokenizeList(crcfg, true);
            Map<String,String> map = QuotedOptions.parseAssignments(toks, false);
            for (Entry<String, String> ent : map.entrySet()) {
                String name = ent.getKey();
                String value = ent.getValue();
                duccOut.debug(location, job.getDuccId(), "config param name:"+name+" "+"value:"+value);
                ConfigurationParameter configurationParameter = UimaUtils.findConfigurationParameter(configurationParameterDeclarations, name);
                if (configurationParameter == null) {
                    throw new ResourceConfigurationException(
                                    ResourceConfigurationException.NONEXISTENT_PARAMETER, new Object[] { name, "CollectionReader" });
                }
                Object object = UimaUtils.getOverrideValueObject(configurationParameter, value);
                cps.setParameterValue(name, object);
            }
        }
        // CR
        duccOut.debug(location, job.getDuccId(), "CR creation...");
        cr = UIMAFramework.produceCollectionReader(crrs);
        Properties props = new Properties();
        //  Change the heap size to reduce CAS size. The size here depends on what we intend to
        //  put into the CAS. If its just a pointer to data (like question id), the size of the
        //  heap can be reduced even more
        props.setProperty(UIMAFramework.CAS_INITIAL_HEAP_SIZE, "1000");
        //  save CR type system. It will be used to initialize CASes later, in getEmptyCas()
        init(cr.getProcessingResourceMetaData().getTypeSystem(),
             cr.getProcessingResourceMetaData().getTypePriorities(),
             cr.getProcessingResourceMetaData().getFsIndexes(),
             props);
        duccOut.debug(location, job.getDuccId(), "CR created.");
    }
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.