Examples of JobParameter


Examples of org.springframework.batch.core.JobParameter

         throw ClusterManagerException
               .SET_MANUAL_ELASTICITY_NOT_ALLOWED_ERROR(msg);
      }

      Map<String, JobParameter> param = new TreeMap<String, JobParameter>();
      param.put(JobConstants.TIMESTAMP_JOB_PARAM, new JobParameter(new Date()));
      param.put(JobConstants.CLUSTER_NAME_JOB_PARAM, new JobParameter(
            clusterName));
      // TODO: transfer SET_TARGET/UNLIMIT from CLI directly
      if (activeComputeNodeNum == null) {
         param.put(JobConstants.VHM_ACTION_JOB_PARAM, new JobParameter(
               LimitInstruction.actionWaitForManual));
      } else if (activeComputeNodeNum == -1) {
         param.put(JobConstants.VHM_ACTION_JOB_PARAM, new JobParameter(
               LimitInstruction.actionUnlimit));
      } else {
         param.put(JobConstants.VHM_ACTION_JOB_PARAM, new JobParameter(
               LimitInstruction.actionSetTarget));
      }
      if (activeComputeNodeNum != null) {
         param.put(JobConstants.ACTIVE_COMPUTE_NODE_NUMBER_JOB_PARAM,
               new JobParameter(Long.valueOf(activeComputeNodeNum)));
      }
      param.put(JobConstants.CLUSTER_SUCCESS_STATUS_JOB_PARAM,
            new JobParameter(ClusterStatus.RUNNING.name()));
      param.put(JobConstants.CLUSTER_FAILURE_STATUS_JOB_PARAM,
            new JobParameter(ClusterStatus.RUNNING.name()));
      JobParameters jobParameters = new JobParameters(param);
      try {
         clusterEntityMgr.updateClusterStatus(clusterName,
               ClusterStatus.VHM_RUNNING);
         return jobManager.runJob(JobConstants.SET_MANUAL_ELASTICITY_JOB_NAME,
View Full Code Here

Examples of org.springframework.batch.core.JobParameter

                           + stepNumber);
         for (int count = 0; count < jobParametersNumber; count++) {
            String key =
                  jobParameters.getString(JobUtils.getSubJobParameterPrefixKey(
                        stepNumber, count));
            JobParameter parameterValue =
                  jobParametersMap.get(JobUtils.getSubJobParameterPrefixValue(
                        stepNumber, count));
            subJobParameters.put(key, parameterValue);
         }
      }
      subJobParameters.put(JobConstants.TIMESTAMP_JOB_PARAM, new JobParameter(
            new Date()));
      return new JobParameters(subJobParameters);
   }
View Full Code Here

Examples of org.springframework.batch.core.JobParameter

         String subJobName, ClusterStatus successStatus,
         ClusterStatus failStatus) throws Exception {
      logger.debug("::runJobWithSubJob: " + jobName + ", subJobName: "
            + subJobName);
      long result = Long.MIN_VALUE;
      JobParameter clusterNameParameter =
            param.getParameters().get(JobConstants.CLUSTER_NAME_JOB_PARAM);
      String clusterName = (String) clusterNameParameter.getValue();
      Job preparingJob = jobRegistry.getJob(jobName);
      JobExecution preparingJobExecution = jobLauncher.run(preparingJob, param);
      int subJobNumber = 0;
      waitJobExecution(preparingJobExecution.getId(), Long.MAX_VALUE);
      if (preparingJobExecution.getStatus() == BatchStatus.COMPLETED) {
View Full Code Here

Examples of org.springframework.batch.core.JobParameter

                  + "-" + System.nanoTime());
      //SimpleJob mainJob = new SimpleJob("composed-job-" + clusterName + "-" + subJobName);
      StepExecutionListener[] jobStepListeners = createJobStepListener();
      Map<String, JobParameter> mainJobParams =
            new TreeMap<String, JobParameter>();
      mainJobParams.put(JobConstants.TIMESTAMP_JOB_PARAM, new JobParameter(
            new Date()));
      mainJobParams.put(JobConstants.CLUSTER_NAME_JOB_PARAM, new JobParameter(
            clusterName));
      mainJobParams.put(JobConstants.CLUSTER_SUCCESS_STATUS_JOB_PARAM,
            new JobParameter(successStatus.name()));
      mainJobParams.put(JobConstants.CLUSTER_FAILURE_STATUS_JOB_PARAM,
            new JobParameter(failStatus.name()));
      //enable sub job indicator to for job progress query
      mainJobParams.put(JobConstants.SUB_JOB_ENABLED, new JobParameter(1l));
      Job subJob = jobRegistry.getJob(subJobName);
      for (int stepNumber = 0, j = subJobParameters.size(); stepNumber < j; stepNumber++) {
         SubJobStep subJobStep = new SubJobStep();
         subJobStep.setName(subJobName + "-subJobStep-" + stepNumber);
         subJobStep.setJob(subJob);
         subJobStep.setJobParametersExtractor(jobParametersExtractor);
         subJobStep.setJobExecutionStatusHolder(jobExecutionStatusHolder);
         subJobStep
               .setMainJobExecutionStatusHolder(mainJobExecutionStatusHolder);
         subJobStep.setJobLauncher(jobLauncher);
         subJobStep.setJobRepository(jobRepository);
         subJobStep.setStepExecutionListeners(jobStepListeners);
         subJobStep.afterPropertiesSet();
         mainJob.addStep(subJobStep);
         logger.debug("added sub job step: " + subJobStep.getName());
         int subJobParametersNumber =
               subJobParameters.get(stepNumber).getParameters().keySet().size();
         mainJobParams.put(JobConstants.SUB_JOB_PARAMETERS_NUMBER + stepNumber,
               new JobParameter((long) subJobParametersNumber));
         int count = 0;
         for (String key : subJobParameters.get(stepNumber).getParameters()
               .keySet()) {
            int index = count++;
            mainJobParams.put(
                  JobUtils.getSubJobParameterPrefixKey(stepNumber, index),
                  new JobParameter(key));
            mainJobParams.put(
                  JobUtils.getSubJobParameterPrefixValue(stepNumber, index),
                  subJobParameters.get(stepNumber).getParameters().get(key));
         }
      }
View Full Code Here

Examples of org.springframework.batch.core.JobParameter

public class TestJobManager {
   static final Logger logger = Logger.getLogger(TestJobManager.class);

   public static JobParameters createClusterCreateParameters(String name) {
      Map<String, JobParameter> param = new TreeMap<String, JobParameter>();
      param.put("cluster.name", new JobParameter(name));
      return new JobParameters(param);
   }
View Full Code Here

Examples of org.springframework.batch.core.JobParameter

    JobParametersIncrementer {

  public JobParameters getNext(JobParameters parameters) {
    Map<String, JobParameter> map = new HashMap<String, JobParameter>(
        parameters.getParameters());
    map.put("run.count", new JobParameter(parameters
        .getLong("run.count", -1)+1));
    return new JobParameters(map);
  }
View Full Code Here

Examples of org.springframework.batch.core.JobParameter

  @Test
  @DirtiesContext
  public void testFailedStep() throws Exception {
    JobExecution jobExecution = jobLauncher.run(job, new JobParameters(Collections.singletonMap("item.three",
        new JobParameter("unsupported"))));
    assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
    StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
    assertEquals(9, stepExecution.getReadCount());
    // In principle the write count could be more than 2 and less than 9...
    assertEquals(7, stepExecution.getWriteCount());
View Full Code Here

Examples of org.springframework.batch.core.JobParameter

  @Test
  @DirtiesContext
  public void testFailedStepOnError() throws Exception {
    JobExecution jobExecution = jobLauncher.run(job, new JobParameters(Collections.singletonMap("item.three",
        new JobParameter("error"))));
    assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
    StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
    assertEquals(9, stepExecution.getReadCount());
    // In principle the write count could be more than 2 and less than 9...
    assertEquals(7, stepExecution.getWriteCount());
View Full Code Here

Examples of org.springframework.batch.core.JobParameter

  @Test
  @DirtiesContext
  public void testSunnyDayFaultTolerant() throws Exception {
    JobExecution jobExecution = jobLauncher.run(job, new JobParameters(Collections.singletonMap("item.three",
        new JobParameter("3"))));
    assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
    StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
    assertEquals(9, stepExecution.getReadCount());
    assertEquals(9, stepExecution.getWriteCount());
  }
View Full Code Here

Examples of org.springframework.batch.core.JobParameter

  }

  @Test
  public void testFailedStep() throws Exception {
    JobExecution jobExecution = jobLauncher.run(job, new JobParameters(Collections.singletonMap("item.three",
        new JobParameter("unsupported"))));
    assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
    StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
    assertEquals(9, stepExecution.getReadCount());
    // In principle the write count could be more than 2 and less than 9...
    assertEquals(7, stepExecution.getWriteCount());
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.