agave-jobs/jobs-core/src/test/java/org/iplantc/service/jobs/managers/launchers/JobLauncherIT.java
/**
	 * Quick job setup method to create a job we can submit
	 * @param software the app for which to create a job
	 * @return the persisted job
	 * @throws Exception if job cannot be created and saved
	 */
Quick job setup method to create a job we can submit
@param software the app for which to create a job
@return the persisted job
@throws Exception if job cannot be created and saved
Quick job setup method to create a job we can submit @param software the app for which to create a job @return the persisted job @throws Exception if job cannot be created and saved
protected Job createAndPersistJob(Software software) throws Exception {
		Job job = new Job();
		job.setName( software.getExecutionSystem().getScheduler().name() + " test");
		job.setArchiveOutput(false);
		job.setArchivePath("/");
		job.setArchiveSystem(storageSystem);
		job.setCreated(new Date());
		job.setExecutionType(software.getExecutionType());
		job.setSchedulerType(software.getExecutionSystem().getScheduler());
		job.setMemoryPerNode(.5);
		job.setOwner(software.getOwner());
		job.setProcessorsPerNode((long)1);
		job.setMaxRunTime("1:00:00");
		job.setSoftwareName(software.getUniqueName());
		job.setStatus(JobStatusType.PENDING, job.getErrorMessage());
		job.setSystem(software.getExecutionSystem().getSystemId());
		job.setBatchQueue(software.getExecutionSystem().getDefaultQueue().getName());
		ObjectNode jobInputs = mapper.createObjectNode();
		for(SoftwareInput input: software.getInputs()) {
			jobInputs.put(input.getKey(), String.format("agave://%s/%s/%s", 
					software.getStorageSystem().getSystemId(),
					software.getDeploymentPath(),
					software.getExecutablePath()));
		}
		job.setInputsAsJsonObject(jobInputs);
		ObjectNode jobParameters = mapper.createObjectNode();
		for (SoftwareParameter parameter: software.getParameters()) {
			jobParameters.set(parameter.getKey(), parameter.getDefaultValueAsJsonArray());
		}
		job.setParametersAsJsonObject(jobParameters);
		JobDao.persist(job);
		String remoteWorkPath = null;
		if (StringUtils.isEmpty(software.getExecutionSystem().getScratchDir())) {
			remoteWorkPath = job.getOwner() +
				"/job-" + job.getId() + "-" + Slug.toSlug(job.getName()) + 
				"/" + FilenameUtils.getName(software.getDeploymentPath());
		} else {
			remoteWorkPath = software.getExecutionSystem().getScratchDir() + 
					job.getOwner() + 
					"/job-" + job.getId() + "-" + Slug.toSlug(job.getName()) +
					"/" + FilenameUtils.getName(software.getDeploymentPath());
		}
		job.setWorkPath(remoteWorkPath);
		JobDao.persist(job);
		return job;
	}
protected Job createAndPersistJob ( Software software ) throws Exception { Job job = new Job ( ) ; job . setName ( software . getExecutionSystem ( ) . getScheduler ( ) . name ( ) + " test" ) ; job . setArchiveOutput ( false ) ; job . setArchivePath ( "/" ) ; job . setArchiveSystem ( storageSystem ) ; job . setCreated ( new Date ( ) ) ; job . setExecutionType ( software . getExecutionType ( ) ) ; job . setSchedulerType ( software . getExecutionSystem ( ) . getScheduler ( ) ) ; job . setMemoryPerNode ( .5 ) ; job . setOwner ( software . getOwner ( ) ) ; job . setProcessorsPerNode ( ( long ) 1 ) ; job . setMaxRunTime ( "1:00:00" ) ; job . setSoftwareName ( software . getUniqueName ( ) ) ; job . setStatus ( JobStatusType . PENDING , job . getErrorMessage ( ) ) ; job . setSystem ( software . getExecutionSystem ( ) . getSystemId ( ) ) ; job . setBatchQueue ( software . getExecutionSystem ( ) . getDefaultQueue ( ) . getName ( ) ) ; ObjectNode jobInputs = mapper . createObjectNode ( ) ; for ( SoftwareInput input : software . getInputs ( ) ) { jobInputs . put ( input . getKey ( ) , String . format ( "agave://%s/%s/%s" , software . getStorageSystem ( ) . getSystemId ( ) , software . getDeploymentPath ( ) , software . getExecutablePath ( ) ) ) ; } job . setInputsAsJsonObject ( jobInputs ) ; ObjectNode jobParameters = mapper . createObjectNode ( ) ; for ( SoftwareParameter parameter : software . getParameters ( ) ) { jobParameters . set ( parameter . getKey ( ) , parameter . getDefaultValueAsJsonArray ( ) ) ; } job . setParametersAsJsonObject ( jobParameters ) ; JobDao . persist ( job ) ; String remoteWorkPath = null ; if ( StringUtils . isEmpty ( software . getExecutionSystem ( ) . getScratchDir ( ) ) ) { remoteWorkPath = job . getOwner ( ) + "/job-" + job . getId ( ) + "-" + Slug . toSlug ( job . getName ( ) ) + "/" + FilenameUtils . getName ( software . getDeploymentPath ( ) ) ; } else { remoteWorkPath = software . getExecutionSystem ( ) . getScratchDir ( ) + job . getOwner ( ) + "/job-" + job . getId ( ) + "-" + Slug . toSlug ( job . getName ( ) ) + "/" + FilenameUtils . getName ( software . getDeploymentPath ( ) ) ; } job . setWorkPath ( remoteWorkPath ) ; JobDao . persist ( job ) ; return job ; }
Quick job setup method to create a job we can submit
 @param software the app for which to create a job
 @return the persisted job
 @throws Exception if job cannot be created and saved
Quick job setup method to create a job we can submit @param software the app for which to create a job @return the persisted job @throws Exception if job cannot be created and saved