Examples of BatchProcessor


Examples of eu.planets_project.tb.api.system.batch.BatchProcessor

          return;
        }
      
        //3. get the BatchProcessing system that's notified
        TestbedBatchProcessorManager batchManager = TestbedBatchProcessorManager.getInstance();
        BatchProcessor bp = batchManager.getBatchProcessor(batchProcessorID);
       
        //check rollback and if batch processor has persistent jobs
        if((bp.getJob(ticket)==null) || (bp.getJobStatus(ticket).equals(TestbedBatchJob.NO_SUCH_JOB ))){
          log.debug("EJBTransactionRollback - BatchProcessor no persistent job - dropp job: "+ticket);
          return;
        }
       
        //4. check for updates and store extracted information in experiment
        long t0 = System.currentTimeMillis();
        long t1 = System.currentTimeMillis();
       
        boolean bInfomredStarted = false;
        //do until we have reached our time-out time or completed
        while(t1-t0<timeOutMillis){
       
          //a) check started
          //use batchProcessor specific implementation for checking on this.
          boolean bStarted = bp.isStarted(ticket);
          if(bStarted){
            if(!bInfomredStarted){
              //callback: inform once about started
              bp.notifyStart(ticket, bp.getJob(ticket));
              log.debug("BatchExecutionListener: notify STARTED for: "+ticket);
              bInfomredStarted=true;
            }
           
            if(bp.isRunning(ticket)){
              TestbedBatchJob job = bp.getJob(ticket);
              job.setStatus(TestbedBatchJob.RUNNING);
              bp.notifyRunning(ticket, job);
              log.debug("BatchExecutionListener: notify RUNNING for: "+ticket);

            }
           
            if(bp.isUpdated(ticket)){
              bp.notifyUpdate(ticket, bp.getJob(ticket));
              log.debug("BatchExecutionListener: notify UPDATE for: "+ticket);

            }
           
            if(bp.isFailed(ticket)){
              TestbedBatchJob job = bp.getJob(ticket);
              job.setStatus(TestbedBatchJob.FAILED);
              bp.notifyFailed(ticket, job);
              log.debug("BatchExecutionListener: notify FAILED for: "+ticket);

            }
           
            //check if completed
            if(bp.isCompleted(ticket)){
              TestbedBatchJob job = bp.getJob(ticket);
              job.setStatus(TestbedBatchJob.DONE);
              bp.notifyComplete(ticket, job);
              log.debug("BatchExecutionListener: notify COMPLETE for: "+ticket);

              return;
            }
           
          }
         
          //status is: still no completed - sleep and repoll
            try {
              Thread.sleep(sleep);
        } catch (InterruptedException e) {
          log.debug("Error while waiting for ticket: "+ticket, e);
          TestbedBatchJob job = bp.getJob(ticket);
          job.setStatus(TestbedBatchJob.FAILED);
          bp.notifyFailed(ticket, job);
          return;
        }
        t1 = System.currentTimeMillis();
        }
       
        //b) in this case a time-out occurred
        TestbedBatchJob job = bp.getJob(ticket);
    job.setStatus(TestbedBatchJob.FAILED);
    job.setWorkflowFailureReport(new String("BatchExperimentListener with timeout of "+timeOutMillis/1000+" Sec. has timed-out. This normally indicates a failure within the remote workflow execution processor"));
    bp.notifyFailed(ticket, job);
    log.debug("BatchExecutionListener: notify FAILED due to time-out for: "+ticket);
  }
View Full Code Here

Examples of eu.planets_project.tb.api.system.batch.BatchProcessor

      String ret = "";
          ExperimentBean expBean = (ExperimentBean)JSFUtil.getManagedObject("ExperimentBean");
          refreshExperimentBean();
          Experiment exp = expBean.getExperiment();
      //get the batch processor that's responsible for this job
          BatchProcessor pb = TestbedBatchProcessorManager.getInstance().getBatchProcessor(exp.getExperimentExecutable().getBatchSystemIdentifier());
          String job_key = exp.getExperimentExecutable().getBatchExecutionIdentifier();
          log.info("Looking for experiment position under job key: "+job_key+" : " + pb.getPositionInQueue(job_key));
          ret+=pb.getPositionInQueue(job_key);
          return ret;
    }
View Full Code Here

Examples of eu.planets_project.tb.api.system.batch.BatchProcessor

          if( exp.getExperimentExecutable().isExecutionCompleted() ) return 101;
         
          log.info("Still looking for..."+exp.getExperimentExecutable().getBatchExecutionIdentifier());
        
          //get the batch processor that's responsible for this job
          BatchProcessor pb = TestbedBatchProcessorManager.getInstance().getBatchProcessor(exp.getExperimentExecutable().getBatchSystemIdentifier());
          String job_key = exp.getExperimentExecutable().getBatchExecutionIdentifier();
          log.info("Looking for experiment progress under job key: "+job_key+" : " + pb.getJobStatus(job_key));
         
          if( pb.getJobStatus(job_key).equals(TestbedBatchJob.NO_SUCH_JOB ) ) {
              log.info("Got No Such Job for key: "+job_key);
              exp.getExperimentExecutable().setExecutionSuccess(false);
              exp.getExperimentExecutable().setExecutionCompleted(true);
              exp.getExperimentExecution().setState(Experiment.STATE_COMPLETED);
              exp.getExperimentEvaluation().setState(Experiment.STATE_IN_PROGRESS);  
              testbedMan.updateExperiment(exp);
              return -1;
          } else if( pb.getJobStatus(job_key).equals(TestbedBatchJob.NOT_STARTED) ) {
              log.info("Got NOT STARTED for key: "+job_key);
              return 0;
          } else if( pb.getJobStatus(job_key).equals(TestbedBatchJob.RUNNING) ) {
              int percent = pb.getJobPercentComplete(job_key);
              // Return percentage:
              log.info("Got percent complete:" + percent+" for key: "+job_key);
              return percent;

          } else {
View Full Code Here

Examples of eu.planets_project.tb.api.system.batch.BatchProcessor

          else{
            return "not supported";
          }
         
          //get the batch processor that's responsible for this job
          BatchProcessor pb = TestbedBatchProcessorManager.getInstance().getBatchProcessor(exp.getExperimentExecutable().getBatchSystemIdentifier());
          String job_key = exp.getExperimentExecutable().getBatchExecutionIdentifier();
          log.info("Looking for current position on batch processor for job key: "+job_key+" : " + pb.getJobStatus(job_key));
         
          if( pb.getJobStatus(job_key).equals(TestbedBatchJob.NO_SUCH_JOB ) ) {
              log.info("Got No Such Job.");
              return "not supported";
          }else {
              String positionMessage = pb.getPositionInQueue(job_key);
              log.debug("Returning current position on batch processor for job key: "+job_key+" position: " + positionMessage);
              return positionMessage;
          }
    }
View Full Code Here

Examples of eu.planets_project.tb.api.system.batch.BatchProcessor

          if( exp.getExperimentExecutable() ==  null ) {
              return false;
          }
          else{
        //get the batch processor that's responsible for this job
            BatchProcessor pb = TestbedBatchProcessorManager.getInstance().getBatchProcessor(exp.getExperimentExecutable().getBatchSystemIdentifier());
            String job_key = exp.getExperimentExecutable().getBatchExecutionIdentifier();
            if( pb.getJobStatus(job_key).equals(TestbedBatchJob.NO_SUCH_JOB ) ) {
                log.info("Got No Such Job.");
                return false;
            }else {
                return pb.isQueued(job_key);
            }
          }
    }
View Full Code Here

Examples of eu.planets_project.tb.api.system.batch.BatchProcessor

   
   public String commandPullInWFResultsAfterFailure(){
         ExperimentBean expBean = (ExperimentBean)JSFUtil.getManagedObject("ExperimentBean");
         Experiment exp = expBean.getExperiment();
         //get the batch processor that's responsible for this job
         BatchProcessor pb = TestbedBatchProcessorManager.getInstance().getBatchProcessor(exp.getExperimentExecutable().getBatchSystemIdentifier());
         String job_key = exp.getExperimentExecutable().getBatchExecutionIdentifier();
        
         //clean out the old BatchExecutionRecords (as Measurements, etc.)
         Iterator<BatchExecutionRecordImpl> iter = exp.getExperimentExecutable().getBatchExecutionRecords().iterator();
         while(iter.hasNext()) {
           iter.next();
           iter.remove();
         } //FIXME: this isn't properly updated in the db and the old records don't get deleted
        
         //now call the notifyComplete to pull in the results
         pb.notifyComplete(job_key, pb.getJob(job_key));
    return "success";
   }
View Full Code Here

Examples of eu.planets_project.tb.api.system.batch.BatchProcessor

      }
     
      //DECIDE UPON WHICH BATCH_QUEUE WAS CHOSEN WHAT PROCESSOR TO CALL
      // Look for the batch system...
      TestbedBatchProcessorManager tbBatchManager = TestbedBatchProcessorManager.getInstance();
      BatchProcessor bp;
     
      //a) TB-experiment types before version1.0 - these use the ExperimentWorkflow
      if(executable.getBatchSystemIdentifier().equals(BatchProcessor.BATCH_IDENTIFIER_TESTBED_LOCAL)){
        //get the specific batchProcessor implementation
        bp = tbBatchManager.getBatchProcessor(BatchProcessor.BATCH_IDENTIFIER_TESTBED_LOCAL);
        // Invoke, depending on the experiment type:
        ExperimentWorkflow ewf = executable.getWorkflow();
        log.info("Submitting workflow: "+ewf+" to batch processor: "+BatchProcessor.BATCH_IDENTIFIER_TESTBED_LOCAL);
        log.info("Got inputs #"+executable.getInputData().size());
        String queue_key = bp.submitBatch( exp.getEntityID(), ewf , executable.getInputData());
        //already set: executable.setBatchQueueIdentifier(BatchProcessor.BATCH_QUEUE_TESTBED_LOCAL);
        executable.setBatchExecutionIdentifier(queue_key);
              executable.setExecutableInvoked(true);
              executable.setExecutionCompleted(false);
              log.info("Got key: "+queue_key);
      }
     
      //b) TB-experiment types using the wee batch processor
      if(executable.getBatchSystemIdentifier().equals(BatchProcessor.BATCH_QUEUE_TESTBED_WEE_LOCAL)){
        //get the specific batchProcessor implementation
        bp = tbBatchManager.getBatchProcessor(BatchProcessor.BATCH_QUEUE_TESTBED_WEE_LOCAL);
        log.info("Submitting workflow to batch processor: "+BatchProcessor.BATCH_QUEUE_TESTBED_WEE_LOCAL);
        log.info("Got inputs #"+executable.getInputData().size());
        //DataHandler dh = new DataHandlerImpl();
        //NOTE: previously submitting digital objects...
        //List<DigitalObject> digos = dh.convertFileRefsToURLAccessibleDigos(executable.getInputData());
        //submit the batch process to the WEE
        //String queue_key = bp.sumitBatch(exp.getEntityID(), digos, executable.getWEEWorkflowConfig());
       
        //NOTE: changed to submitting by data registry references..
        //submit the batch process to the WEE passing objects by reference (shared data registry pointers)
        List<URI> digoRefs = new ArrayList<URI>();
        for(String inputDataRef : executable.getInputData()){
          try{
            digoRefs.add(new URI(inputDataRef));
          }catch(URISyntaxException err){
            log.debug("this shouldn't happen - conversion String -> URI failed for "+inputDataRef);
          }
        }
        String queue_key = bp.sumitBatchByReference(exp.getEntityID(), digoRefs, executable.getWEEWorkflowConfig());
       
        if((queue_key!=null)&&(!queue_key.equals(""))){
          executable.setBatchExecutionIdentifier(queue_key);
          //executable.setExecutableInvoked(true);
                executable.setExecutionCompleted(false);
View Full Code Here

Examples of org.apache.olingo.odata2.api.processor.part.BatchProcessor

        .thenAnswer(getAnswer());

    MetadataProcessor metadata = mock(MetadataProcessor.class);
    when(metadata.readMetadata(any(UriInfoImpl.class), anyString())).thenAnswer(getAnswer());

    BatchProcessor batch = mock(BatchProcessor.class);
    when(batch.executeBatch(any(BatchHandler.class), anyString(), any(InputStream.class))).thenAnswer(getAnswer());

    FunctionImportProcessor functionImport = mock(FunctionImportProcessor.class);
    when(functionImport.executeFunctionImport(any(UriInfoImpl.class), anyString())).thenAnswer(getAnswer());

    FunctionImportValueProcessor functionImportValue = mock(FunctionImportValueProcessor.class);
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.