AMATERASU-51: Add support for configuring the path for action level environment path
authorEran Bartenstein <eran.bartenstein@nab.com.au>
Fri, 23 Nov 2018 23:58:55 +0000 (10:58 +1100)
committerEran Bartenstein <eran.bartenstein@nab.com.au>
Fri, 23 Nov 2018 23:58:55 +0000 (10:58 +1100)
PArse action by JobParser and add it as a parameter to ActionData so that it could receive the parsed input from JobParser via SequentialAction

common/src/main/kotlin/org/apache/amaterasu/common/dataobjects/ActionData.kt
leader-common/src/main/kotlin/org/apache/amaterasu/leader/common/dsl/JobParser.kt
leader-common/src/main/kotlin/org/apache/amaterasu/leader/common/execution/actions/SequentialAction.kt
leader/src/main/scala/org/apache/amaterasu/leader/mesos/schedulers/JobScheduler.scala

index 7e19db2..dde0f35 100644 (file)
@@ -26,6 +26,7 @@ import org.apache.amaterasu.common.configuration.enums.ActionStatus
 data class ActionData(var status: ActionStatus = ActionStatus.pending,
                       var name: String= "",
                       var src: String= "",
+                      var config: String= "",
                       var groupId: String= "",
                       var typeId: String= "",
                       var id: String= "",
index 50c178f..eb80b40 100644 (file)
@@ -132,6 +132,7 @@ object JobParser {
 
         return  SequentialAction(action.path("name").asText(),
                 action.path("file").asText(),
+                action.path("config").asText(),
                 action.path("runner").path("group").asText(),
                 action.path("runner").path("type").asText(),
                 action.path("exports").fields().asSequence().map { it.key to it.value.asText() }.toMap(),
index 6362e89..ea864f1 100644 (file)
@@ -24,6 +24,7 @@ import java.util.concurrent.BlockingQueue
 
 class SequentialAction(name: String,
                        src: String,
+                       config: String,
                        groupId: String,
                        typeId: String,
                        exports: Map<String, String>,
@@ -42,9 +43,9 @@ class SequentialAction(name: String,
         this.attempts = attempts
         this.jobId = jobId
         val javaExports = exports
-        data = ActionData(ActionStatus.pending, name, src, groupId, typeId, actionId, javaExports, arrayListOf())
+        data = ActionData(ActionStatus.pending, name, src, config, groupId, typeId, actionId, javaExports, arrayListOf())
         jobsQueue = queue
         client = zkClient
 
     }
-}
\ No newline at end of file
+}
index 3863ae2..751a393 100755 (executable)
@@ -159,7 +159,7 @@ class JobScheduler extends AmaterasuScheduler {
             val taskId = Protos.TaskID.newBuilder().setValue(actionData.getId).build()
 
             // setting up the configuration files for the container
-            val envYaml = configManager.getActionConfigContent(actionData.getName, "") //TODO: replace with the value in actionData.config
+            val envYaml = configManager.getActionConfigContent(actionData.getName, actionData.getConfig)
             writeConfigFile(envYaml, jobManager.getJobId, actionData.getName, "env.yaml")
 
             val dataStores = DataLoader.getTaskData(actionData, env).exports