diff --git a/azkaban-common/src/main/java/azkaban/executor/ExecutorManager.java b/azkaban-common/src/main/java/azkaban/executor/ExecutorManager.java
index 91aecaf..ff3951e 100644
--- a/azkaban-common/src/main/java/azkaban/executor/ExecutorManager.java
+++ b/azkaban-common/src/main/java/azkaban/executor/ExecutorManager.java
@@ -1378,7 +1378,7 @@ public class ExecutorManager extends EventHandler implements
private void finalizeFlows(ExecutableFlow flow) {
int execId = flow.getExecutionId();
-
+ boolean alertUser = true;
updaterStage = "finalizing flow " + execId;
// First we check if the execution in the datastore is complete
try {
@@ -1413,6 +1413,7 @@ public class ExecutorManager extends EventHandler implements
recentlyFinished.put(execId, dsFlow);
} catch (ExecutorManagerException e) {
+ alertUser = false; // failed due to azkaban internal error, not to alert user
logger.error(e);
}
@@ -1421,58 +1422,56 @@ public class ExecutorManager extends EventHandler implements
// the reference.
updaterStage = "finalizing flow " + execId + " alerting and emailing";
- ExecutionOptions options = flow.getExecutionOptions();
- // But we can definitely email them.
- Alerter mailAlerter = alerters.get("email");
- if (flow.getStatus() == Status.FAILED || flow.getStatus() == Status.KILLED) {
- if (options.getFailureEmails() != null
- && !options.getFailureEmails().isEmpty()) {
- try {
- mailAlerter.alertOnError(flow);
- } catch (Exception e) {
- logger.error(e);
- }
- }
- if (options.getFlowParameters().containsKey("alert.type")) {
- String alertType = options.getFlowParameters().get("alert.type");
- Alerter alerter = alerters.get(alertType);
- if (alerter != null) {
+ if(alertUser) {
+ ExecutionOptions options = flow.getExecutionOptions();
+ // But we can definitely email them.
+ Alerter mailAlerter = alerters.get("email");
+ if (flow.getStatus() == Status.FAILED || flow.getStatus() == Status.KILLED) {
+ if (options.getFailureEmails() != null && !options.getFailureEmails().isEmpty()) {
try {
- alerter.alertOnError(flow);
+ mailAlerter.alertOnError(flow);
} catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- logger.error("Failed to alert by " + alertType);
+ logger.error(e);
}
- } else {
- logger.error("Alerter type " + alertType
- + " doesn't exist. Failed to alert.");
}
- }
- } else {
- if (options.getSuccessEmails() != null
- && !options.getSuccessEmails().isEmpty()) {
- try {
-
- mailAlerter.alertOnSuccess(flow);
- } catch (Exception e) {
- logger.error(e);
+ if (options.getFlowParameters().containsKey("alert.type")) {
+ String alertType = options.getFlowParameters().get("alert.type");
+ Alerter alerter = alerters.get(alertType);
+ if (alerter != null) {
+ try {
+ alerter.alertOnError(flow);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ logger.error("Failed to alert by " + alertType);
+ }
+ } else {
+ logger.error("Alerter type " + alertType + " doesn't exist. Failed to alert.");
+ }
}
- }
- if (options.getFlowParameters().containsKey("alert.type")) {
- String alertType = options.getFlowParameters().get("alert.type");
- Alerter alerter = alerters.get(alertType);
- if (alerter != null) {
+ } else {
+ if (options.getSuccessEmails() != null && !options.getSuccessEmails().isEmpty()) {
try {
- alerter.alertOnSuccess(flow);
+
+ mailAlerter.alertOnSuccess(flow);
} catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- logger.error("Failed to alert by " + alertType);
+ logger.error(e);
+ }
+ }
+ if (options.getFlowParameters().containsKey("alert.type")) {
+ String alertType = options.getFlowParameters().get("alert.type");
+ Alerter alerter = alerters.get(alertType);
+ if (alerter != null) {
+ try {
+ alerter.alertOnSuccess(flow);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ logger.error("Failed to alert by " + alertType);
+ }
+ } else {
+ logger.error("Alerter type " + alertType + " doesn't exist. Failed to alert.");
}
- } else {
- logger.error("Alerter type " + alertType
- + " doesn't exist. Failed to alert.");
}
}
}