airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject git commit: adding bigred doc add function
Date Wed, 09 Jul 2014 14:47:45 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 7661ac601 -> 36393ace3


adding bigred doc add function


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/36393ace
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/36393ace
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/36393ace

Branch: refs/heads/master
Commit: 36393ace37881474c213c05a8f84e488e191ec45
Parents: 7661ac6
Author: Saminda Wijeratne <samindaw@gmail.com>
Authored: Wed Jul 9 10:41:58 2014 -0400
Committer: Saminda Wijeratne <samindaw@gmail.com>
Committed: Wed Jul 9 10:41:58 2014 -0400

----------------------------------------------------------------------
 .../client/tools/DocumentCreatorNew.java        | 66 ++++++++++++++++++++
 1 file changed, 66 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/36393ace/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorNew.java
----------------------------------------------------------------------
diff --git a/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorNew.java
b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorNew.java
index 7775dbf..2913397 100644
--- a/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorNew.java
+++ b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorNew.java
@@ -20,19 +20,31 @@
 */
 package org.apache.airavata.client.tools;
 
+import java.io.File;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
 
 import org.airavata.appcatalog.cpi.AppCatalog;
 import org.airavata.appcatalog.cpi.AppCatalogException;
 import org.apache.airavata.api.Airavata;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
 import org.apache.airavata.common.utils.ClientSettings;
+import org.apache.airavata.commons.gfac.type.ApplicationDescription;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
 import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
 import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
 import org.apache.airavata.model.appcatalog.appdeployment.ApplicationParallelismType;
 import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
 import org.apache.airavata.model.appcatalog.appinterface.DataType;
 import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription;
+import org.apache.airavata.model.appcatalog.computeresource.JobManagerCommand;
 import org.apache.airavata.model.appcatalog.computeresource.LOCALDataMovement;
 import org.apache.airavata.model.appcatalog.computeresource.LOCALSubmission;
 import org.apache.airavata.model.appcatalog.computeresource.ResourceJobManager;
@@ -45,6 +57,13 @@ import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfil
 import org.apache.airavata.model.error.AiravataClientException;
 import org.apache.airavata.model.error.AiravataSystemException;
 import org.apache.airavata.model.error.InvalidRequestException;
+import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
+import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
+import org.apache.airavata.schemas.gfac.InputParameterType;
+import org.apache.airavata.schemas.gfac.JobTypeType;
+import org.apache.airavata.schemas.gfac.OutputParameterType;
+import org.apache.airavata.schemas.gfac.SSHHostType;
+import org.apache.airavata.schemas.gfac.StringParameterType;
 import org.apache.thrift.TException;
 
 public class DocumentCreatorNew {
@@ -55,6 +74,8 @@ public class DocumentCreatorNew {
     private String stampedeHostAddress  = "stampede.tacc.xsede.org";
     private String gridftpAddress = "gsiftp://trestles-dm1.sdsc.edu:2811";
     private String gramAddress = "trestles-login1.sdsc.edu:2119/jobmanager-pbstest2";
+    private String bigRed2HostAddress = "bigred2.uits.iu.edu";
+
     private Airavata.Client client;
 	private GatewayResourceProfile gatewayResourceProfile;
 	
@@ -576,6 +597,51 @@ public class DocumentCreatorNew {
 //
 //	}
     
+    public String createBigRedDocs() throws InvalidRequestException, AiravataClientException,
AiravataSystemException, TException, AppCatalogException {
+    	ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription("bigred2",
null, null);
+    	host.addToHostAliases(bigRed2HostAddress);
+    	host.addToIpAddresses(bigRed2HostAddress);
+    	host.setComputeResourceId(client.registerComputeResource(host));
+
+    	
+    	Map<JobManagerCommand, String> commands = new HashMap<JobManagerCommand, String>();
+    	commands.put(JobManagerCommand.SUBMISSION, "aprun -n 1");
+		ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.UGE,
"/opt/torque/torque-4.2.3.1/bin/", commands , null);
+    	SSHJobSubmission sshJobSubmission = new SSHJobSubmission();
+    	sshJobSubmission.setResourceJobManager(resourceJobManager);
+    	sshJobSubmission.setSecurityProtocol(SecurityProtocol.SSH_KEYS);
+    	sshJobSubmission.setSshPort(22);
+
+    	client.addSSHJobSubmissionDetails(host.getComputeResourceId(), 1, sshJobSubmission);
+    	
+    	SCPDataMovement scpDataMovement = new SCPDataMovement();
+    	scpDataMovement.setSecurityProtocol(SecurityProtocol.SSH_KEYS);
+    	scpDataMovement.setSshPort(22);
+    	client.addSCPDataMovementDetails(host.getComputeResourceId(), 1, scpDataMovement);
+    	
+        ApplicationModule module = DocumentCreatorUtils.createApplicationModule("echo", "1.5",
null);
+        module.setAppModuleId(client.registerApplicationModule(module));
+        
+        ApplicationInterfaceDescription application = new ApplicationInterfaceDescription();
+        application.setApplicationName("SimpleEchoBR");
+        application.addToApplicationModules(module.getAppModuleId());
+    	application.addToApplicationInputs(DocumentCreatorUtils.createAppInput("echo_input",
"echo_input", null, null, DataType.STRING));
+    	application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("echo_output",
null, DataType.STRING));
+        application.setApplicationInterfaceId(client.registerApplicationInterface(application));
+
+        ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(),
module.getAppModuleId(), "/bin/echo", ApplicationParallelismType.SERIAL, "EchoLocal");
+        deployment.setAppDeploymentId(client.registerApplicationDeployment(deployment));
+        
+        String date = (new Date()).toString();
+        date = date.replaceAll(" ", "_");
+        date = date.replaceAll(":", "_");
+        String tempDir = "/tmp";
+        tempDir = tempDir + File.separator + "SimpleEcho" + "_" + date + "_" + UUID.randomUUID();
   
+        
+        client.addGatewayComputeResourcePreference(getGatewayResourceProfile().getGatewayID(),
host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(),
tempDir, "TG-STA110014S", false, null, null, null));
+        return host.getComputeResourceId()+","+application.getApplicationInterfaceId();
+   }
+
     
     
 }


Mime
View raw message