Repository: airavata Updated Branches: refs/heads/master 856da9244 -> afcd6e381
Added test for Ultrascan for stampede. AIRAVATA-1059 Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/9295006f Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/9295006f Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/9295006f Branch: refs/heads/master Commit: 9295006fe14575622c84779df2ef8b18f6d734c2 Parents: 856da92 Author: raminder <[email protected]> Authored: Sat Mar 8 10:48:44 2014 -0500 Committer: raminder <[email protected]> Committed: Sat Mar 8 10:48:44 2014 -0500 ---------------------------------------------------------------------- .../client/samples/CreateLaunchExperiment.java | 74 ++++++++++-- .../airavata/client/tools/DocumentCreator.java | 119 ++++++++++++++++++- 2 files changed, 181 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/9295006f/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java index 17a13a6..a037f36 100644 --- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java +++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java @@ -49,7 +49,7 @@ import java.util.Set; public class CreateLaunchExperiment { //FIXME: Read from a config file - public static final String THRIFT_SERVER_HOST = "localhost"; + public static final String THRIFT_SERVER_HOST = "gw111.iu.xsede.org"; public static final int THRIFT_SERVER_PORT = 8930; private final static Logger logger = LoggerFactory.getLogger(CreateLaunchExperiment.class); private static final String DEFAULT_USER = "defauly.registry.user"; @@ -62,8 +62,9 @@ public class CreateLaunchExperiment { System.out.println("API version is " + airavata.GetAPIVersion()); addDescriptors(); final String expId = createExperimentForTrestles(airavata); -// final String expId = createUS3ExperimentForTrestles(airavata); +// final String expId = createUS3ExperimentForTrestles(airavata); // final String expId = createExperimentForStampede(airavata); +// final String expId = createUS3ExperimentForStampede(airavata); System.out.println("Experiment ID : " + expId); launchExperiment(airavata, expId); System.out.println("Launched successfully"); @@ -123,12 +124,13 @@ public class CreateLaunchExperiment { public static void addDescriptors() throws AiravataAPIInvocationException,ApplicationSettingsException { try { DocumentCreator documentCreator = new DocumentCreator(getAiravataAPI()); - documentCreator.createLocalHostDocs(); - documentCreator.createGramDocs(); - documentCreator.createPBSDocs(); - documentCreator.createPBSDocsForOGCE(); - documentCreator.createMPIPBSDocs(); - documentCreator.createSlurmDocs(); +// documentCreator.createLocalHostDocs(); +// documentCreator.createGramDocs(); +// documentCreator.createPBSDocs(); +// documentCreator.createPBSDocsForOGCE(); +// documentCreator.createMPIPBSDocsTrestles(); +// documentCreator.createSlurmDocs(); + documentCreator.createMPIPBSDocsStampede(); } catch (AiravataAPIInvocationException e) { logger.error("Unable to create airavata API", e.getMessage()); throw new AiravataAPIInvocationException(e); @@ -224,7 +226,7 @@ public class CreateLaunchExperiment { exOut.add(output2); - Experiment simpleExperiment = ExperimentModelUtil.createSimpleExperiment("project1", "admin", "US3Experiment", "UltrascanApp", "UltrascanApp", exInputs); + Experiment simpleExperiment = ExperimentModelUtil.createSimpleExperiment("project1", "admin", "US3Experiment", "UltrascanAppTrestles", "UltrascanAppTrestles", exInputs); simpleExperiment.setExperimentOutputs(exOut); ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling("trestles.sdsc.edu", 2, 32, 0, "normal", 0, 0, 0, "uot111"); @@ -251,6 +253,60 @@ public class CreateLaunchExperiment { throw new TException(e); } } + public static String createUS3ExperimentForStampede (Airavata.Client client) throws AiravataSystemException, InvalidRequestException, AiravataClientException, TException { + try{ + List<DataObjectType> exInputs = new ArrayList<DataObjectType>(); + DataObjectType input = new DataObjectType(); + input.setKey("input"); + input.setType(DataType.URI.toString()); + input.setValue("file:///home/airavata/input/hpcinput.tar"); + exInputs.add(input); + + List<DataObjectType> exOut = new ArrayList<DataObjectType>(); + DataObjectType output = new DataObjectType(); + output.setKey("output"); + output.setType(DataType.URI.toString()); + output.setValue(""); + DataObjectType output1 = new DataObjectType(); + output1.setKey("stdout"); + output1.setType(DataType.STD_OUT.toString()); + output1.setValue(""); + DataObjectType output2 = new DataObjectType(); + output2.setKey("stderr"); + output2.setType(DataType.STD_ERR.toString()); + output2.setValue(""); + exOut.add(output); + exOut.add(output1); + exOut.add(output2); + + + Experiment simpleExperiment = ExperimentModelUtil.createSimpleExperiment("project1", "admin", "US3Experiment", "UltrascanAppStampede", "UltrascanAppStampede", exInputs); + simpleExperiment.setExperimentOutputs(exOut); + + ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling("stampede.tacc.xsede.org", 2, 32, 0, "normal", 0, 0, 0, "TG-MCB070039N"); + + + scheduling.setResourceHostId("gsissh-stampede"); + UserConfigurationData userConfigurationData = new UserConfigurationData(); + userConfigurationData.setAiravataAutoSchedule(false); + userConfigurationData.setOverrideManualScheduledParams(false); + userConfigurationData.setComputationalResourceScheduling(scheduling); + simpleExperiment.setUserConfigurationData(userConfigurationData); + return client.createExperiment(simpleExperiment); + } catch (AiravataSystemException e) { + logger.error("Error occured while creating the experiment...", e.getMessage()); + throw new AiravataSystemException(e); + } catch (InvalidRequestException e) { + logger.error("Error occured while creating the experiment...", e.getMessage()); + throw new InvalidRequestException(e); + } catch (AiravataClientException e) { + logger.error("Error occured while creating the experiment...", e.getMessage()); + throw new AiravataClientException(e); + }catch (TException e) { + logger.error("Error occured while creating the experiment...", e.getMessage()); + throw new TException(e); + } + } public static String createExperimentForStampede(Airavata.Client client) throws TException { try{ List<DataObjectType> exInputs = new ArrayList<DataObjectType>(); http://git-wip-us.apache.org/repos/asf/airavata/blob/9295006f/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java ---------------------------------------------------------------------- diff --git a/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java index 1fabf58..f6b953e 100644 --- a/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java +++ b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java @@ -406,7 +406,7 @@ public class DocumentCreator { } } - public void createMPIPBSDocs() { + public void createMPIPBSDocsTrestles() { HostDescription host = new HostDescription(GsisshHostType.type); host.getType().setHostAddress(hpcHostAddress); host.getType().setHostName(gsiSshHostName); @@ -421,7 +421,7 @@ public class DocumentCreator { /* * Service Description creation and saving */ - String serviceName = "UltrascanAPP"; + String serviceName = "UltrascanAppTrestles"; ServiceDescription serv = new ServiceDescription(); serv.getType().setName(serviceName); @@ -475,7 +475,7 @@ public class DocumentCreator { ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type); HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType(); ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance(); - name.setStringValue("UltrascanAPP"); + name.setStringValue("UltrascanAppTrestles"); app.setApplicationName(name); ProjectAccountType projectAccountType = app.addNewProjectAccount(); projectAccountType.setProjectAccountNumber("uot111"); @@ -518,6 +518,119 @@ public class DocumentCreator { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } + public void createMPIPBSDocsStampede() { + HostDescription host = new HostDescription(GsisshHostType.type); + host.getType().setHostAddress("stampede.tacc.xsede.org"); + host.getType().setHostName("gsissh-stampede"); + ((GsisshHostType) host.getType()).setJobManager("slurm"); + ((GsisshHostType) host.getType()).setInstalledPath("/usr/bin/"); + ((GsisshHostType) host.getType()).setPort(2222); + + try { + airavataAPI.getApplicationManager().saveHostDescription(host); + } catch (AiravataAPIInvocationException e) { + e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. + } + /* + * Service Description creation and saving + */ + String serviceName = "UltrascanAppStampede"; + ServiceDescription serv = new ServiceDescription(); + serv.getType().setName(serviceName); + + List<InputParameterType> inputList = new ArrayList<InputParameterType>(); + List<OutputParameterType> outputList = new ArrayList<OutputParameterType>(); + + + InputParameterType input = InputParameterType.Factory.newInstance(); + input.setParameterName("input"); + ParameterType parameterType = input.addNewParameterType(); + parameterType.setType(DataType.URI); + parameterType.setName("URI"); + + OutputParameterType output = OutputParameterType.Factory.newInstance(); + output.setParameterName("output"); + ParameterType parameterType1 = output.addNewParameterType(); + parameterType1.setType(DataType.URI); + parameterType1.setName("URI"); + + OutputParameterType output1 = OutputParameterType.Factory.newInstance(); + output1.setParameterName("stdout"); + ParameterType parameterType2 = output1.addNewParameterType(); + parameterType2.setType(DataType.STD_OUT); + parameterType2.setName("StdOut"); + + OutputParameterType output2 = OutputParameterType.Factory.newInstance(); + output2.setParameterName("stderr"); + ParameterType parameterType3 = output2.addNewParameterType(); + parameterType3.setType(DataType.STD_ERR); + parameterType3.setName("StdErr"); + + inputList.add(input); + outputList.add(output); + outputList.add(output1); + outputList.add(output2); + + InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]); + OutputParameterType[] outputParamList = outputList.toArray(new OutputParameterType[outputList.size()]); + + serv.getType().setInputParametersArray(inputParamList); + serv.getType().setOutputParametersArray(outputParamList); + try { + airavataAPI.getApplicationManager().saveServiceDescription(serv); + } catch (AiravataAPIInvocationException e) { + e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. + } + + /* + Application descriptor creation and saving + */ + ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type); + HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType(); + ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance(); + name.setStringValue("UltrascanAppStampede"); + app.setApplicationName(name); + ProjectAccountType projectAccountType = app.addNewProjectAccount(); + projectAccountType.setProjectAccountNumber("TG-MCB070039N"); + + QueueType queueType = app.addNewQueue(); + queueType.setQueueName("normal"); + + app.setCpuCount(1); + app.setJobType(JobTypeType.MPI); + app.setNodeCount(32); + app.setProcessorsPerNode(2); + app.setMaxWallTime(10); + /* + * Use bat file if it is compiled on Windows + */ + app.setExecutableLocation("/home1/01623/us3/bin/us_mpi_analysis"); + + /* + * Default tmp location + */ + String tempDir = "/home1/01623/us3"; + String date = (new Date()).toString(); + date = date.replaceAll(" ", "_"); + date = date.replaceAll(":", "_"); + + tempDir = tempDir + File.separator + + "Ultrascan" + "_" + date + "_" + UUID.randomUUID(); + + app.setScratchWorkingDirectory(tempDir); + app.setStaticWorkingDirectory(tempDir); + app.setInputDataDirectory(tempDir + File.separator + "inputData"); + app.setOutputDataDirectory(tempDir + File.separator + "outputData"); + app.setStandardOutput(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stdout"); + app.setStandardError(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stderr"); + app.setInstalledParentPath("/usr/bin/"); + app.setJobSubmitterCommand("/usr/local/bin/ibrun"); + try { + airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, "gsissh-stampede", appDesc); + } catch (AiravataAPIInvocationException e) { + e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. + } + } public void createSlurmDocs() { HostDescription host = new HostDescription(GsisshHostType.type); host.getType().setHostAddress("stampede.tacc.xsede.org");
