Details
diff --git a/azkaban-common/src/main/java/azkaban/flow/FlowUtils.java b/azkaban-common/src/main/java/azkaban/flow/FlowUtils.java
new file mode 100644
index 0000000..2fe921d
--- /dev/null
+++ b/azkaban-common/src/main/java/azkaban/flow/FlowUtils.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2017 LinkedIn Corp.
+ *
+ * Licensed 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 azkaban.flow;
+
+import azkaban.executor.ExecutableFlowBase;
+import azkaban.utils.Props;
+import java.util.UUID;
+import org.joda.time.DateTime;
+
+public class FlowUtils {
+
+ public static Props addCommonFlowProperties(final Props parentProps,
+ final ExecutableFlowBase flow) {
+ final Props props = new Props(parentProps);
+
+ props.put(CommonJobProperties.FLOW_ID, flow.getFlowId());
+ props.put(CommonJobProperties.EXEC_ID, flow.getExecutionId());
+ props.put(CommonJobProperties.PROJECT_ID, flow.getProjectId());
+ props.put(CommonJobProperties.PROJECT_NAME, flow.getProjectName());
+ props.put(CommonJobProperties.PROJECT_VERSION, flow.getVersion());
+ props.put(CommonJobProperties.FLOW_UUID, UUID.randomUUID().toString());
+ props.put(CommonJobProperties.PROJECT_LAST_CHANGED_BY, flow.getLastModifiedByUser());
+ props.put(CommonJobProperties.PROJECT_LAST_CHANGED_DATE, flow.getLastModifiedTimestamp());
+ props.put(CommonJobProperties.SUBMIT_USER, flow.getExecutableFlow().getSubmitUser());
+
+ final DateTime loadTime = new DateTime();
+
+ props.put(CommonJobProperties.FLOW_START_TIMESTAMP, loadTime.toString());
+ props.put(CommonJobProperties.FLOW_START_YEAR, loadTime.toString("yyyy"));
+ props.put(CommonJobProperties.FLOW_START_MONTH, loadTime.toString("MM"));
+ props.put(CommonJobProperties.FLOW_START_DAY, loadTime.toString("dd"));
+ props.put(CommonJobProperties.FLOW_START_HOUR, loadTime.toString("HH"));
+ props.put(CommonJobProperties.FLOW_START_MINUTE, loadTime.toString("mm"));
+ props.put(CommonJobProperties.FLOW_START_SECOND, loadTime.toString("ss"));
+ props.put(CommonJobProperties.FLOW_START_MILLISSECOND,
+ loadTime.toString("SSS"));
+ props.put(CommonJobProperties.FLOW_START_TIMEZONE,
+ loadTime.toString("ZZZZ"));
+
+ return props;
+ }
+}
diff --git a/azkaban-common/src/main/java/azkaban/utils/PropsUtils.java b/azkaban-common/src/main/java/azkaban/utils/PropsUtils.java
index 8a8e1d1..6784f40 100644
--- a/azkaban-common/src/main/java/azkaban/utils/PropsUtils.java
+++ b/azkaban-common/src/main/java/azkaban/utils/PropsUtils.java
@@ -16,8 +16,6 @@
package azkaban.utils;
-import azkaban.executor.ExecutableFlowBase;
-import azkaban.flow.CommonJobProperties;
import com.google.common.collect.MapDifference;
import com.google.common.collect.Maps;
import java.io.File;
@@ -28,7 +26,6 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.jexl2.Expression;
@@ -37,7 +34,6 @@ import org.apache.commons.jexl2.JexlException;
import org.apache.commons.jexl2.MapContext;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
-import org.joda.time.DateTime;
public class PropsUtils {
@@ -284,37 +280,6 @@ public class PropsUtils {
return resolveVariableExpression(newValue, lastIndex, jexl);
}
- public static Props addCommonFlowProperties(final Props parentProps,
- final ExecutableFlowBase flow) {
- final Props props = new Props(parentProps);
-
- props.put(CommonJobProperties.FLOW_ID, flow.getFlowId());
- props.put(CommonJobProperties.EXEC_ID, flow.getExecutionId());
- props.put(CommonJobProperties.PROJECT_ID, flow.getProjectId());
- props.put(CommonJobProperties.PROJECT_NAME, flow.getProjectName());
- props.put(CommonJobProperties.PROJECT_VERSION, flow.getVersion());
- props.put(CommonJobProperties.FLOW_UUID, UUID.randomUUID().toString());
- props.put(CommonJobProperties.PROJECT_LAST_CHANGED_BY, flow.getLastModifiedByUser());
- props.put(CommonJobProperties.PROJECT_LAST_CHANGED_DATE, flow.getLastModifiedTimestamp());
- props.put(CommonJobProperties.SUBMIT_USER, flow.getExecutableFlow().getSubmitUser());
-
- final DateTime loadTime = new DateTime();
-
- props.put(CommonJobProperties.FLOW_START_TIMESTAMP, loadTime.toString());
- props.put(CommonJobProperties.FLOW_START_YEAR, loadTime.toString("yyyy"));
- props.put(CommonJobProperties.FLOW_START_MONTH, loadTime.toString("MM"));
- props.put(CommonJobProperties.FLOW_START_DAY, loadTime.toString("dd"));
- props.put(CommonJobProperties.FLOW_START_HOUR, loadTime.toString("HH"));
- props.put(CommonJobProperties.FLOW_START_MINUTE, loadTime.toString("mm"));
- props.put(CommonJobProperties.FLOW_START_SECOND, loadTime.toString("ss"));
- props.put(CommonJobProperties.FLOW_START_MILLISSECOND,
- loadTime.toString("SSS"));
- props.put(CommonJobProperties.FLOW_START_TIMEZONE,
- loadTime.toString("ZZZZ"));
-
- return props;
- }
-
public static String toJSONString(final Props props, final boolean localOnly) {
final Map<String, String> map = toStringMap(props, localOnly);
return JSONUtils.toJSON(map);
diff --git a/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java b/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
index 39ef01b..d5ac66f 100644
--- a/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
+++ b/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunner.java
@@ -37,6 +37,7 @@ import azkaban.executor.ExecutorLoader;
import azkaban.executor.ExecutorManagerException;
import azkaban.executor.Status;
import azkaban.flow.FlowProps;
+import azkaban.flow.FlowUtils;
import azkaban.jobExecutor.ProcessJob;
import azkaban.jobtype.JobTypeManager;
import azkaban.metric.MetricReportManager;
@@ -46,7 +47,6 @@ import azkaban.sla.SlaOption;
import azkaban.spi.AzkabanEventReporter;
import azkaban.spi.EventType;
import azkaban.utils.Props;
-import azkaban.utils.PropsUtils;
import azkaban.utils.SwapQueue;
import com.google.common.collect.ImmutableSet;
import java.io.File;
@@ -245,7 +245,7 @@ public class FlowRunner extends EventHandler implements Runnable {
final String flowId = this.flow.getFlowId();
// Add a bunch of common azkaban properties
- Props commonFlowProps = PropsUtils.addCommonFlowProperties(null, this.flow);
+ Props commonFlowProps = FlowUtils.addCommonFlowProperties(null, this.flow);
if (this.flow.getJobSource() != null) {
final String source = this.flow.getJobSource();