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 2013/12/29 05:03:59 UTC

svn commit: r1553990 - in /airavata/sandbox/orchestrator/orchestrator-core: ./ src/main/java/org/apache/airavata/orchestrator/core/ src/main/java/org/apache/airavata/orchestrator/core/exception/ src/main/java/org/apache/airavata/orchestrator/core/gfac/...

Author: lahiru
Date: Sun Dec 29 04:03:59 2013
New Revision: 1553990

URL: http://svn.apache.org/r1553990
Log:
more changes to orchestrator-core.

Added:
    airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/JobSubmitterWorker.java
    airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/exception/
    airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/exception/OrchestratorException.java
    airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/utils/
    airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorConstants.java
Modified:
    airavata/sandbox/orchestrator/orchestrator-core/pom.xml
    airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/ExperimentRequest.java
    airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/JobRequest.java
    airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/gfac/GFACInstance.java
    airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/SimpleJobSubmitter.java
    airavata/sandbox/orchestrator/orchestrator-core/src/main/resources/orchestrator.properties

Modified: airavata/sandbox/orchestrator/orchestrator-core/pom.xml
URL: http://svn.apache.org/viewvc/airavata/sandbox/orchestrator/orchestrator-core/pom.xml?rev=1553990&r1=1553989&r2=1553990&view=diff
==============================================================================
--- airavata/sandbox/orchestrator/orchestrator-core/pom.xml (original)
+++ airavata/sandbox/orchestrator/orchestrator-core/pom.xml Sun Dec 29 04:03:59 2013
@@ -34,5 +34,10 @@ the License. -->
             <artifactId>airavata-registry-api</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-common-utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 </project>

Modified: airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/ExperimentRequest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/ExperimentRequest.java?rev=1553990&r1=1553989&r2=1553990&view=diff
==============================================================================
--- airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/ExperimentRequest.java (original)
+++ airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/ExperimentRequest.java Sun Dec 29 04:03:59 2013
@@ -20,5 +20,9 @@
 */
 package org.apache.airavata.orchestrator.core;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public class ExperimentRequest {
+    private final static Logger logger = LoggerFactory.getLogger(ExperimentRequest.class);
 }

Modified: airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/JobRequest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/JobRequest.java?rev=1553990&r1=1553989&r2=1553990&view=diff
==============================================================================
--- airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/JobRequest.java (original)
+++ airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/JobRequest.java Sun Dec 29 04:03:59 2013
@@ -20,6 +20,9 @@
 */
 package org.apache.airavata.orchestrator.core;
 
-public class JobRequest {
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
+public class JobRequest {
+    private final static Logger logger = LoggerFactory.getLogger(JobRequest.class);
 }

Added: airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/JobSubmitterWorker.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/JobSubmitterWorker.java?rev=1553990&view=auto
==============================================================================
--- airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/JobSubmitterWorker.java (added)
+++ airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/JobSubmitterWorker.java Sun Dec 29 04:03:59 2013
@@ -0,0 +1,83 @@
+/*
+ *
+ * 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 org.apache.airavata.orchestrator.core.context.OrchestratorContext;
+import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
+import org.apache.airavata.orchestrator.core.job.JobSubmitter;
+import org.apache.airavata.orchestrator.core.utils.OrchestratorConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Properties;
+
+public class JobSubmitterWorker implements Runnable{
+    private final static Logger logger = LoggerFactory.getLogger(JobSubmitterWorker.class);
+
+    OrchestratorContext orchestratorContext;
+
+    JobSubmitter jobSubmitter;
+
+    public JobSubmitterWorker(OrchestratorContext orchestratorContext) throws OrchestratorException{
+
+        this.orchestratorContext = orchestratorContext;
+
+        URL resource =
+                JobSubmitterWorker.class.getClassLoader().getResource(OrchestratorConstants.ORCHESTRATOR_PROPERTIES);
+
+        if(resource == null){
+            throw new OrchestratorException("orchestrator.properties cannot found");
+        }
+        Properties orchestratorProps = new Properties();
+        try {
+            orchestratorProps.load(resource.openStream());
+            String submitterClass = (String)orchestratorProps.get("job.submitter");
+            Class<? extends JobSubmitter> aClass = Class.forName(submitterClass.trim()).asSubclass(JobSubmitter.class);
+            jobSubmitter = aClass.newInstance();
+        } catch (IOException e) {
+            logger.error("Error reading orchestrator.properties");
+            throw new OrchestratorException(e);
+        } catch (ClassNotFoundException e) {
+            logger.error("Error while loading Job Submitter");
+        } catch (InstantiationException e) {
+            logger.error("Error while loading Job Submitter");
+            throw new OrchestratorException(e);
+        } catch (IllegalAccessException e) {
+            logger.error("Error while loading Job Submitter");
+            throw new OrchestratorException(e);
+        }
+
+    }
+
+    public void run() {
+         /* implement logic to submit job batches time to time */
+    }
+
+    public OrchestratorContext getOrchestratorContext() {
+        return orchestratorContext;
+    }
+
+    public void setOrchestratorContext(OrchestratorContext orchestratorContext) {
+        this.orchestratorContext = orchestratorContext;
+    }
+}

Added: airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/exception/OrchestratorException.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/exception/OrchestratorException.java?rev=1553990&view=auto
==============================================================================
--- airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/exception/OrchestratorException.java (added)
+++ airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/exception/OrchestratorException.java Sun Dec 29 04:03:59 2013
@@ -0,0 +1,37 @@
+/*
+ *
+ * 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.exception;
+
+public class OrchestratorException extends Exception{
+    private static final long serialVersionUID = -2849422320139467602L;
+
+    public OrchestratorException(Throwable e) {
+        super(e);
+    }
+
+    public OrchestratorException(String message) {
+        super(message, null);
+    }
+
+    public OrchestratorException(String message, Throwable e) {
+        super(message, e);
+    }
+}

Modified: airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/gfac/GFACInstance.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/gfac/GFACInstance.java?rev=1553990&r1=1553989&r2=1553990&view=diff
==============================================================================
--- airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/gfac/GFACInstance.java (original)
+++ airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/gfac/GFACInstance.java Sun Dec 29 04:03:59 2013
@@ -20,5 +20,29 @@
 */
 package org.apache.airavata.orchestrator.core.gfac;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public class GFACInstance {
+    private final static Logger logger = LoggerFactory.getLogger(GFACInstance.class);
+
+    private String gfacURL;
+
+    private int currentLoad;
+
+    public String getGfacURL() {
+        return gfacURL;
+    }
+
+    public void setGfacURL(String gfacURL) {
+        this.gfacURL = gfacURL;
+    }
+
+    public int getCurrentLoad() {
+        return currentLoad;
+    }
+
+    public void setCurrentLoad(int currentLoad) {
+        this.currentLoad = currentLoad;
+    }
 }

Modified: airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/SimpleJobSubmitter.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/SimpleJobSubmitter.java?rev=1553990&r1=1553989&r2=1553990&view=diff
==============================================================================
--- airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/SimpleJobSubmitter.java (original)
+++ airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/SimpleJobSubmitter.java Sun Dec 29 04:03:59 2013
@@ -23,9 +23,11 @@ package org.apache.airavata.orchestrator
 import org.apache.airavata.orchestrator.core.context.OrchestratorContext;
 import org.apache.airavata.orchestrator.core.gfac.GFACInstance;
 import org.apache.airavata.orchestrator.core.job.JobSubmitter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class SimpleJobSubmitter implements JobSubmitter{
-
+    private final static Logger logger = LoggerFactory.getLogger(SimpleJobSubmitter.class);
     public GFACInstance selectGFACInstance(OrchestratorContext context) {
         return null;
     }

Added: airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorConstants.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorConstants.java?rev=1553990&view=auto
==============================================================================
--- airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorConstants.java (added)
+++ airavata/sandbox/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorConstants.java Sun Dec 29 04:03:59 2013
@@ -0,0 +1,26 @@
+/*
+ *
+ * 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.utils;
+
+public class OrchestratorConstants {
+    private static final String SUBMITTER_PROPERTY = "job.submitter";
+    public static final String ORCHESTRATOR_PROPERTIES = "orchestrator.properties";
+}

Modified: airavata/sandbox/orchestrator/orchestrator-core/src/main/resources/orchestrator.properties
URL: http://svn.apache.org/viewvc/airavata/sandbox/orchestrator/orchestrator-core/src/main/resources/orchestrator.properties?rev=1553990&r1=1553989&r2=1553990&view=diff
==============================================================================
--- airavata/sandbox/orchestrator/orchestrator-core/src/main/resources/orchestrator.properties (original)
+++ airavata/sandbox/orchestrator/orchestrator-core/src/main/resources/orchestrator.properties Sun Dec 29 04:03:59 2013
@@ -0,0 +1 @@
+job.submitter=org.apache.airavata.orchestrator.core.impl.SimpleJobSubmitter
\ No newline at end of file