You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2015/05/12 21:13:48 UTC

airavata git commit: moving code

Repository: airavata
Updated Branches:
  refs/heads/master e0ce54113 -> 747d766ff


moving code


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

Branch: refs/heads/master
Commit: 747d766ff4918cec2e5a16afbc7acb54303c55cd
Parents: e0ce541
Author: Chathuri Wimalasena <ch...@apache.org>
Authored: Tue May 12 15:13:41 2015 -0400
Committer: Chathuri Wimalasena <ch...@apache.org>
Committed: Tue May 12 15:13:41 2015 -0400

----------------------------------------------------------------------
 .../airavata/gfac/core/cpi/BetterGfacImpl.java  |   8 +-
 .../gfac/core/states/GfacExperimentState.java   | 108 ++++++++++++-------
 .../gfac/core/states/GfacHandlerState.java      |  65 +++++++++++
 .../airavata/gfac/core/utils/GFacUtils.java     |   4 +-
 4 files changed, 142 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/747d766f/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
index 55894a3..8385d48 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
@@ -810,7 +810,7 @@ public class BetterGfacImpl implements GFac,Watcher {
         GFacProvider provider = jobExecutionContext.getProvider();
         if (provider != null) {
             monitorPublisher.publish(new GfacExperimentStateChangeRequest(new MonitorID(jobExecutionContext), GfacExperimentState.PROVIDERINVOKING));
-            GfacPluginState plState = GFacUtils.getPluginState(zk, jobExecutionContext, provider.getClass().getName());
+            GfacPluginState plState = GFacUtils.getHandlerState(zk, jobExecutionContext, provider.getClass().getName());
             GFacUtils.createPluginZnode(zk, jobExecutionContext, provider.getClass().getName());
             if (plState != null && plState == GfacPluginState.INVOKING) {    // this will make sure if a plugin crashes it will not launch from the scratch, but plugins have to save their invoked state
                 initProvider(provider, jobExecutionContext);
@@ -850,7 +850,7 @@ public class BetterGfacImpl implements GFac,Watcher {
         GFacProvider provider = jobExecutionContext.getProvider();
         if (provider != null) {
             monitorPublisher.publish(new GfacExperimentStateChangeRequest(new MonitorID(jobExecutionContext), GfacExperimentState.PROVIDERINVOKING));
-            GfacPluginState plState = GFacUtils.getPluginState(zk, jobExecutionContext, provider.getClass().getName());
+            GfacPluginState plState = GFacUtils.getHandlerState(zk, jobExecutionContext, provider.getClass().getName());
             GFacUtils.createPluginZnode(zk, jobExecutionContext, provider.getClass().getName());
             if (plState == GfacPluginState.UNKNOWN || plState == GfacPluginState.INVOKING) {    // this will make sure if a plugin crashes it will not launch from the scratch, but plugins have to save their invoked state
                 initProvider(provider, jobExecutionContext);
@@ -1092,7 +1092,7 @@ public class BetterGfacImpl implements GFac,Watcher {
                 try {
                     handlerClass = Class.forName(handlerClassName.getClassName().trim()).asSubclass(GFacHandler.class);
                     handler = handlerClass.newInstance();
-                    GfacPluginState plState = GFacUtils.getPluginState(zk, jobExecutionContext, handlerClassName.getClassName());
+                    GfacPluginState plState = GFacUtils.getHandlerState(zk, jobExecutionContext, handlerClassName.getClassName());
                     GFacUtils.createPluginZnode(zk, jobExecutionContext, handlerClassName.getClassName(), GfacPluginState.INVOKING);
                     handler.initProperties(handlerClassName.getProperties());
                     if (plState == GfacPluginState.UNKNOWN || plState == GfacPluginState.INVOKING) {
@@ -1174,7 +1174,7 @@ public class BetterGfacImpl implements GFac,Watcher {
             try {
                 handlerClass = Class.forName(handlerClassName.getClassName().trim()).asSubclass(GFacHandler.class);
                 handler = handlerClass.newInstance();
-                GfacPluginState plState = GFacUtils.getPluginState(zk, jobExecutionContext, handlerClassName.getClassName());
+                GfacPluginState plState = GFacUtils.getHandlerState(zk, jobExecutionContext, handlerClassName.getClassName());
                 GFacUtils.createPluginZnode(zk, jobExecutionContext, handlerClassName.getClassName(), GfacPluginState.INVOKING);
                 if (plState == GfacPluginState.UNKNOWN || plState == GfacPluginState.INVOKING) {
                     log.info(handlerClassName.getClassName() + " never ran so we run this in normal mode");

http://git-wip-us.apache.org/repos/asf/airavata/blob/747d766f/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/states/GfacExperimentState.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/states/GfacExperimentState.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/states/GfacExperimentState.java
index 763a876..5e72b14 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/states/GfacExperimentState.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/states/GfacExperimentState.java
@@ -1,19 +1,19 @@
-/*
- * 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.
- */
+    /*
+     * 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.
+     */
 /**
  * Autogenerated by Thrift Compiler (0.9.1)
  *
@@ -23,30 +23,64 @@
 package org.apache.airavata.gfac.core.states;
 
 
-public enum GfacExperimentState {
-    LAUNCHED(0),
-    ACCEPTED(1),
-    INHANDLERSINVOKING(2),
-    INHANDLERSINVOKED(3),
-    PROVIDERINVOKING(4),
-    PROVIDERINVOKED(5),
-    OUTHANDLERSINVOKING(6),
-    OUTHANDLERSINVOKED(7),
-    COMPLETED(8),
-    FAILED(9),
-    UNKNOWN(10);
+import org.apache.thrift.TEnum;
+
+    @SuppressWarnings("all") public enum GfacExperimentState implements TEnum {
+      LAUNCHED(0),
+      ACCEPTED(1),
+      INHANDLERSINVOKING(2),
+      INHANDLERSINVOKED(3),
+      PROVIDERINVOKING(4),
+      PROVIDERINVOKED(5),
+      OUTHANDLERSINVOKING(6),
+      OUTHANDLERSINVOKED(7),
+      COMPLETED(8),
+      FAILED(9),
+      UNKNOWN(10);
 
-    private final int value;
+      private final int value;
 
-    private GfacExperimentState(int value) {
+      private GfacExperimentState(int value) {
         this.value = value;
-    }
+      }
 
-    /**
-     * Get the integer value of this enum value, as defined in the Thrift IDL.
-     */
-    public int getValue() {
+      /**
+       * Get the integer value of this enum value, as defined in the Thrift IDL.
+       */
+      public int getValue() {
         return value;
-    }
+      }
 
-}
+      /**
+       * Find a the enum type by its integer value, as defined in the Thrift IDL.
+       * @return null if the value is not found.
+       */
+      public static GfacExperimentState findByValue(int value) {
+        switch (value) {
+          case 0:
+            return LAUNCHED;
+          case 1:
+            return ACCEPTED;
+          case 2:
+            return INHANDLERSINVOKING;
+          case 3:
+            return INHANDLERSINVOKED;
+          case 4:
+            return PROVIDERINVOKING;
+          case 5:
+            return PROVIDERINVOKED;
+          case 6:
+            return OUTHANDLERSINVOKING;
+          case 7:
+            return OUTHANDLERSINVOKED;
+          case 8:
+            return COMPLETED;
+          case 9:
+            return FAILED;
+          case 10:
+            return UNKNOWN;
+          default:
+            return null;
+        }
+      }
+    }

http://git-wip-us.apache.org/repos/asf/airavata/blob/747d766f/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/states/GfacHandlerState.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/states/GfacHandlerState.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/states/GfacHandlerState.java
new file mode 100644
index 0000000..563e2f5
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/states/GfacHandlerState.java
@@ -0,0 +1,65 @@
+    /*
+     * 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.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.gfac.core.states;
+
+
+import org.apache.thrift.TEnum;
+
+    @SuppressWarnings("all") public enum GfacHandlerState implements TEnum {
+      INVOKING(0),
+      INVOKED(1),
+      COMPLETED(2),
+      UNKNOWN(3);
+
+      private final int value;
+
+      private GfacHandlerState(int value) {
+        this.value = value;
+      }
+
+      /**
+       * Get the integer value of this enum value, as defined in the Thrift IDL.
+       */
+      public int getValue() {
+        return value;
+      }
+
+      /**
+       * Find a the enum type by its integer value, as defined in the Thrift IDL.
+       * @return null if the value is not found.
+       */
+      public static GfacHandlerState findByValue(int value) {
+        switch (value) {
+          case 0:
+            return INVOKING;
+          case 1:
+            return INVOKED;
+          case 2:
+            return COMPLETED;
+          case 3:
+            return UNKNOWN;
+          default:
+            return null;
+        }
+      }
+    }

http://git-wip-us.apache.org/repos/asf/airavata/blob/747d766f/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
index 205c1e3..3b5d0ef 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
@@ -1025,8 +1025,8 @@ public class GFacUtils {
 		return false;
 	}
 
-	public static GfacPluginState getPluginState(ZooKeeper zk,
-                                                 JobExecutionContext jobExecutionContext, String className) {
+	public static GfacPluginState getHandlerState(ZooKeeper zk,
+                                                  JobExecutionContext jobExecutionContext, String className) {
 		try {
 			String expState = AiravataZKUtils.getExpZnodeHandlerPath(
 					jobExecutionContext.getExperimentID(), className);