airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject git commit: fixing a build error
Date Tue, 04 Feb 2014 20:57:31 GMT
Updated Branches:
  refs/heads/master 45df543e9 -> 43524f063


fixing a build error


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/43524f06
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/43524f06
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/43524f06

Branch: refs/heads/master
Commit: 43524f0639fce6a9da0b43f489f78ba9c8aa0855
Parents: 45df543
Author: lahiru <lahiru@apache.org>
Authored: Tue Feb 4 15:57:24 2014 -0500
Committer: lahiru <lahiru@apache.org>
Committed: Tue Feb 4 15:57:24 2014 -0500

----------------------------------------------------------------------
 .../orchestrator/core/AbstractOrchestrator.java | 170 -------------------
 .../orchestrator/core/HangedJobWorker.java      |   2 +-
 .../orchestrator/core/NewJobWorker.java         |   2 +-
 .../orchestrator/core/Orchestrator.java         |   2 +-
 .../core/OrchestratorConfiguration.java         |  20 ++-
 .../core/utils/OrchestratorUtils.java           |   2 +-
 .../cpi/impl/SimpleOrchestratorImpl.java        |   1 -
 7 files changed, 19 insertions(+), 180 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/43524f06/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/AbstractOrchestrator.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/AbstractOrchestrator.java
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/AbstractOrchestrator.java
deleted file mode 100644
index 7fe21ed..0000000
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/AbstractOrchestrator.java
+++ /dev/null
@@ -1,170 +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;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.UUID;
-
-import org.apache.airavata.client.AiravataAPIFactory;
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-import org.apache.airavata.common.exception.AiravataConfigurationException;
-import org.apache.airavata.orchestrator.core.context.OrchestratorContext;
-import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
-import org.apache.airavata.orchestrator.core.gfac.GFACInstance;
-import org.apache.airavata.orchestrator.core.model.ExperimentRequest;
-import org.apache.airavata.orchestrator.core.utils.OrchestratorConstants;
-import org.apache.airavata.orchestrator.core.utils.OrchestratorUtils;
-import org.apache.airavata.registry.api.AiravataRegistry2;
-import org.apache.airavata.registry.api.AiravataRegistryFactory;
-import org.apache.airavata.registry.api.AiravataUser;
-import org.apache.airavata.registry.api.Gateway;
-import org.apache.airavata.registry.api.exception.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class AbstractOrchestrator implements Orchestrator{
-	private final static Logger logger = LoggerFactory.getLogger(AbstractOrchestrator.class);
-	protected AiravataRegistry2 airavataRegistry;
-	protected AiravataAPI airavataAPI;
-	protected OrchestratorContext orchestratorContext;
-	protected OrchestratorConfiguration orchestratorConfiguration;
-
-    private String registryURL;
-    private String gatewayName;
-    private String airavataUserName;
-   
-    public String getRegistryURL() {
-		return registryURL;
-	}
-
-	public void setRegistryURL(String registryURL) {
-		this.registryURL = registryURL;
-	}
-
-	public String getGatewayName() {
-		return gatewayName;
-	}
-
-	public void setGatewayName(String gatewayName) {
-		this.gatewayName = gatewayName;
-	}
-	public String getAiravataUserName() {
-		return airavataUserName;
-	}
-
-	public void setAiravataUserName(String airavataUserName) {
-		this.airavataUserName = airavataUserName;
-	}
-	public boolean initialize() throws OrchestratorException {
-        try {
-            /* Initializing the OrchestratorConfiguration object */
-        	orchestratorConfiguration = OrchestratorUtils.loadOrchestratorConfiguration();
-            setGatewayProperties();
-            /* initializing the Orchestratorcontext object */
-            airavataRegistry = AiravataRegistryFactory.getRegistry(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();
-                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);
-        } catch (RegistryException e) {
-            logger.error("Failed to initializing Orchestrator");
-            OrchestratorException orchestratorException = new OrchestratorException(e);
-            throw orchestratorException;
-        } catch (AiravataConfigurationException e) {
-            logger.error("Failed to initializing Orchestrator");
-            OrchestratorException orchestratorException = new OrchestratorException(e);
-            throw orchestratorException;
-        } catch (IOException e) {
-            logger.error("Failed to initializing Orchestrator - Error parsing orchestrator.properties");
-            OrchestratorException orchestratorException = new OrchestratorException(e);
-            throw orchestratorException;
-        }
-        return true;
-    }
-	
-	//get the registry URL and the credentials from the property file
-    protected void setGatewayProperties() {
-        InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(OrchestratorConstants.AIRAVATA_PROPERTIES);
-        Properties properties = new Properties();
-        try {
-            properties.load(inputStream);
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        setAiravataUserName(properties.getProperty("system.user"));
-        setGatewayName(properties.getProperty("system.gateway"));
-        setRegistryURL(properties.getProperty("airavata.server.url"));
-    }
-    //todo decide whether to return an error or do what
-	 //FIXME: (MEP) as posted on dev list, I think this should return a JobRequest with the
experimentID set. This would simplify some of the validation in EmbeddedGFACJobSubmitter's
launcGfacWithJobRequest--just throw the job away if the JobRequest is incomplete or malformed.
-   public String createExperiment(ExperimentRequest request) throws OrchestratorException
{
-       //todo use a consistent method to create the experiment ID
-		  //FIXME: (MEP) Should you trust the user to do this?  What if the same experimentID is
sent twice by the same gateway?
-       String experimentID = request.getUserExperimentID();
-       if(experimentID == null){
-       	experimentID = UUID.randomUUID().toString(); 
-       }
-       try {
-           airavataRegistry.storeExperiment(request.getSubmitterUserName(), experimentID,
null, null);
-       } catch (RegistryException e) {
-           //todo put more meaningful error  message
-           logger.error("Failed to create experiment for the request from " + request.getSubmitterUserName());
-           throw new OrchestratorException(e);
-       }
-       return experimentID;
-   }
-   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;
-   }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/43524f06/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/HangedJobWorker.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/HangedJobWorker.java
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/HangedJobWorker.java
index 4214f06..b3d2878 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/HangedJobWorker.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/HangedJobWorker.java
@@ -47,7 +47,7 @@ public class HangedJobWorker implements Runnable{
     public HangedJobWorker(OrchestratorContext orchestratorContext) throws OrchestratorException
{
         this.orchestratorContext = orchestratorContext;
         try {
-            String submitterClass = this.orchestratorContext.getOrchestratorConfiguration().getSubmitterClass();
+            String submitterClass = this.orchestratorContext.getOrchestratorConfiguration().getNewJobSubmitterClass();
 				//FIXME: (MEP) Do you want to use the same submit interval for hung jobs as newly submitted
jobs?  Suggest separate parameters.
             submitInterval = this.orchestratorContext.getOrchestratorConfiguration().getSubmitterInterval();
 				//FIXME: (MEP) It is possible that you want to have a different JobSubmitter for hung
jobs and for new jobs, so the property file needs to have separate name/value pairs for these.

http://git-wip-us.apache.org/repos/asf/airavata/blob/43524f06/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/NewJobWorker.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/NewJobWorker.java
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/NewJobWorker.java
index 0e4a2c2..1b22702 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/NewJobWorker.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/NewJobWorker.java
@@ -47,7 +47,7 @@ public class NewJobWorker implements Runnable {
     public NewJobWorker(OrchestratorContext orchestratorContext) throws OrchestratorException
{
         this.orchestratorContext = orchestratorContext;
         try {
-            String submitterClass = this.orchestratorContext.getOrchestratorConfiguration().getSubmitterClass();
+            String submitterClass = this.orchestratorContext.getOrchestratorConfiguration().getNewJobSubmitterClass();
             submitInterval = this.orchestratorContext.getOrchestratorConfiguration().getSubmitterInterval();
             Class<? extends JobSubmitter> aClass = Class.forName(submitterClass.trim()).asSubclass(JobSubmitter.class);
             jobSubmitter = aClass.newInstance();

http://git-wip-us.apache.org/repos/asf/airavata/blob/43524f06/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/Orchestrator.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/Orchestrator.java
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/Orchestrator.java
index 489295f..0a4f913 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/Orchestrator.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/Orchestrator.java
@@ -67,7 +67,7 @@ public interface Orchestrator {
      * @return
      * @throws OrchestratorException
      */
-    boolean cancelExperiment(String experimentID)throws OrchestratorException;
+    boolean terminateExperiment(String experimentID)throws OrchestratorException;
 
     /**
      * This is like a cron job which runs continuously and take available jobs to

http://git-wip-us.apache.org/repos/asf/airavata/blob/43524f06/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/OrchestratorConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/OrchestratorConfiguration.java
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/OrchestratorConfiguration.java
index 2bcc70e..c35dacf 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/OrchestratorConfiguration.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/OrchestratorConfiguration.java
@@ -30,7 +30,9 @@ import java.net.URL;
  */
 public class OrchestratorConfiguration {
 
-    private String submitterClass;
+    private String newJobSubmitterClass;
+
+    private String hangedJobSubmitterClass;
 
     private int submitterInterval = 1000;
 
@@ -61,8 +63,8 @@ public class OrchestratorConfiguration {
         this.brokerURL = brokerURL;
     }
 
-    public String getSubmitterClass() {
-        return submitterClass;
+    public String getNewJobSubmitterClass() {
+        return newJobSubmitterClass;
     }
 
     public int getSubmitterInterval() {
@@ -73,8 +75,8 @@ public class OrchestratorConfiguration {
         return threadPoolSize;
     }
 
-    public void setSubmitterClass(String submitterClass) {
-        this.submitterClass = submitterClass;
+    public void setNewJobSubmitterClass(String newJobSubmitterClass) {
+        this.newJobSubmitterClass = newJobSubmitterClass;
     }
 
     public void setSubmitterInterval(int submitterInterval) {
@@ -100,4 +102,12 @@ public class OrchestratorConfiguration {
     public void setAiravataAPI(AiravataAPI airavataAPI) {
         this.airavataAPI = airavataAPI;
     }
+
+    public String getHangedJobSubmitterClass() {
+        return hangedJobSubmitterClass;
+    }
+
+    public void setHangedJobSubmitterClass(String hangedJobSubmitterClass) {
+        this.hangedJobSubmitterClass = hangedJobSubmitterClass;
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/43524f06/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 0fd767f..4930684 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
@@ -49,7 +49,7 @@ public class OrchestratorUtils {
         OrchestratorConfiguration orchestratorConfiguration = new OrchestratorConfiguration();
         Properties orchestratorProps = new Properties();
         orchestratorProps.load(resource.openStream());
-        orchestratorConfiguration.setSubmitterClass((String) orchestratorProps.get(OrchestratorConstants.JOB_SUBMITTER));
+        orchestratorConfiguration.setNewJobSubmitterClass((String) orchestratorProps.get(OrchestratorConstants.JOB_SUBMITTER));
         orchestratorConfiguration.setSubmitterInterval(Integer.parseInt((String)orchestratorProps.get(OrchestratorConstants.SUBMIT_INTERVAL)));
         orchestratorConfiguration.setThreadPoolSize(Integer.parseInt((String)orchestratorProps.get(OrchestratorConstants.THREAD_POOL_SIZE)));
         orchestratorConfiguration.setStartSubmitter(Boolean.valueOf(orchestratorProps.getProperty(OrchestratorConstants.START_SUBMITTER)));

http://git-wip-us.apache.org/repos/asf/airavata/blob/43524f06/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 c654722..43c4baa 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
@@ -24,7 +24,6 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
 import org.apache.airavata.common.utils.AiravataJobState;
-import org.apache.airavata.orchestrator.core.AbstractOrchestrator;
 import org.apache.airavata.orchestrator.core.HangedJobWorker;
 import org.apache.airavata.orchestrator.core.NewJobWorker;
 import org.apache.airavata.orchestrator.core.exception.OrchestratorException;


Mime
View raw message