<commit_before>package org.apache.airavata.gfac.provider.utils;

import java.io.File;
import java.math.BigInteger;

import org.apache.airavata.gfac.context.JobExecutionContext;
import org.apache.airavata.schemas.gfac.ExtendedKeyValueType;
import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
import org.apache.airavata.schemas.gfac.JobTypeType;
import org.apache.airavata.schemas.gfac.NameValuePairType;
import org.ggf.schemas.jsdl.x2005.x11.jsdl.ApplicationType;
import org.ggf.schemas.jsdl.x2005.x11.jsdl.JobDefinitionType;
import org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.EnvironmentType;
import org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.FileNameType;
import org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.LimitsType;
import org.ogf.schemas.jsdl.x2007.x02.jsdlSpmd.NumberOfProcessesType;
import org.ogf.schemas.jsdl.x2007.x02.jsdlSpmd.ProcessesPerHostType;
import org.ogf.schemas.jsdl.x2007.x02.jsdlSpmd.ThreadsPerProcessType;


public class ApplicationProcessor {
	
	public static void generateJobSpecificAppElements(JobDefinitionType value, JobExecutionContext context){
		
		HpcApplicationDeploymentType appDepType = (HpcApplicationDeploymentType) context
				.getApplicationContext().getApplicationDeploymentDescription()
				.getType();
		
		createGenericApplication(value, appDepType);
		
		if (appDepType.getMaxWallTime() > 0) {
			
			if(!isParallelJob(appDepType)) {
				LimitsType limitType = LimitsType.Factory.newInstance();
				BigInteger bi = BigInteger.valueOf(appDepType.getMaxWallTime());
				limitType.setBigIntegerValue(bi);
				JSDLUtils.getOrCreatePOSIXApplication(value).setWallTimeLimit(limitType);
			}
			
			else {
				LimitsType limitType = LimitsType.Factory.newInstance();
				Integer i = appDepType.getMaxWallTime();
				limitType.setStringValue(i.toString());
				JSDLUtils.getOrCreateSPMDApplication(value).setWallTimeLimit(limitType);
			}
		}


		if (appDepType.getApplicationEnvironmentArray().length > 0) {
			createApplicationEnvironment(value,
					appDepType.getApplicationEnvironmentArray(), appDepType);
		}

		
		if (appDepType.getExecutableLocation() != null) {
			FileNameType fNameType = FileNameType.Factory.newInstance();
			fNameType.setStringValue(appDepType.getExecutableLocation());
			if(isParallelJob(appDepType)) {
				JSDLUtils.getOrCreateSPMDApplication(value).setExecutable(fNameType);
				JSDLUtils.getSPMDApplication(value).setSPMDVariation(getSPMDVariation(appDepType));
				
				if(getValueFromMap(appDepType, JSDLUtils.NUMBEROFPROCESSES)!=null){
					NumberOfProcessesType num = NumberOfProcessesType.Factory.newInstance();
					num.setStringValue(getValueFromMap(appDepType, JSDLUtils.NUMBEROFPROCESSES));
					JSDLUtils.getSPMDApplication(value).setNumberOfProcesses(num);
				}<commit_msg>Commenting out a line which uses an api method which is not in the jar. <commit_after>package org.apache.airavata.gfac.provider.utils;

import org.apache.airavata.gfac.context.JobExecutionContext;
import org.apache.airavata.schemas.gfac.ExtendedKeyValueType;
import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
import org.apache.airavata.schemas.gfac.JobTypeType;
import org.apache.airavata.schemas.gfac.NameValuePairType;
import org.ggf.schemas.jsdl.x2005.x11.jsdl.ApplicationType;
import org.ggf.schemas.jsdl.x2005.x11.jsdl.JobDefinitionType;
import org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.EnvironmentType;
import org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.FileNameType;
import org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.LimitsType;
import org.ogf.schemas.jsdl.x2007.x02.jsdlSpmd.NumberOfProcessesType;
import org.ogf.schemas.jsdl.x2007.x02.jsdlSpmd.ProcessesPerHostType;
import org.ogf.schemas.jsdl.x2007.x02.jsdlSpmd.ThreadsPerProcessType;

import java.io.File;
import java.math.BigInteger;


public class ApplicationProcessor {
	
	public static void generateJobSpecificAppElements(JobDefinitionType value, JobExecutionContext context){
		
		HpcApplicationDeploymentType appDepType = (HpcApplicationDeploymentType) context
				.getApplicationContext().getApplicationDeploymentDescription()
				.getType();
		
		createGenericApplication(value, appDepType);
		
		if (appDepType.getMaxWallTime() > 0) {
			
			if(!isParallelJob(appDepType)) {
				LimitsType limitType = LimitsType.Factory.newInstance();
				BigInteger bi = BigInteger.valueOf(appDepType.getMaxWallTime());
				limitType.setBigIntegerValue(bi);
				JSDLUtils.getOrCreatePOSIXApplication(value).setWallTimeLimit(limitType);
			}
			
			else {
				LimitsType limitType = LimitsType.Factory.newInstance();
				Integer i = appDepType.getMaxWallTime();
				limitType.setStringValue(i.toString());
//				JSDLUtils.getOrCreateSPMDApplication(value).setWallTimeLimit(limitType);
			}
		}


		if (appDepType.getApplicationEnvironmentArray().length > 0) {
			createApplicationEnvironment(value,
					appDepType.getApplicationEnvironmentArray(), appDepType);
		}

		
		if (appDepType.getExecutableLocation() != null) {
			FileNameType fNameType = FileNameType.Factory.newInstance();
			fNameType.setStringValue(appDepType.getExecutableLocation());
			if(isParallelJob(appDepType)) {
				JSDLUtils.getOrCreateSPMDApplication(value).setExecutable(fNameType);
				JSDLUtils.getSPMDApplication(value).setSPMDVariation(getSPMDVariation(appDepType));
				
				if(getValueFromMap(appDepType, JSDLUtils.NUMBEROFPROCESSES)!=null){
					NumberOfProcessesType num = NumberOfProcessesType.Factory.newInstance();
					num.setStringValue(getValueFromMap(appDepType, JSDLUtils.NUMBEROFPROCESSES));
					JSDLUtils.getSPMDApplication(value).setNumberOfProcesses(num);
				}
{'fraction_non_alphanumeric': 0.10352225996781692, 'fraction_numerical': 0.017879492222420884, 'mean_word_length': 5.966376089663761, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4049983', 'n_tokens_mistral': 2106, 'n_tokens_neox': 1791, 'n_words': 205}