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 17:31:16 UTC

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

Author: lahiru
Date: Tue Jul  3 15:31:15 2012
New Revision: 1356790

URL: http://svn.apache.org/viewvc?rev=1356790&view=rev
Log:
picking host from Worfklwo context header even thought its not set in ot that service.

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=1356790&r1=1356789&r2=1356790&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 15:31:15 2012
@@ -160,7 +160,7 @@ public class SchedulerImpl implements Sc
 
     private HostDescription scheduleToHost(AiravataRegistry regService, String serviceName) {
         // Since xbaya removes the other scheduling configuration here we only have pick the 0th element of the array
-        String hostName = "";
+        String hostName = null;
         ContextHeaderDocument.ContextHeader currentContextHeader = WorkflowContextHeaderBuilder.getCurrentContextHeader();
         if (currentContextHeader != null && currentContextHeader.getWorkflowSchedulingContext() != null) {
             ApplicationSchedulingContextDocument.ApplicationSchedulingContext[] applicationSchedulingContextArray = currentContextHeader.getWorkflowSchedulingContext().getApplicationSchedulingContextArray();
@@ -174,20 +174,27 @@ public class SchedulerImpl implements Sc
 		try {
 			deploymentDescription = regService.searchDeploymentDescription(serviceName);
 	        for (HostDescription hostDesc : deploymentDescription.keySet()) {
-	        	result = hostDesc;
-	            log.info("Found service on: " + result.getType().getHostAddress());
-                // if user specify the host in the workflowcontext header we pick that host instead of picking the last hostName
-                if(hostName != null){
-                    if(hostDesc.getType().getHostName().equals(hostName)){
-                        break;
-                    }
-                }
-			}
-		} catch (RegistryException e) {
-			e.printStackTrace();
-		}
+                result = hostDesc;
+                log.info("Found service on: " + result.getType().getHostAddress());
+            }
+        } catch (RegistryException e) {
+            e.printStackTrace();
+        }
+        // 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;
+            try {
+                hostDescription = regService.getHostDescription(hostName);
+            } catch (RegistryException e) {
+                e.printStackTrace();
+                log.warn("Wrong host Name provided in WorkflowContext Header");
+            }
+            if(hostDescription != null){
+                result = hostDescription;
+            }
+        }
         if (result==null){
-        	log.warn("Applcation  " + serviceName + " not found in registry");
+        	log.warn("Application  " + serviceName + " not found in registry");
         }
         return result;
 //        List<HostDescription> hosts = regService.getServiceLocation(serviceName);