Package org.springframework.batch.core

Examples of org.springframework.batch.core.StepExecution


        @Override
        public BaseObject preRequest(BaseObject baseObject) {
          if(baseObject.getType().equals("PartitionedStepExecutionStatusReq")) {
            StepExecutionType stepExecutionType = ((PartitionedStepExecutionStatusReq)baseObject).stepExecution;
            StepExecution convertStepExecution = JobRepositoryRpcFactory.convertStepExecutionType(stepExecutionType);
            getStepExecutions().add(convertStepExecution);
            return null;
          } else {
            return baseObject;
          }
View Full Code Here


  protected void onContainerAllocated(Container container) {
    if (log.isDebugEnabled()) {
      log.debug("Container allocated: " + container);
    }

    StepExecution stepExecution = null;

    String host = container.getNodeId().getHost();
    String rack = RackResolver.resolve(host).getNetworkLocation();
    if (log.isDebugEnabled()) {
      log.debug("Matching against host=" + host + " rack=" + rack);
View Full Code Here

  protected void onContainerCompleted(ContainerStatus status) {
    super.onContainerCompleted(status);

    // find assigned container for step execution
    ContainerId containerId = status.getContainerId();
    StepExecution stepExecution = containerToStepMap.get(containerId);

    if (stepExecution != null) {
      for (Entry<StepExecution, Set<StepExecution>> entry : masterExecutions.entrySet()) {
        Set<StepExecution> set = entry.getValue();
        if (set.remove(stepExecution)) {
View Full Code Here

    if(log.isDebugEnabled()) {
      log.debug("Intercept launch context: " + context);
    }

    StepExecution stepExecution = containerToStepMap.get(container.getId());
    String jobName = remoteStepNames.get(stepExecution);

    if(service != null) {
      int port = service.getPort();
      String address = service.getHost();
      Map<String, String> env = new HashMap<String, String>(context.getEnvironment());
      env.put(YarnSystemConstants.FS_ADDRESS, getConfiguration().get(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY));
      env.put(YarnSystemConstants.AMSERVICE_PORT, Integer.toString(port));
      env.put(YarnSystemConstants.AMSERVICE_HOST, address);
      env.put(YarnSystemConstants.AMSERVICE_BATCH_STEPNAME, jobName);
      env.put(YarnSystemConstants.AMSERVICE_BATCH_STEPNAME, jobName);
      env.put(YarnSystemConstants.AMSERVICE_BATCH_STEPEXECUTIONNAME, stepExecution.getStepName());
      env.put(YarnSystemConstants.AMSERVICE_BATCH_JOBEXECUTIONID, Long.toString(stepExecution.getJobExecutionId()));
      env.put(YarnSystemConstants.AMSERVICE_BATCH_STEPEXECUTIONID, Long.toString(stepExecution.getId()));
      context.setEnvironment(env);
      return context;
    } else {
      return context;
    }
View Full Code Here

    return responseObj;
  }

  private BaseResponseObject handleGetStepExecutionReq(GetStepExecutionReq request) {
    GetStepExecutionRes response = new GetStepExecutionRes();
    StepExecution stepExecution = jobExplorer.getStepExecution(request.jobExecutionId, request.stepExecutionId);
    response.stepExecution = JobRepositoryRpcFactory.convertStepExecutionType(stepExecution);
    return response;
  }
View Full Code Here

    return response;
  }

  private BaseResponseObject handleAddWithStepExecutionReq(AddWithStepExecutionReq request) {
    AddWithStepExecutionRes response = null;
    StepExecution stepExecution = JobRepositoryRpcFactory.convertStepExecutionType(request.stepExecution);
    jobRepository.add(stepExecution);
    response = new AddWithStepExecutionRes();
    response.id = stepExecution.getId();
    response.version = stepExecution.getVersion();
    return response;
  }
View Full Code Here

  }

  private BaseResponseObject handleGetLastStepExecutionReq(GetLastStepExecutionReq request) {
    GetLastStepExecutionRes response = null;
    JobInstance jobInstance = JobRepositoryRpcFactory.convertJobInstanceType(request.jobInstance);
    StepExecution lastStepExecution = jobRepository.getLastStepExecution(jobInstance, request.stepName);
    response = new GetLastStepExecutionRes();
    response.stepExecution = JobRepositoryRpcFactory.convertStepExecutionType(lastStepExecution);
    return response;
  }
View Full Code Here

    return response;
  }

  private BaseResponseObject handleUpdateWithStepExecutionReq(UpdateWithStepExecutionReq request) {
    UpdateWithStepExecutionRes response = null;
    StepExecution stepExecution = JobRepositoryRpcFactory.convertStepExecutionType(request.stepExecution);
    jobRepository.update(stepExecution);
    response = new UpdateWithStepExecutionRes();
    response.id = stepExecution.getId();
    response.version = stepExecution.getVersion();
    return response;
  }
View Full Code Here

  private BaseResponseObject handleUpdateExecutionContext(UpdateExecutionContextReq request) {
    UpdateExecutionContextRes response = null;
    try {
      if(request.stepExecution != null) {
        StepExecution stepExecution = JobRepositoryRpcFactory.convertStepExecutionType(request.stepExecution);
        jobRepository.updateExecutionContext(stepExecution);
      } else if(request.jobExecution != null) {
        JobExecution jobExecution = JobRepositoryRpcFactory.convertJobExecutionType(request.jobExecution);
        jobRepository.updateExecutionContext(jobExecution);
      }
View Full Code Here

        job.setRestartable(true);
        StepSupport step = new StepSupport("restartedStep");

        // first execution
        JobExecution firstJobExec = jobRepository.createJobExecution(job.getName(), jobParameters);
        StepExecution firstStepExec = new StepExecution(step.getName(), firstJobExec);
        jobRepository.add(firstStepExec);

        assertEquals(1, jobRepository.getStepExecutionCount(firstJobExec.getJobInstance(), step.getName()));
        assertEquals(firstStepExec, jobRepository.getLastStepExecution(firstJobExec.getJobInstance(), step.getName()));

        // first execution failed
        firstJobExec.setStartTime(new Date(4));
        firstStepExec.setStartTime(new Date(5));
        firstStepExec.setStatus(BatchStatus.FAILED);
        firstStepExec.setEndTime(new Date(6));
        jobRepository.update(firstStepExec);
        firstJobExec.setStatus(BatchStatus.FAILED);
        firstJobExec.setEndTime(new Date(7));
        jobRepository.update(firstJobExec);

        // second execution
        JobExecution secondJobExec = jobRepository.createJobExecution(job.getName(), jobParameters);
        StepExecution secondStepExec = new StepExecution(step.getName(), secondJobExec);
        jobRepository.add(secondStepExec);

        assertEquals(2, jobRepository.getStepExecutionCount(secondJobExec.getJobInstance(), step.getName()));
        assertEquals(secondStepExec, jobRepository.getLastStepExecution(secondJobExec.getJobInstance(), step.getName()));
    }
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.StepExecution

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.