agave-jobs/jobs-core/src/main/java/org/iplantc/service/jobs/managers/launchers/HPCLauncher.java
/*
	 * Put the job in the batch scheduling queue
	 *
	 * @throws IOException when there is an issue parsing or locating the application template and deployment assets.
	 * @throws JobException when an error occurs interacting with the remote system or updating the job details.
	 * @throws SchedulerException when the scheduler on the {@link ExecutionSystem} rejects the job.
	 * @throws SoftwareUnavailableException when the job software is disabled, or deployment assets are missing.
	 * @throws SystemUnavailableException when one or more dependent systems is unavailable.
	 * @throws SystemUnknownException when a dependent system (job execution, software deployment, etc) are no longer in the db.
	 */
Put the job in the batch scheduling queue
@throws IOException when there is an issue parsing or locating the application template and deployment assets.
@throws JobException when an error occurs interacting with the remote system or updating the job details.
@throws SchedulerException when the scheduler on the  ExecutionSystem rejects the job.
@throws SoftwareUnavailableException when the job software is disabled, or deployment assets are missing.
@throws SystemUnavailableException when one or more dependent systems is unavailable.
@throws SystemUnknownException when a dependent system (job execution, software deployment, etc) are no longer in the db.
Put the job in the batch scheduling queue @throws IOException when there is an issue parsing or locating the application template and deployment assets . @throws JobException when an error occurs interacting with the remote system or updating the job details . @throws SchedulerException when the scheduler on the ExecutionSystem rejects the job . @throws SoftwareUnavailableException when the job software is disabled or deployment assets are missing . @throws SystemUnavailableException when one or more dependent systems is unavailable . @throws SystemUnknownException when a dependent system ( job execution software deployment etc ) are no longer in the db .
@Override
	public void launch() throws IOException, JobException, SoftwareUnavailableException, SchedulerException, SystemUnknownException, SystemUnavailableException
	{
		File tempAppDir = null;
		try
		{
			try {
				if (getRemoteExecutionDataClient() == null) {
					setRemoteExecutionDataClient(getExecutionSystem().getRemoteDataClient(getJob().getInternalUsername()));
					getRemoteExecutionDataClient().authenticate();
				}
			} catch (IOException | RemoteDataException | RemoteCredentialException e) {
				String msg = "Failed to create a remote connection to " + getJob().getSystem() +
						". App assets cannot be staged to the job execution system.";
				throw new JobException(msg, e);
			}
			String remoteJobWorkPath = calculateRemoteJobPath();
			createJobRemoteWorkPath(getExecutionSystem(), getRemoteExecutionDataClient(), remoteJobWorkPath);
			getJob().setWorkPath(remoteJobWorkPath);
			JobDao.persist(getJob());
            createTempAppDir();
            checkStopped();
            copySoftwareToTempAppDir();
            checkStopped();
            String applicationWrapperContent = processApplicationWrapperTemplate();
			writeToRemoteJobDir(getBatchScriptName(), applicationWrapperContent);
            checkStopped();
            String jobArchiveManifestContent = processJobArchiveManifest();
			writeToRemoteJobDir(ARCHIVE_FILENAME, jobArchiveManifestContent);
            checkStopped();
            stageSofwareApplication();
            checkStopped();
            String remoteJobId = submitJobToQueue();
            getJob().setSubmitTime(new DateTime().toDate());   
            getJob().setLastUpdated(new DateTime().toDate());  
            getJob().setLocalJobId(remoteJobId);
			checkJobStatus();
			JobDao.persist(getJob());
			FileUtils.deleteQuietly(getTempAppDir());
		}
		finally
		{
			if (getRemoteExecutionDataClient() != null) { getRemoteExecutionDataClient().disconnect(); }
			try { HibernateUtil.closeSession(); } catch (Exception ignored) {}
		}
	}
@ Override public void launch ( ) throws IOException , JobException , SoftwareUnavailableException , SchedulerException , SystemUnknownException , SystemUnavailableException { File tempAppDir = null ; try { try { if ( getRemoteExecutionDataClient ( ) == null ) { setRemoteExecutionDataClient ( getExecutionSystem ( ) . getRemoteDataClient ( getJob ( ) . getInternalUsername ( ) ) ) ; getRemoteExecutionDataClient ( ) . authenticate ( ) ; } } catch ( IOException | RemoteDataException | RemoteCredentialException e ) { String msg = "Failed to create a remote connection to " + getJob ( ) . getSystem ( ) + ". App assets cannot be staged to the job execution system." ; throw new JobException ( msg , e ) ; } String remoteJobWorkPath = calculateRemoteJobPath ( ) ; createJobRemoteWorkPath ( getExecutionSystem ( ) , getRemoteExecutionDataClient ( ) , remoteJobWorkPath ) ; getJob ( ) . setWorkPath ( remoteJobWorkPath ) ; JobDao . persist ( getJob ( ) ) ; createTempAppDir ( ) ; checkStopped ( ) ; copySoftwareToTempAppDir ( ) ; checkStopped ( ) ; String applicationWrapperContent = processApplicationWrapperTemplate ( ) ; writeToRemoteJobDir ( getBatchScriptName ( ) , applicationWrapperContent ) ; checkStopped ( ) ; String jobArchiveManifestContent = processJobArchiveManifest ( ) ; writeToRemoteJobDir ( ARCHIVE_FILENAME , jobArchiveManifestContent ) ; checkStopped ( ) ; stageSofwareApplication ( ) ; checkStopped ( ) ; String remoteJobId = submitJobToQueue ( ) ; getJob ( ) . setSubmitTime ( new DateTime ( ) . toDate ( ) ) ; getJob ( ) . setLastUpdated ( new DateTime ( ) . toDate ( ) ) ; getJob ( ) . setLocalJobId ( remoteJobId ) ; checkJobStatus ( ) ; JobDao . persist ( getJob ( ) ) ; FileUtils . deleteQuietly ( getTempAppDir ( ) ) ; } finally { if ( getRemoteExecutionDataClient ( ) != null ) { getRemoteExecutionDataClient ( ) . disconnect ( ) ; } try { HibernateUtil . closeSession ( ) ; } catch ( Exception ignored ) { } } }
Put the job in the batch scheduling queue
 @throws IOException when there is an issue parsing or locating the application template and deployment assets.
Put the job in the batch scheduling queue @throws IOException when there is an issue parsing or locating the application template and deployment assets .
// Calculate and sets the remote job path if not already set. This folder could not exist at this // point if the job had no inputs to stage in. We create the directory here just to ensure it's // present when we write the wrapper template // sets up the application directory to execute this job launch; see comments in method // copy our application package from the software.deploymentPath to our tempAppDir // prepend the application template with call back to let the Job service know the job has started // parse the application template and replace tokens with the inputs, parameters and outputs. // create the shadow file containing the exclusion files for archiving // copy the local temp directory to the remote system // Date job submitted to queue // Date job started by queue // upon success, delete the temp app dir containing the job's application assets and wrapper script. //		catch (SoftwareUnavailableException | SchedulerException | ClosedByInterruptException e) { //			throw e; //		} //        catch (SchedulerException e) { ////        	log.error("Scheduler exception occurred during launch of job " + getJob().getUuid(), e); //			throw e; //		} //		catch (Exception e) //		{ //			String msg = "Launch exception for job " + getJob().getUuid() + ": " + e.getMessage(); //			log.error(msg, e); //			throw new JobException(msg, e); //		}