Details
diff --git a/azkaban-common/src/main/java/azkaban/jobExecutor/LongArgJob.java b/azkaban-common/src/main/java/azkaban/jobExecutor/LongArgJob.java
index 36ba23a..6c71e52 100644
--- a/azkaban-common/src/main/java/azkaban/jobExecutor/LongArgJob.java
+++ b/azkaban-common/src/main/java/azkaban/jobExecutor/LongArgJob.java
@@ -69,6 +69,9 @@ public abstract class LongArgJob extends AbstractProcessJob {
File[] propFiles = initPropsFiles();
+ // print out the Job properties to the job log.
+ info("Job properties:" + this.jobProps.getFlattened());
+
boolean success = false;
this.process = builder.build();
try {
diff --git a/azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java b/azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
index 18b7ffa..8c3e2d8 100644
--- a/azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
+++ b/azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
@@ -93,6 +93,9 @@ public class ProcessJob extends AbstractProcessJob {
}
info("Working directory: " + builder.getWorkingDir());
+ // print out the Job properties to the job log.
+ info("Job properties:" + this.jobProps.getFlattened());
+
boolean success = false;
this.process = builder.build();
@@ -120,7 +123,7 @@ public class ProcessJob extends AbstractProcessJob {
* This is used to get the min/max memory size requirement by processes.
* SystemMemoryInfo can use the info to determine if the memory request
* can be fulfilled. For Java process, this should be Xms/Xmx setting.
- *
+ *
* @return pair of min/max memory size
*/
protected Pair<Long, Long> getProcMemoryRequirement() throws Exception {
diff --git a/azkaban-common/src/main/java/azkaban/utils/Props.java b/azkaban-common/src/main/java/azkaban/utils/Props.java
index db2b8fe..988ef92 100644
--- a/azkaban-common/src/main/java/azkaban/utils/Props.java
+++ b/azkaban-common/src/main/java/azkaban/utils/Props.java
@@ -809,6 +809,24 @@ public class Props {
p.store(out, null);
}
+
+ /**
+ * Returns a map of all the flattened properties
+ *
+ * @Return
+ */
+ public Map<String,String> getFlattened(){
+ Map<String,String> returnVal = new HashMap<String,String>();
+ // to keep the logic in sync with the rest piece of code,
+ // when there is a conflict, value from the child takes the priority.
+ for (Props curr = this; curr != null; curr = curr.getParent()) {
+ for (String key : curr.localKeySet()) {
+ returnVal.putIfAbsent(key, curr.get(key));
+ }
+ }
+
+ return returnVal;
+ }
/**
* Get a map of all properties by string prefix
diff --git a/azkaban-common/src/test/java/azkaban/utils/PropsUtilsTest.java b/azkaban-common/src/test/java/azkaban/utils/PropsUtilsTest.java
index 158558e..b71aa8a 100644
--- a/azkaban-common/src/test/java/azkaban/utils/PropsUtilsTest.java
+++ b/azkaban-common/src/test/java/azkaban/utils/PropsUtilsTest.java
@@ -17,6 +17,7 @@
package azkaban.utils;
import java.io.IOException;
+import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
@@ -127,6 +128,40 @@ public class PropsUtilsTest {
}
@Test
+ public void testGetFlattenedProps() throws Exception {
+
+ // for empty props empty flattened map is expected to be returned.
+ Props grandParentProps = new Props();
+ Assert.assertTrue(grandParentProps.getFlattened().isEmpty());
+
+ // single level
+ grandParentProps.put("test1","value1");
+ grandParentProps.put("test2","value2");
+ Map<String,String> set = grandParentProps.getFlattened();
+ Assert.assertEquals(2,set.size());
+ Assert.assertEquals("value1", set.get("test1"));
+ Assert.assertEquals("value2", set.get("test2"));
+
+ // multiple levels .
+ Props parentProps = new Props(grandParentProps);
+ parentProps.put("test3","value3");
+ parentProps.put("test4","value4");
+ set = parentProps.getFlattened();
+ Assert.assertEquals(4,set.size());
+ Assert.assertEquals("value3", set.get("test3"));
+ Assert.assertEquals("value1", set.get("test1"));
+
+ // multiple levels with same keys .
+ Props props = new Props(parentProps);
+ props.put("test5","value5");
+ props.put("test1","value1.1");
+ set = props.getFlattened();
+ Assert.assertEquals(5,set.size());
+ Assert.assertEquals("value5", set.get("test5"));
+ Assert.assertEquals("value1.1", set.get("test1"));
+ }
+
+ @Test
public void testCyclesResolveProps() throws IOException {
Props propsGrandParent = new Props();
Props propsParent = new Props(propsGrandParent);