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/06/26 17:37:40 UTC

svn commit: r1354067 - in /incubator/airavata/branches/0.3-incubating-snapshot/modules: commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/ commons/workflow-tracking/src/main/java/org/apache/airavata/...

Author: lahiru
Date: Tue Jun 26 15:37:39 2012
New Revision: 1354067

URL: http://svn.apache.org/viewvc?rev=1354067&view=rev
Log:
fixing https://issues.apache.org/jira/browse/AIRAVATA-487.

Modified:
    incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java
    incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java
    incubator/airavata/branches/0.3-incubating-snapshot/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java
    incubator/airavata/branches/0.3-incubating-snapshot/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java
    incubator/airavata/branches/0.3-incubating-snapshot/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MessagePuller.java

Modified: incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java
URL: http://svn.apache.org/viewvc/incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java?rev=1354067&r1=1354066&r2=1354067&view=diff
==============================================================================
--- incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java (original)
+++ incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java Tue Jun 26 15:37:39 2012
@@ -67,8 +67,6 @@ public class WorkflowContextHeaderBuilde
         this.contextHeader
                 .setWorkflowSchedulingContext(WorkflowSchedulingContextDocument.WorkflowSchedulingContext.Factory
                         .newInstance());
-        threadLocal = new ThreadLocal();
-        threadLocal.set(contextHeader);
     }
 
     public static void setCurrentContextHeader(ContextHeaderDocument.ContextHeader contextHeader){
@@ -317,4 +315,20 @@ public class WorkflowContextHeaderBuilde
         applicationSchedulingContext.setWsgramPreferred(wsGramPreffered);
         return this;
     }
+
+    public static ContextHeaderDocument.ContextHeader removeOtherSchedulingConfig(String nodeID, ContextHeaderDocument.ContextHeader header) {
+        ApplicationSchedulingContextDocument.ApplicationSchedulingContext[] applicationSchedulingContextArray =
+                header.getWorkflowSchedulingContext().getApplicationSchedulingContextArray();
+        int index = 0;
+        for (ApplicationSchedulingContextDocument.ApplicationSchedulingContext context : applicationSchedulingContextArray) {
+            if (context.getServiceId().equals(nodeID)) {
+                continue;
+            } else {
+                header.getWorkflowSchedulingContext().removeApplicationSchedulingContext(index);
+            }
+            index++;
+        }
+        header.getWorkflowSchedulingContext().setApplicationSchedulingContextArray(applicationSchedulingContextArray);
+        return header;
+    }
 }

Modified: incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java
URL: http://svn.apache.org/viewvc/incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java?rev=1354067&r1=1354066&r2=1354067&view=diff
==============================================================================
--- incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java (original)
+++ incubator/airavata/branches/0.3-incubating-snapshot/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java Tue Jun 26 15:37:39 2012
@@ -232,7 +232,7 @@ public class MessageBoxNotificationHandl
             logger.debug("\n\nCreated Messagebox at address :" + messageBoxAddress);
 
         subscriptionId = subToBrokerWithMsgBoxSink(msgBoxAddr, topic, xpath, wseClient, subscribePermananly);
-        messagePuller = msgboxHandler.startPullingEventsFromMsgBox(msgBoxAddr, this, 1500L, 30000l);
+        messagePuller = msgboxHandler.startPullingEventsFromMsgBox(msgBoxAddr, this, 1500L, 1000l);
         if (logger.isDebugEnabled())
             logger.debug("\n\nCreate Subscription for topic" + topic + " [Messagebox]\n\n");
 
@@ -255,7 +255,7 @@ public class MessageBoxNotificationHandl
             logger.info("\n\nCreated Messagebox at address :" + msgBoxAddr.getAddress());
 
         subscriptionId = subToBrokerWithMsgBoxSink(msgBoxAddr, topic, xpath, wseClient, subscribePermanatly);
-        messagePuller = msgboxHandler.startPullingEventsFromMsgBox(msgBoxAddr, this, 500L, 30000l);
+        messagePuller = msgboxHandler.startPullingEventsFromMsgBox(msgBoxAddr, this, 500L, 1000l);
         if (logger.isDebugEnabled())
             logger.info("\n\nCreate Subscription for topic" + topic + " [Messagebox]\n\n");
         Subscription subscription = new Subscription(this, subscriptionId, topic, callback, this.brokerURL);

Modified: incubator/airavata/branches/0.3-incubating-snapshot/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java
URL: http://svn.apache.org/viewvc/incubator/airavata/branches/0.3-incubating-snapshot/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java?rev=1354067&r1=1354066&r2=1354067&view=diff
==============================================================================
--- incubator/airavata/branches/0.3-incubating-snapshot/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java (original)
+++ incubator/airavata/branches/0.3-incubating-snapshot/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java Tue Jun 26 15:37:39 2012
@@ -114,6 +114,22 @@ public class GramRSLGenerator {
             } catch (NullPointerException e) {
                 log.info("No Value sent in WorkflowContextHeader for Node Count, value in the Deployment Descriptor will be used");
             }
+            try {
+                String queueName = currentContextHeader.getWorkflowSchedulingContext().getApplicationSchedulingContextArray()[0].getQueueName();
+                if(queueName != null){
+                    jobAttr.setQueue(queueName);
+                }else{
+                    if (app.getQueue() != null) {
+                        if (app.getQueue().getQueueName() != null) {
+                            System.out.println("Testing");
+                            log.info("Setting job queue to " + app.getQueue().getQueueName());
+                            jobAttr.setQueue(app.getQueue().getQueueName());
+                        }
+                    }
+                }
+            } catch (NullPointerException e) {
+                log.info("No Value sent in WorkflowContextHeader for Node Count, value in the Deployment Descriptor will be used");
+            }
         }
         if (app.getNodeCount() > 0) {
             jobAttr.set("hostCount", String.valueOf(app.getNodeCount()));
@@ -136,19 +152,10 @@ public class GramRSLGenerator {
                 jobAttr.setProject(app.getProjectAccount().getProjectAccountNumber());
             }
         }
-        if(app.getQueue() != null){
-        if (app.getQueue().getQueueName() != null) {
-            System.out.println("Testing");
-            log.info("Setting job queue to " + app.getQueue().getQueueName());
-            jobAttr.setQueue(app.getQueue().getQueueName());
-        }
-        }
-
         String jobType = JobType.SINGLE.toString();
         if (app.getJobType() != null) {
             jobType = app.getJobType().toString();
         }
-
         if (jobType.equalsIgnoreCase(JobType.SINGLE.toString())) {
             log.info("Setting job type to single");
             jobAttr.setJobType(GramAttributes.JOBTYPE_SINGLE);

Modified: incubator/airavata/branches/0.3-incubating-snapshot/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java
URL: http://svn.apache.org/viewvc/incubator/airavata/branches/0.3-incubating-snapshot/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java?rev=1354067&r1=1354066&r2=1354067&view=diff
==============================================================================
--- incubator/airavata/branches/0.3-incubating-snapshot/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java (original)
+++ incubator/airavata/branches/0.3-incubating-snapshot/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java Tue Jun 26 15:37:39 2012
@@ -158,7 +158,8 @@ 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 = WorkflowContextHeaderBuilder.getCurrentContextHeader().getWorkflowSchedulingContext().getApplicationSchedulingContextArray()[0].getHostName();
         log.info("Searching registry for some deployed application hosts");
         HostDescription result = null;
         Map<HostDescription, List<ApplicationDeploymentDescription>> deploymentDescription = null;
@@ -167,6 +168,12 @@ public class SchedulerImpl implements Sc
 	        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();

Modified: incubator/airavata/branches/0.3-incubating-snapshot/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MessagePuller.java
URL: http://svn.apache.org/viewvc/incubator/airavata/branches/0.3-incubating-snapshot/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MessagePuller.java?rev=1354067&r1=1354066&r2=1354067&view=diff
==============================================================================
--- incubator/airavata/branches/0.3-incubating-snapshot/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MessagePuller.java (original)
+++ incubator/airavata/branches/0.3-incubating-snapshot/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MessagePuller.java Tue Jun 26 15:37:39 2012
@@ -45,7 +45,7 @@ public class MessagePuller {
 
     long unavailableInterval = 300000;
 
-    long timeout = 30000L;
+    long timeout = 2000L;
 
     boolean stopPulling = false;
 
@@ -62,7 +62,7 @@ public class MessagePuller {
     }
 
     public MessagePuller(MsgBoxClient msgBoxUser, EndpointReference msgBoxId, NotificationHandler handler) {
-        this(msgBoxUser, msgBoxId, handler, 1000, 30000);
+        this(msgBoxUser, msgBoxId, handler, 1000, 2000);
     }
 
     public void startPulling() {