Repository: airavata Updated Branches: refs/heads/master 20db90fc2 -> 80589baad
clean up code in orchestrator Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/80589baa Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/80589baa Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/80589baa Branch: refs/heads/master Commit: 80589baad371bd9b3456bd6da7e30cecc1cd74a0 Parents: 20db90f Author: Chathuri Wimalasena <[email protected]> Authored: Fri Jun 26 15:02:22 2015 -0400 Committer: Chathuri Wimalasena <[email protected]> Committed: Fri Jun 26 15:02:22 2015 -0400 ---------------------------------------------------------------------- .../airavata/gfac/server/GfacServerHandler.java | 8 +-- .../core/context/OrchestratorContext.java | 35 ++------- .../core/model/ExperimentConfigurationData.java | 68 ------------------ .../core/model/ExperimentRequest.java | 61 ---------------- .../core/model/ResourceScheduling.java | 75 -------------------- .../core/utils/OrchestratorUtils.java | 12 ---- .../cpi/impl/AbstractOrchestrator.java | 39 +--------- .../cpi/impl/SimpleOrchestratorImpl.java | 2 +- 8 files changed, 11 insertions(+), 289 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/80589baa/modules/gfac/gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java b/modules/gfac/gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java index a00734a..eea6142 100644 --- a/modules/gfac/gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java +++ b/modules/gfac/gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java @@ -91,7 +91,7 @@ public class GfacServerHandler implements GfacService.Iface { private void initAMQPClient() throws AiravataException { rabbitMQProcessLaunchConsumer = new RabbitMQProcessLaunchConsumer(); - rabbitMQProcessLaunchConsumer.listen(new TaskLaunchMessageHandler()); + rabbitMQProcessLaunchConsumer.listen(new ProcessLaunchMessageHandler()); } private void startCuratorClient() throws ApplicationSettingsException { @@ -184,11 +184,11 @@ public class GfacServerHandler implements GfacService.Iface { }*/ } - private class TaskLaunchMessageHandler implements MessageHandler { + private class ProcessLaunchMessageHandler implements MessageHandler { private String experimentNode; private String gfacServerName; - public TaskLaunchMessageHandler() throws ApplicationSettingsException { + public ProcessLaunchMessageHandler() throws ApplicationSettingsException { experimentNode = GFacConstants.ZOOKEEPER_EXPERIMENT_NODE; gfacServerName = ServerSettings.getGFacServerName(); } @@ -204,7 +204,7 @@ public class GfacServerHandler implements GfacService.Iface { } public void onMessage(MessageContext message) { - System.out.println(" Message Received with message id '" + message.getMessageId() + log.info(" Message Received with message id '" + message.getMessageId() + "' and with message type '" + message.getType()); if (message.getType().equals(MessageType.LAUNCHPROCESS)) { try { http://git-wip-us.apache.org/repos/asf/airavata/blob/80589baa/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/context/OrchestratorContext.java ---------------------------------------------------------------------- diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/context/OrchestratorContext.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/context/OrchestratorContext.java index 99f5367..8121d3b 100644 --- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/context/OrchestratorContext.java +++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/context/OrchestratorContext.java @@ -32,18 +32,9 @@ import org.apache.airavata.registry.cpi.Registry; * This is the context object used in orchestrator which */ public class OrchestratorContext { - private List<GFACInstance> gfacInstanceList; private OrchestratorConfiguration orchestratorConfiguration; - private Registry newRegistry; + private Registry registry; private Publisher publisher; - - public OrchestratorContext(List<GFACInstance> gfacInstanceList) { - if (gfacInstanceList != null) { - this.gfacInstanceList = gfacInstanceList; - }else { - this.gfacInstanceList = new ArrayList<GFACInstance>(); - } - } public Publisher getPublisher() { return publisher; @@ -53,18 +44,6 @@ public class OrchestratorContext { this.publisher = publisher; } - public OrchestratorContext() { - this(null); - } - - public List<GFACInstance> getGfacInstanceList() { - return gfacInstanceList; - } - - public void addGfacInstanceList(GFACInstance instance) { - this.gfacInstanceList.add(instance); - } - public OrchestratorConfiguration getOrchestratorConfiguration() { return orchestratorConfiguration; } @@ -72,16 +51,12 @@ public class OrchestratorContext { public void setOrchestratorConfiguration(OrchestratorConfiguration orchestratorConfiguration) { this.orchestratorConfiguration = orchestratorConfiguration; } - - public Registry getNewRegistry() { - return newRegistry; + public Registry getRegistry() { + return registry; } - public void setNewRegistry(Registry newRegistry) { - this.newRegistry = newRegistry; + public void setRegistry(Registry registry) { + this.registry = registry; } - public void setGfacInstanceList(List<GFACInstance> gfacInstanceList) { - this.gfacInstanceList.addAll(gfacInstanceList); - } } http://git-wip-us.apache.org/repos/asf/airavata/blob/80589baa/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/model/ExperimentConfigurationData.java ---------------------------------------------------------------------- diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/model/ExperimentConfigurationData.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/model/ExperimentConfigurationData.java deleted file mode 100644 index 2f17c40..0000000 --- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/model/ExperimentConfigurationData.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * 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.orchestrator.core.model; - -import java.util.Map; - -public class ExperimentConfigurationData { - private String experimentID; - private String applicationName; - private String jobRequest; - private ResourceScheduling resourceScheduling; - private Map<String,Object> inputParameters; - private Map<String,Object> outputParameters; - public String getExperimentID() { - return experimentID; - } - public void setExperimentID(String experimentID) { - this.experimentID = experimentID; - } - public String getApplicationName() { - return applicationName; - } - public void setApplicationName(String applicationName) { - this.applicationName = applicationName; - } - public String getJobRequest() { - return jobRequest; - } - public void setJobRequest(String jobRequest) { - this.jobRequest = jobRequest; - } - public ResourceScheduling getResourceScheduling() { - return resourceScheduling; - } - public void setResourceScheduling(ResourceScheduling resourceScheduling) { - this.resourceScheduling = resourceScheduling; - } - public Map<String, Object> getInputParameters() { - return inputParameters; - } - public void setInputParameters(Map<String, Object> inputParameters) { - this.inputParameters = inputParameters; - } - public Map<String, Object> getOutputParameters() { - return outputParameters; - } - public void setOutputParameters(Map<String, Object> outputParameters) { - this.outputParameters = outputParameters; - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/80589baa/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/model/ExperimentRequest.java ---------------------------------------------------------------------- diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/model/ExperimentRequest.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/model/ExperimentRequest.java deleted file mode 100644 index 7e27dc5..0000000 --- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/model/ExperimentRequest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * - * 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.orchestrator.core.model; - - -/** - * This is the initial experiment Creation request - * This is simple compare to JobRequest object in registry-api - * This contains user specified userExperimentID - */ -public class ExperimentRequest { - - private String submitterUserName; - - private String userExperimentID; - - private String systemExperimentID; - - public String getUserExperimentID() { - return userExperimentID; - } - - public void setUserExperimentID(String userExperimentID) { - this.userExperimentID = userExperimentID; - } - - public String getSubmitterUserName() { - return submitterUserName; - } - - public void setSubmitterUserName(String submitterUserName) { - this.submitterUserName = submitterUserName; - } - - public String getSystemExperimentID() { - return systemExperimentID; - } - - public void setSystemExperimentID(String systemExperimentID) { - this.systemExperimentID = systemExperimentID; - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/80589baa/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/model/ResourceScheduling.java ---------------------------------------------------------------------- diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/model/ResourceScheduling.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/model/ResourceScheduling.java deleted file mode 100644 index 799bc8c..0000000 --- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/model/ResourceScheduling.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * 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.orchestrator.core.model; - -public class ResourceScheduling { - - private boolean autoSchedule; - private boolean overrideManualScheduledParams; - private String hostName; - private int cpuCount; - private int nodeCount; - private String queueName; - private int maxWallTime; - - public boolean isAutoSchedule() { - return autoSchedule; - } - public void setAutoSchedule(boolean autoSchedule) { - this.autoSchedule = autoSchedule; - } - public boolean isOverrideManualScheduledParams() { - return overrideManualScheduledParams; - } - public void setOverrideManualScheduledParams(boolean overrideManualScheduledParams) { - this.overrideManualScheduledParams = overrideManualScheduledParams; - } - public String getHostName() { - return hostName; - } - public void setHostName(String hostName) { - this.hostName = hostName; - } - public int getCpuCount() { - return cpuCount; - } - public void setCpuCount(int cpuCount) { - this.cpuCount = cpuCount; - } - public int getNodeCount() { - return nodeCount; - } - public void setNodeCount(int nodeCount) { - this.nodeCount = nodeCount; - } - public String getQueueName() { - return queueName; - } - public void setQueueName(String queueName) { - this.queueName = queueName; - } - public int getMaxWallTime() { - return maxWallTime; - } - public void setMaxWallTime(int maxWallTime) { - this.maxWallTime = maxWallTime; - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/80589baa/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorUtils.java ---------------------------------------------------------------------- diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorUtils.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorUtils.java index d93e2c0..5af7f53 100644 --- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorUtils.java +++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorUtils.java @@ -48,16 +48,4 @@ public class OrchestratorUtils { } return orchestratorConfiguration; } - -// public static HostDescription getHostDescription(Orchestrator orchestrator, TaskDetails taskDetails)throws OrchestratorException { -// JobSubmitter jobSubmitter = ((SimpleOrchestratorImpl) orchestrator).getJobSubmitter(); -// AiravataRegistry2 registry = ((GFACEmbeddedJobSubmitter) jobSubmitter).getOrchestratorContext().getExperimentCatalog(); -// ComputationalResourceScheduling taskScheduling = taskDetails.getTaskScheduling(); -// String resourceHostId = taskScheduling.getResourceHostId(); -// try { -// return registry.getHostDescriptor(resourceHostId); -// } catch (RegException e) { -// throw new OrchestratorException(e); -// } -// } } http://git-wip-us.apache.org/repos/asf/airavata/blob/80589baa/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java ---------------------------------------------------------------------- diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java index 52b7b54..9204e47 100644 --- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java +++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java @@ -72,34 +72,9 @@ public abstract class AbstractOrchestrator implements Orchestrator { /* Initializing the OrchestratorConfiguration object */ orchestratorConfiguration = OrchestratorUtils.loadOrchestratorConfiguration(); setGatewayProperties(); - /* initializing the Orchestratorcontext object */ -// airavataRegistry = AiravataRegistryFactory.getExperimentCatalog(new Gateway(getGatewayName()), new AiravataUser(getAiravataUserName())); - // todo move this code to gfac service mode Jobsubmitter, - // todo this is ugly, SHOULD fix these isEmbedded mode code from Orchestrator -// if (!orchestratorConfiguration.isEmbeddedMode()) { -// Map<String, Integer> gfacNodeList = airavataRegistry.getGFACNodeList(); -// if (gfacNodeList.size() == 0) { -// String error = "No GFAC instances available in the system, Can't initialize Orchestrator"; -// logger.error(error); -// throw new OrchestratorException(error); -// } -// Set<String> uriList = gfacNodeList.keySet(); -// Iterator<String> iterator = uriList.iterator(); -// // todo consume these data to -// List<GFACInstance> gfacInstanceList = new ArrayList<GFACInstance>(); -// while (iterator.hasNext()) { -// String uri = iterator.next(); -// Integer integer = gfacNodeList.get(uri); -// gfacInstanceList.add(new GFACInstance(uri, integer)); -// } -// } orchestratorContext = new OrchestratorContext(); orchestratorContext.setOrchestratorConfiguration(orchestratorConfiguration); -// orchestratorConfiguration.setAiravataAPI(getAiravataAPI()); -// orchestratorContext.setRegistry(airavataRegistry); - - /* initializing registry cpi */ - orchestratorContext.setNewRegistry(RegistryFactory.getRegistry()); + orchestratorContext.setRegistry(RegistryFactory.getRegistry()); } catch (IOException e) { logger.error("Failed to initializing Orchestrator - Error parsing configuration files"); OrchestratorException orchestratorException = new OrchestratorException(e); @@ -113,7 +88,6 @@ public abstract class AbstractOrchestrator implements Orchestrator { } } - //get the registry URL and the credentials from the property file protected void setGatewayProperties() { try { setAiravataUserName(ServerSettings.getDefaultUser()); @@ -123,17 +97,6 @@ public abstract class AbstractOrchestrator implements Orchestrator { } } -// private AiravataAPI getAiravataAPI() { -// if (airavataAPI == null) { -// try { -// airavataAPI = AiravataAPIFactory.getAPI(getGatewayName(), getAiravataUserName()); -// } catch (AiravataAPIInvocationException e) { -// logger.error("Unable to create Airavata API", e); -// } -// } -// return airavataAPI; -// } - public OrchestratorContext getOrchestratorContext() { return orchestratorContext; } http://git-wip-us.apache.org/repos/asf/airavata/blob/80589baa/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java ---------------------------------------------------------------------- diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java index a5e74e4..023c779 100644 --- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java +++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java @@ -103,7 +103,7 @@ public class SimpleOrchestratorImpl extends AbstractOrchestrator{ ErrorModel details = new ErrorModel(); details.setActualErrorMessage(errorMsg); details.setCreationTime(Calendar.getInstance().getTimeInMillis()); - orchestratorContext.getNewRegistry().getExperimentCatalog().add(ExpCatChildDataType.PROCESS_ERROR, details, + orchestratorContext.getRegistry().getExperimentCatalog().add(ExpCatChildDataType.PROCESS_ERROR, details, processModel.getProcessId()); } catch (RegistryException e) { logger.error("Error while saving error details to registry", e);
