Return-Path: X-Original-To: apmail-incubator-airavata-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-airavata-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8DB899EA9 for ; Tue, 26 Jun 2012 16:09:26 +0000 (UTC) Received: (qmail 47206 invoked by uid 500); 26 Jun 2012 16:09:26 -0000 Delivered-To: apmail-incubator-airavata-commits-archive@incubator.apache.org Received: (qmail 47160 invoked by uid 500); 26 Jun 2012 16:09:26 -0000 Mailing-List: contact airavata-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: airavata-dev@incubator.apache.org Delivered-To: mailing list airavata-commits@incubator.apache.org Received: (qmail 47153 invoked by uid 99); 26 Jun 2012 16:09:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jun 2012 16:09:26 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jun 2012 16:09:24 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D0DAD2388865; Tue, 26 Jun 2012 16:09:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1354083 - in /incubator/airavata/trunk/modules: commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/ commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subs... Date: Tue, 26 Jun 2012 16:09:03 -0000 To: airavata-commits@incubator.apache.org From: lahiru@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120626160904.D0DAD2388865@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: lahiru Date: Tue Jun 26 16:09:02 2012 New Revision: 1354083 URL: http://svn.apache.org/viewvc?rev=1354083&view=rev Log: fixing https://issues.apache.org/jira/browse/AIRAVATA-487. Modified: incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java incubator/airavata/trunk/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MessagePuller.java incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/monitor/WsmgClient.java Modified: incubator/airavata/trunk/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/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java?rev=1354083&r1=1354082&r2=1354083&view=diff ============================================================================== --- incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java (original) +++ incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java Tue Jun 26 16:09:02 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,26 @@ public class WorkflowContextHeaderBuilde applicationSchedulingContext.setWsgramPreferred(wsGramPreffered); return this; } + + public static ContextHeaderDocument.ContextHeader removeOtherSchedulingConfig(String nodeID, ContextHeaderDocument.ContextHeader header) { + try { + ApplicationSchedulingContextDocument.ApplicationSchedulingContext[] applicationSchedulingContextArray = + header.getWorkflowSchedulingContext().getApplicationSchedulingContextArray(); + int index = 0; + if (applicationSchedulingContextArray != null) { + for (ApplicationSchedulingContextDocument.ApplicationSchedulingContext context : applicationSchedulingContextArray) { + if (context.getServiceId().equals(nodeID)) { + continue; + } else { + header.getWorkflowSchedulingContext().removeApplicationSchedulingContext(index); + } + index++; + } + } + header.getWorkflowSchedulingContext().setApplicationSchedulingContextArray(applicationSchedulingContextArray); + } catch (NullPointerException e) { + return header; + } + return header; + } } Modified: incubator/airavata/trunk/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java?rev=1354083&r1=1354082&r2=1354083&view=diff ============================================================================== --- incubator/airavata/trunk/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java (original) +++ incubator/airavata/trunk/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java Tue Jun 26 16:09:02 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, 1000l); + messagePuller = msgboxHandler.startPullingEventsFromMsgBox(msgBoxAddr, this, 1500L, 30000l); 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, 1000l); + messagePuller = msgboxHandler.startPullingEventsFromMsgBox(msgBoxAddr, this, 500L, 30000l); 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/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java?rev=1354083&r1=1354082&r2=1354083&view=diff ============================================================================== --- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java (original) +++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java Tue Jun 26 16:09:02 2012 @@ -127,6 +127,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())); @@ -149,19 +165,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/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=1354083&r1=1354082&r2=1354083&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 Jun 26 16:09:02 2012 @@ -43,6 +43,7 @@ import org.apache.airavata.core.gfac.pro import org.apache.airavata.core.gfac.scheduler.Scheduler; import org.apache.airavata.core.gfac.utils.GfacUtils; import org.apache.airavata.registry.api.AiravataRegistry; +import org.apache.airavata.schemas.wec.ApplicationSchedulingContextDocument; import org.apache.airavata.schemas.wec.ContextHeaderDocument; import org.apache.airavata.schemas.wec.SecurityContextDocument; import org.apache.axiom.om.OMElement; @@ -158,7 +159,15 @@ 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 = ""; + ContextHeaderDocument.ContextHeader currentContextHeader = WorkflowContextHeaderBuilder.getCurrentContextHeader(); + if (currentContextHeader != null && currentContextHeader.getWorkflowSchedulingContext() != null) { + ApplicationSchedulingContextDocument.ApplicationSchedulingContext[] applicationSchedulingContextArray = currentContextHeader.getWorkflowSchedulingContext().getApplicationSchedulingContextArray(); + if (applicationSchedulingContextArray != null && applicationSchedulingContextArray.length > 0) { + hostName = applicationSchedulingContextArray[0].getHostName(); + } + } log.info("Searching registry for some deployed application hosts"); HostDescription result = null; Map> deploymentDescription = null; @@ -167,6 +176,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/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MessagePuller.java URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MessagePuller.java?rev=1354083&r1=1354082&r2=1354083&view=diff ============================================================================== --- incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MessagePuller.java (original) +++ incubator/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MessagePuller.java Tue Jun 26 16:09:02 2012 @@ -45,7 +45,7 @@ public class MessagePuller { long unavailableInterval = 300000; - long timeout = 2000L; + long timeout = 30000L; boolean stopPulling = false; @@ -62,7 +62,7 @@ public class MessagePuller { } public MessagePuller(MsgBoxClient msgBoxUser, EndpointReference msgBoxId, NotificationHandler handler) { - this(msgBoxUser, msgBoxId, handler, 1000, 2000); + this(msgBoxUser, msgBoxId, handler, 1000, 30000); } public void startPulling() { Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java?rev=1354083&r1=1354082&r2=1354083&view=diff ============================================================================== --- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java (original) +++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java Tue Jun 26 16:09:02 2012 @@ -155,7 +155,7 @@ public class GenericInvoker implements I this.gfacURL = gfacURL; this.notifier = notifier.createServiceNotificationSender(nodeID); this.failerSent = false; - this.contextHeader = WorkflowContextHeaderBuilder.getCurrentContextHeader(); + this.contextHeader = WorkflowContextHeaderBuilder.removeOtherSchedulingConfig(nodeID,WorkflowContextHeaderBuilder.getCurrentContextHeader()); this.topic = notifier.getTopic(); } @@ -179,7 +179,7 @@ public class GenericInvoker implements I this.gfacURL = gfacURL; this.notifier = notifier.createServiceNotificationSender(nodeID); this.failerSent = false; - this.contextHeader = WorkflowContextHeaderBuilder.getCurrentContextHeader(); + this.contextHeader = WorkflowContextHeaderBuilder.removeOtherSchedulingConfig(nodeID,WorkflowContextHeaderBuilder.getCurrentContextHeader()); this.topic = notifier.getTopic(); } Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/monitor/WsmgClient.java URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/monitor/WsmgClient.java?rev=1354083&r1=1354082&r2=1354083&view=diff ============================================================================== --- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/monitor/WsmgClient.java (original) +++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/monitor/WsmgClient.java Tue Jun 26 16:09:02 2012 @@ -88,7 +88,7 @@ public class WsmgClient implements Consu if (this.pullMode) { EndpointReference messageBoxEPR = this.wseClient.createPullMsgBox(this.messageBoxURL.toString()); this.subscriptionID = this.wseClient.subscribe(messageBoxEPR.getAddress(), this.topic, null); - this.messagePuller = this.wseClient.startPullingEventsFromMsgBox(messageBoxEPR, this, interval, timeout); + this.messagePuller = this.wseClient.startPullingEventsFromMsgBox(messageBoxEPR, this, getInterval(), getTimeout()); } else { String[] endpoints = this.wseClient.startConsumerService(2222, this); this.subscriptionID = this.wseClient.subscribe(endpoints[0], this.topic, null);