airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1418464 - in /airavata/trunk/samples/airavata-client: create-application/src/main/java/org/apache/airavata/airavata-api/samples/ workflow-run/src/main/java/org/apache/airavata/client/samples/ workflow-run/src/main/resources/
Date Fri, 07 Dec 2012 20:30:04 GMT
Author: lahiru
Date: Fri Dec  7 20:30:03 2012
New Revision: 1418464

URL: http://svn.apache.org/viewvc?rev=1418464&view=rev
Log:
adding more changes to samples.

Modified:
    airavata/trunk/samples/airavata-client/create-application/src/main/java/org/apache/airavata/airavata-api/samples/CreateApplication.java
    airavata/trunk/samples/airavata-client/workflow-run/src/main/java/org/apache/airavata/client/samples/RunWorkflow.java
    airavata/trunk/samples/airavata-client/workflow-run/src/main/resources/EchoWorkflow.xwf

Modified: airavata/trunk/samples/airavata-client/create-application/src/main/java/org/apache/airavata/airavata-api/samples/CreateApplication.java
URL: http://svn.apache.org/viewvc/airavata/trunk/samples/airavata-client/create-application/src/main/java/org/apache/airavata/airavata-api/samples/CreateApplication.java?rev=1418464&r1=1418463&r2=1418464&view=diff
==============================================================================
--- airavata/trunk/samples/airavata-client/create-application/src/main/java/org/apache/airavata/airavata-api/samples/CreateApplication.java
(original)
+++ airavata/trunk/samples/airavata-client/create-application/src/main/java/org/apache/airavata/airavata-api/samples/CreateApplication.java
Fri Dec  7 20:30:03 2012
@@ -66,6 +66,7 @@ public class CreateApplication {
         List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
         serviceDescription.getType().setName("Echo");
         serviceDescription.getType().setDescription("Echo service");
+        //Creating input parameters
         InputParameterType parameter = InputParameterType.Factory.newInstance();
         parameter.setParameterName("echo_input");
         parameter.setParameterDescription("echo input");
@@ -74,6 +75,7 @@ public class CreateApplication {
         parameterType.setName("String");
         inputParameters.add(parameter);
 
+        //Creating output parameters
         OutputParameterType outputParameter = OutputParameterType.Factory.newInstance();
         outputParameter.setParameterName("echo_output");
         outputParameter.setParameterDescription("Echo output");
@@ -82,13 +84,15 @@ public class CreateApplication {
         outputParaType.setName("String");
         outputParameters.add(outputParameter);
 
+        //Setting input and output parameters to serviceDescriptor
         serviceDescription.getType().setInputParametersArray(inputParameters.toArray(new
InputParameterType[]{}));
         serviceDescription.getType().setOutputParametersArray(outputParameters.toArray(new
OutputParameterType[]{}));
 
         log.info("Saving service description ...");
+        //Saving service descriptor
         airavataAPI.getApplicationManager().saveServiceDescription(serviceDescription);
 
-        // Deployment descriptor
+        // Deployment descriptor creation
         ApplicationDeploymentDescription applicationDeploymentDescription = new ApplicationDeploymentDescription();
         ApplicationDeploymentDescriptionType applicationDeploymentDescriptionType
                 = applicationDeploymentDescription.getType();
@@ -97,6 +101,8 @@ public class CreateApplication {
         applicationDeploymentDescriptionType.setScratchWorkingDirectory("/tmp");
 
         log.info("Saving deployment description ...");
+
+        //Saving deployment Descriptor with an association with given serviceName, Host name
         airavataAPI.getApplicationManager().saveDeploymentDescription(serviceDescription.getType().getName(),
                 descriptor.getType().getHostName(), applicationDeploymentDescription);
     }

Modified: airavata/trunk/samples/airavata-client/workflow-run/src/main/java/org/apache/airavata/client/samples/RunWorkflow.java
URL: http://svn.apache.org/viewvc/airavata/trunk/samples/airavata-client/workflow-run/src/main/java/org/apache/airavata/client/samples/RunWorkflow.java?rev=1418464&r1=1418463&r2=1418464&view=diff
==============================================================================
--- airavata/trunk/samples/airavata-client/workflow-run/src/main/java/org/apache/airavata/client/samples/RunWorkflow.java
(original)
+++ airavata/trunk/samples/airavata-client/workflow-run/src/main/java/org/apache/airavata/client/samples/RunWorkflow.java
Fri Dec  7 20:30:03 2012
@@ -24,7 +24,10 @@ import org.apache.airavata.client.Airava
 import org.apache.airavata.client.api.AiravataAPI;
 import org.apache.airavata.client.api.AiravataAPIInvocationException;
 import org.apache.airavata.registry.api.PasswordCallback;
+import org.apache.airavata.registry.api.exception.worker.ExperimentLazyLoadedException;
 import org.apache.airavata.registry.api.workflow.ExperimentData;
+import org.apache.airavata.registry.api.workflow.WorkflowInstanceData;
+import org.apache.airavata.registry.api.workflow.WorkflowInstanceNodeData;
 import org.apache.airavata.rest.client.PasswordCallbackImpl;
 import org.apache.airavata.workflow.model.wf.WorkflowInput;
 import org.slf4j.Logger;
@@ -54,13 +57,13 @@ public class RunWorkflow {
 
     private static AiravataAPI airavataAPI;
 
-    public static void main(String[] args) throws AiravataAPIInvocationException, IOException,
URISyntaxException {
+    public static void main(String[] args) throws AiravataAPIInvocationException, IOException,
URISyntaxException, ExperimentLazyLoadedException {
 
         //creating airavata client object //
         port = Integer.parseInt("8080");
         serverUrl = "localhost";
         serverContextName = "airavata-registry";
-
+        System.out.println((new File(".")).getAbsolutePath());
         log.info("Configurations - port : " + port);
         log.info("Configurations - serverUrl : " + serverUrl);
         log.info("Configurations - serverContext : " + serverContextName);
@@ -72,9 +75,13 @@ public class RunWorkflow {
         PasswordCallback passwordCallback = new PasswordCallbackImpl(getUserName(), getPassword());
         airavataAPI = AiravataAPIFactory.getAPI(new URI(getRegistryURL()),
                 getGatewayName(), getUserName(), passwordCallback);
-        System.out.println((new File("")).getAbsolutePath());
-        String workflowName = "Workflow1";
+
+        String workflowName = "EchoSample";
+        //Saving workflow method, workflow file has the workflow Name set to EchoSample,
so when we use saveWorkflow method it will
+        //save the workflow with that name.
         airavataAPI.getWorkflowManager().saveWorkflow(getWorkflowComposeContent());
+
+        //Now workflow has saved, Now we have to set inputs
         List<WorkflowInput> workflowInputs = new ArrayList<WorkflowInput>();
         String name = "echo_input";
         String type = "String";
@@ -82,26 +89,22 @@ public class RunWorkflow {
         WorkflowInput workflowInput = new WorkflowInput(name, (type == null ||
                 type.isEmpty()) ? "String" : type, null, value, false);
         workflowInputs.add(workflowInput);
+
+        //Now inputs are set properly to the workflow, now we are about to run the workflow(submit
the workflow run to intepreterService)
         String result
                 = airavataAPI.getExecutionManager().runExperiment(workflowName, workflowInputs,
"admin", "",
                 workflowName);
         System.out.println("Workflow Experiment ID Returned : " + result);
-        List<ExperimentData> experimentDataList = airavataAPI.getProvenanceManager().getExperimentDataList(result);
-        for (ExperimentData data : experimentDataList) {
-            System.out.println(data.getExperimentName() + ": " + data.getTopic());
-        }
-    }
+        ExperimentData experimentData = airavataAPI.getProvenanceManager().getExperimentData(result);
+        List<WorkflowInstanceData> workflowInstanceData = experimentData.getWorkflowInstanceData();
 
-    public static int getPort() {
-        return port;
-    }
-
-    public static String getServerUrl() {
-        return serverUrl;
-    }
-
-    public static String getServerContextName() {
-        return serverContextName;
+        for(WorkflowInstanceData data:workflowInstanceData){
+            List<WorkflowInstanceNodeData> nodeDataList = data.getNodeDataList();
+            for(WorkflowInstanceNodeData nodeData:nodeDataList){
+                System.out.println("Input : " + nodeData.getInputData().get(0));
+                System.out.println("Output :" + nodeData.getOutputData().get(0));
+            }
+        }
     }
 
     public static String getRegistryURL() {
@@ -121,7 +124,7 @@ public class RunWorkflow {
     }
 
     protected static String getWorkflowComposeContent() throws IOException {
-
+        System.out.println((new File(".")).getAbsolutePath());
         BufferedReader reader = new BufferedReader(new FileReader("src/main/resources/EchoWorkflow.xwf"));
         String line = null;
         StringBuffer buffer = new StringBuffer();

Modified: airavata/trunk/samples/airavata-client/workflow-run/src/main/resources/EchoWorkflow.xwf
URL: http://svn.apache.org/viewvc/airavata/trunk/samples/airavata-client/workflow-run/src/main/resources/EchoWorkflow.xwf?rev=1418464&r1=1418463&r2=1418464&view=diff
==============================================================================
--- airavata/trunk/samples/airavata-client/workflow-run/src/main/resources/EchoWorkflow.xwf
(original)
+++ airavata/trunk/samples/airavata-client/workflow-run/src/main/resources/EchoWorkflow.xwf
Fri Dec  7 20:30:03 2012
@@ -1,7 +1,7 @@
 <?xml version="1.0"?><xwf:workflow xwf:version="0.5" xmlns:xwf="http://airavata.apache.org/xbaya/xwf">
   <xgr:graph xgr:version="0.5" xgr:type="ws" xmlns:xgr="http://airavata.apache.org/xbaya/graph">
-    <xgr:id>Workflow1</xgr:id>
-    <xgr:name>Workflow1</xgr:name>
+    <xgr:id>EchoSample</xgr:id>
+    <xgr:name>EchoSample</xgr:name>
     <xgr:description></xgr:description>
     <xgr:metadata>
       <appinfo xmlns="http://www.w3.org/2001/XMLSchema">
@@ -137,4 +137,4 @@
   <xwf:image>iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mN49Ojef2Iww6hC+ioE
 AJr2avQ9sXYrAAAAAElFTkSuQmCC
 </xwf:image>
-</xwf:workflow>
\ No newline at end of file
+</xwf:workflow>



Mime
View raw message