Author: raminder Date: Mon Apr 29 21:07:27 2013 New Revision: 1477342 URL: http://svn.apache.org/r1477342 Log: Added name-value pair setting to workflow context. This can be used to set dynamic provider or handler level parameters. AIRAVATA-827 Added: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/NameValuePairType.java Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/NodeSettings.java airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/NodeSettingsImpl.java airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java airavata/trunk/modules/commons/workflow-execution-context/src/main/resources/workflow_execution_context.xsd Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/NodeSettings.java URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/NodeSettings.java?rev=1477342&r1=1477341&r2=1477342&view=diff ============================================================================== --- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/NodeSettings.java (original) +++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/NodeSettings.java Mon Apr 29 21:07:27 2013 @@ -21,6 +21,10 @@ package org.apache.airavata.client.api; +import java.util.List; + +import org.apache.airavata.client.tools.NameValuePairType; + public interface NodeSettings { /** @@ -48,6 +52,12 @@ public interface NodeSettings { public HPCSettings getHPCSettings(); /** + * get the list of name-value pair settings + * @return + */ + public List getNameValuePair(); + + /** * Set the node Id of the workflow * @param nodeId */ @@ -70,4 +80,11 @@ public interface NodeSettings { * @param hpcSettings */ public void setHPCSettings(HPCSettings hpcSettings); + + /** + * + * @param nameValuePair + */ + public void setNameValuePair(List nameValuePair); + } Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java?rev=1477342&r1=1477341&r2=1477342&view=diff ============================================================================== --- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java (original) +++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java Mon Apr 29 21:07:27 2013 @@ -25,6 +25,7 @@ import org.apache.airavata.client.Airava import org.apache.airavata.client.api.*; import org.apache.airavata.client.stub.interpretor.NameValue; import org.apache.airavata.client.stub.interpretor.WorkflowInterpretorStub; +import org.apache.airavata.client.tools.NameValuePairType; import org.apache.airavata.common.utils.XMLUtil; import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder; import org.apache.airavata.registry.api.workflow.WorkflowExecutionStatus; @@ -228,7 +229,12 @@ public class ExecutionManagerImpl implem builder.setUserIdentifier(submissionUser); NodeSettings[] nodeSettingsList = options.getCustomWorkflowSchedulingSettings().getNodeSettingsList(); for (NodeSettings nodeSettings : nodeSettingsList) { + List nameValuePairTypes = nodeSettings.getNameValuePair(); + for (NameValuePairType nameValuePairType : nameValuePairTypes) { + builder.addApplicationSchedulingKeyPair(nodeSettings.getNodeId(),nameValuePairType.getName(), nameValuePairType.getValue(), nameValuePairType.getDescription()); + } builder.addApplicationSchedulingContext(nodeSettings.getNodeId(), nodeSettings.getServiceId(), nodeSettings.getHostSettings().getHostId(), nodeSettings.getHostSettings().isWSGRAMPreffered(), nodeSettings.getHostSettings().getGatekeeperEPR(), nodeSettings.getHPCSettings().getJobManager(), nodeSettings.getHPCSettings().getCPUCount(), nodeSettings.getHPCSettings().getNodeCount(), nodeSettings.getHPCSettings().getQueueName(), nodeSettings.getHPCSettings().getMaxWallTime()); + } OutputDataSettings[] outputDataSettingsList = options.getCustomWorkflowOutputDataSettings().getOutputDataSettingsList(); for (OutputDataSettings outputDataSettings : outputDataSettingsList) { Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/NodeSettingsImpl.java URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/NodeSettingsImpl.java?rev=1477342&r1=1477341&r2=1477342&view=diff ============================================================================== --- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/NodeSettingsImpl.java (original) +++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/NodeSettingsImpl.java Mon Apr 29 21:07:27 2013 @@ -21,15 +21,19 @@ package org.apache.airavata.client.impl; +import java.util.List; + import org.apache.airavata.client.api.HPCSettings; import org.apache.airavata.client.api.HostSchedulingSettings; import org.apache.airavata.client.api.NodeSettings; +import org.apache.airavata.client.tools.NameValuePairType; public class NodeSettingsImpl implements NodeSettings { private String nodeId; private String serviceId; private HPCSettings hpcSettings; private HostSchedulingSettings hostSchedulingSettings; + private List nameValuePair; public NodeSettingsImpl(String nodeId) { this(nodeId,null); @@ -86,4 +90,15 @@ public class NodeSettingsImpl implements this.hpcSettings = hpcSettings; } + @Override + public List getNameValuePair() { + return nameValuePair; + } + + @Override + public void setNameValuePair(List nameValuePair) { + this.nameValuePair = nameValuePair; + + } + } Added: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/NameValuePairType.java URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/NameValuePairType.java?rev=1477342&view=auto ============================================================================== --- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/NameValuePairType.java (added) +++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/NameValuePairType.java Mon Apr 29 21:07:27 2013 @@ -0,0 +1,48 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.airavata.client.tools; + +public class NameValuePairType { + + private String name; + private String value; + private String description; + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getValue() { + return value; + } + public void setValue(String value) { + this.value = value; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + +} Modified: 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/airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java?rev=1477342&r1=1477341&r2=1477342&view=diff ============================================================================== --- airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java (original) +++ airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java Mon Apr 29 21:07:27 2013 @@ -20,9 +20,13 @@ */ package org.apache.airavata.common.workflow.execution.context; +import java.lang.reflect.Array; +import java.util.Map; + import org.apache.airavata.common.utils.XMLUtil; import org.apache.airavata.schemas.wec.*; import org.apache.xmlbeans.XmlException; +import org.omg.CORBA.NameValuePair; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xmlpull.v1.builder.XmlElement; @@ -319,7 +323,41 @@ public class WorkflowContextHeaderBuilde Boolean dataPersistence) { return addApplicationOutputDataHandling(null, outputDir, outputDataRegistry, dataPersistence); } - + + public WorkflowContextHeaderBuilder addApplicationSchedulingKeyPair(String workflowNodeId, String name, String value, String description){ + + if (this.workflowSchedulingContext == null) { + this.workflowSchedulingContext = WorkflowSchedulingContextDocument.WorkflowSchedulingContext.Factory + .newInstance(); + } + NameValuePairType nameValuePair = workflowSchedulingContext.addNewNameValuePair(); + if(workflowNodeId != null){ + nameValuePair.setWorkflowNodeId(workflowNodeId); + } + if(name != null && value != null){ + nameValuePair.setName(name); + nameValuePair.setValue(value); + } + if(description != null){ + nameValuePair.setDescription(description); + } + return this; + } + + /** + * Add Application scheduling information to workflow context per node + * @param workflowNodeId + * @param serviceId + * @param hostName + * @param wsGramPreffered + * @param gateKeepersEpr + * @param jobManager + * @param cpuCount + * @param nodeCount + * @param qName + * @param maxWalTime + * @return + */ public WorkflowContextHeaderBuilder addApplicationSchedulingContext(String workflowNodeId, String serviceId, String hostName, Boolean wsGramPreffered, String gateKeepersEpr, String jobManager, Integer cpuCount, Integer nodeCount, String qName, Integer maxWalTime) { Modified: airavata/trunk/modules/commons/workflow-execution-context/src/main/resources/workflow_execution_context.xsd URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/workflow-execution-context/src/main/resources/workflow_execution_context.xsd?rev=1477342&r1=1477341&r2=1477342&view=diff ============================================================================== --- airavata/trunk/modules/commons/workflow-execution-context/src/main/resources/workflow_execution_context.xsd (original) +++ airavata/trunk/modules/commons/workflow-execution-context/src/main/resources/workflow_execution_context.xsd Mon Apr 29 21:07:27 2013 @@ -232,10 +232,21 @@ + + + + + + + + + + +