iota-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tonyfaust...@apache.org
Subject [08/10] incubator-iota git commit: Saving orchestration name on checkpoint
Date Wed, 28 Sep 2016 01:19:18 GMT
Saving orchestration name on checkpoint


Project: http://git-wip-us.apache.org/repos/asf/incubator-iota/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-iota/commit/5e0ccb89
Tree: http://git-wip-us.apache.org/repos/asf/incubator-iota/tree/5e0ccb89
Diff: http://git-wip-us.apache.org/repos/asf/incubator-iota/diff/5e0ccb89

Branch: refs/heads/master
Commit: 5e0ccb890bbc7cfa26e327eeb46bc19a4559abc2
Parents: adf71bb
Author: Barbara Gomes <barbaramaltagomes@gmail.com>
Authored: Fri Jul 29 13:10:49 2016 -0700
Committer: Barbara Gomes <barbaramaltagomes@gmail.com>
Committed: Fri Jul 29 13:10:49 2016 -0700

----------------------------------------------------------------------
 fey-core/src/main/scala/org/apache/iota/fey/Orchestration.scala | 4 ++++
 fey-core/src/main/scala/org/apache/iota/fey/Utils.scala         | 5 +++--
 2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/5e0ccb89/fey-core/src/main/scala/org/apache/iota/fey/Orchestration.scala
----------------------------------------------------------------------
diff --git a/fey-core/src/main/scala/org/apache/iota/fey/Orchestration.scala b/fey-core/src/main/scala/org/apache/iota/fey/Orchestration.scala
index dc2e64d..d247279 100644
--- a/fey-core/src/main/scala/org/apache/iota/fey/Orchestration.scala
+++ b/fey-core/src/main/scala/org/apache/iota/fey/Orchestration.scala
@@ -104,6 +104,7 @@ protected class Orchestration(val name: String,
   private def replayOrchestrationState() = {
     val ensemblesSpec = ORCHESTRATION_CACHE.orchestration_metadata.get(guid).get.map(_._2).toList
     ORCHESTRATION_CACHE.orchestration_metadata.remove(guid)
+    ORCHESTRATION_CACHE.orchestration_name.remove(guid)
     self ! CREATE_ENSEMBLES(ensemblesSpec)
   }
 
@@ -155,6 +156,7 @@ protected class Orchestration(val name: String,
       case None =>
       case Some(ensembles) =>
         ORCHESTRATION_CACHE.orchestration_metadata.put(guid, (ensembles -- ids))
+        ORCHESTRATION_CACHE.orchestration_name.put(guid, name)
     }
     Utils.updateOrchestrationState(guid)
   }
@@ -187,6 +189,7 @@ protected class Orchestration(val name: String,
       case Some(cachedEnsemble) =>
         ORCHESTRATION_CACHE.orchestration_metadata.put(guid, cachedEnsemble ++ (newEnsembles.map(ensemble
=> (ensemble._1, ensemble._3)).toMap))
     }
+    ORCHESTRATION_CACHE.orchestration_name.put(guid, name)
     Utils.updateOrchestrationState(guid)
   }
 
@@ -246,4 +249,5 @@ protected object ORCHESTRATION_CACHE{
     * Value = Map[Ensemble GUID, JsObject of the ensemble]
     */
   val orchestration_metadata: HashMap[String, Map[String,JsObject]] = HashMap.empty[String,
Map[String,JsObject]]
+  val orchestration_name: HashMap[String, String] = HashMap.empty
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/5e0ccb89/fey-core/src/main/scala/org/apache/iota/fey/Utils.scala
----------------------------------------------------------------------
diff --git a/fey-core/src/main/scala/org/apache/iota/fey/Utils.scala b/fey-core/src/main/scala/org/apache/iota/fey/Utils.scala
index 095785b..d4f3210 100644
--- a/fey-core/src/main/scala/org/apache/iota/fey/Utils.scala
+++ b/fey-core/src/main/scala/org/apache/iota/fey/Utils.scala
@@ -137,16 +137,17 @@ protected object Utils {
               file.delete()
             }
             ORCHESTRATION_CACHE.orchestration_metadata.remove(orchestrationID)
+            ORCHESTRATION_CACHE.orchestration_name.remove(orchestrationID)
           }
         case Some(orch) =>
           ORCHESTRATION_CACHE.orchestration_metadata.get(orchestrationID) match {
             case None => log.warn(s"Could not save state for Orchestration ${orchestrationID}.
No metadata defined.")
             case Some(metadata) =>
               val ensembleJSON = metadata.map(ensenble => ensenble._2)
-
+              val name: String = ORCHESTRATION_CACHE.orchestration_name.getOrElse(orchestrationID,
"NOT SAVED")
               val orchestrationSpec = Json.obj(JSON_PATH.GUID -> orchestrationID,
                 JSON_PATH.COMMAND -> "RECREATE",
-                JSON_PATH.ORCHESTRATION_NAME -> "I DONT KNOW HOW TO SAVE IT YET =P",
+                JSON_PATH.ORCHESTRATION_NAME -> name,
                 JSON_PATH.ORCHESTRATION_TIMESTAMP -> System.currentTimeMillis.toString,
                 JSON_PATH.ENSEMBLES -> ensembleJSON
               )


Mime
View raw message