Package org.springframework.yarn.batch.repository.bindings.repo

Examples of org.springframework.yarn.batch.repository.bindings.repo.CreateJobExecutionRes


    Assert.notNull(jobParameters, "JobParameters must not be null.");

    JobExecution jobExecution = null;
    try {
      CreateJobExecutionReq request = JobRepositoryRpcFactory.buildCreateJobExecutionReq(jobName, jobParameters);
      CreateJobExecutionRes response = (CreateJobExecutionRes) getAppmasterScOperations().doMindRequest(request);
      jobExecution = JobRepositoryRpcFactory.convertJobExecutionType(response.jobExecution);
    } catch (Exception e) {
      throw convertException(e);
    }
    return jobExecution;
View Full Code Here


    response = new IsJobInstanceExistsRes(jobInstanceExists);
    return response;
  }

  private BaseResponseObject handleCreateJobExecutionReq(CreateJobExecutionReq request)  {
    CreateJobExecutionRes response = null;

    String jobName = request.jobName;

    Map<String, JobParameter> map = new HashMap<String, JobParameter>();
    for(Entry<String, JobParameterType> entry : request.jobParameters.entrySet()) {
      ParameterType parameterType = entry.getValue().parameterType;
      if(parameterType == ParameterType.DATE) {
        if(entry.getValue().parameter instanceof Integer) {
          map.put(entry.getKey(), new JobParameter(new Date((Integer)entry.getValue().parameter)));
        } else if(entry.getValue().parameter instanceof Date) {
          map.put(entry.getKey(), new JobParameter(((Date)entry.getValue().parameter)));
        }
      } else if(parameterType == ParameterType.DOUBLE) {
        map.put(entry.getKey(), new JobParameter((Double)entry.getValue().parameter));
      } else if(parameterType == ParameterType.LONG) {
        if(entry.getValue().parameter instanceof Long) {
          map.put(entry.getKey(), new JobParameter((Long)entry.getValue().parameter));
        } else if(entry.getValue().parameter instanceof Integer) {
          Long tmp = new Long((Integer)entry.getValue().parameter);
          map.put(entry.getKey(), new JobParameter(tmp));
        }
      } else if(parameterType == ParameterType.STRING) {
        map.put(entry.getKey(), new JobParameter((String)entry.getValue().parameter));
      }
    }
    JobParameters jobParameters = new JobParameters(map);
    //throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException
    JobExecution jobExecution = null;
    try {
      jobExecution = jobRepository.createJobExecution(jobName, jobParameters);
    } catch (JobExecutionAlreadyRunningException e) {
      e.printStackTrace();
    } catch (JobRestartException e) {
      e.printStackTrace();
    } catch (JobInstanceAlreadyCompleteException e) {
      e.printStackTrace();
    }
    response = new CreateJobExecutionRes();
    response.jobExecution = JobRepositoryRpcFactory.convertJobExecutionType(jobExecution);
    return response;
  }
View Full Code Here

TOP

Related Classes of org.springframework.yarn.batch.repository.bindings.repo.CreateJobExecutionRes

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.