You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2012/07/03 21:27:25 UTC

svn commit: r1356878 - /incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java

Author: lahiru
Date: Tue Jul  3 19:27:25 2012
New Revision: 1356878

URL: http://svn.apache.org/viewvc?rev=1356878&view=rev
Log:
fixing Error during gram job invocation.

Modified:
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java?rev=1356878&r1=1356877&r2=1356878&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java (original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java Tue Jul  3 19:27:25 2012
@@ -91,7 +91,8 @@ public class SchedulerImpl implements Sc
          */
         ApplicationDeploymentDescription app = null;
         try {
-            app = registryService.getDeploymentDescription(context.getServiceName(), host.getType().getHostName());
+            app = registryService.getDeploymentDescription(context.getServiceName(),
+                    getRegisteredHost(registryService,context.getServiceName()).getType().getHostName());
         } catch (RegistryException e2) {
             e2.printStackTrace();
         }
@@ -171,15 +172,7 @@ public class SchedulerImpl implements Sc
         log.info("Searching registry for some deployed application hosts");
         HostDescription result = null;
         Map<HostDescription, List<ApplicationDeploymentDescription>> deploymentDescription = null;
-		try {
-			deploymentDescription = regService.searchDeploymentDescription(serviceName);
-	        for (HostDescription hostDesc : deploymentDescription.keySet()) {
-                result = hostDesc;
-                log.info("Found service on: " + result.getType().getHostAddress());
-            }
-        } catch (RegistryException e) {
-            e.printStackTrace();
-        }
+        result = getRegisteredHost(regService, serviceName);
         // if user specify the host in the workflowcontext header we pick that host instead of picking the last hostName
         if(hostName != null){
             HostDescription hostDescription = null;
@@ -211,4 +204,19 @@ public class SchedulerImpl implements Sc
 //            return null;
 //        }
     }
+
+    private HostDescription getRegisteredHost(AiravataRegistry regService, String serviceName) {
+        Map<HostDescription, List<ApplicationDeploymentDescription>> deploymentDescription;
+        HostDescription result = null;
+        try {
+            deploymentDescription = regService.searchDeploymentDescription(serviceName);
+            for (HostDescription hostDesc : deploymentDescription.keySet()) {
+                result = hostDesc;
+                log.info("Found service on: " + result.getType().getHostAddress());
+            }
+        } catch (RegistryException e) {
+            e.printStackTrace();
+        }
+        return result;
+    }
 }