Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Adding failure emails to be sent separately from success emails #1

Merged
merged 1 commit into from

2 participants

@rsumbaly

No description provided.

@rbpark rbpark merged commit 4170c3e into rbpark:executor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 2, 2012
  1. @rsumbaly

    Adding notify.failure.emails

    rsumbaly authored
This page is out of date. Refresh to see the latest.
View
21 azkaban/src/java/azkaban/app/JobDescriptor.java
@@ -29,12 +29,12 @@
* A job descriptor represents the configuration information for a job This
* includes the job class, the job properties, the job dependencies, and the
* job's id.
- *
+ *
* This serves as a template for creating Job instances when the time comes to
* run the Job.
- *
+ *
* @author jkreps
- *
+ *
*/
public class JobDescriptor {
@@ -46,6 +46,7 @@
public static final String RETRY_BACKOFF = "retry.backoff";
public static final String JOB_PERMITS = "job.permits";
public static final String NOTIFY_EMAIL = "notify.emails";
+ public static final String NOTIFY_FAILURE_EMAIL = "notify.failure.emails";
public static final String LOGGER_PATTERN = "logger.pattern";
public static final String MAIL_SENDER = "mail.sender";
public static final String SEND_SUCCESS_EMAIL = "azkaban.send.success.email";
@@ -71,6 +72,7 @@ public int compare(JobDescriptor d1, JobDescriptor d2) {
private final List<String> _writeResourceLocks;
private final String _sourceEmailList;
private final List<String> _emailList;
+ private final List<String> _failureEmailList;
private final String _jobType;
private final String _loggerPattern;
@@ -107,11 +109,12 @@ public JobDescriptor(String id, String conicalPath, String fullpath, Props props
Collections.sort(this._writeResourceLocks);
this._emailList = props.getStringList(NOTIFY_EMAIL);
+ this._failureEmailList = props.getStringList(NOTIFY_FAILURE_EMAIL);
}
/**
* Add a dependency to this job
- *
+ *
* @param dep
*/
public void addDependency(JobDescriptor dep) {
@@ -134,7 +137,7 @@ public String getId() {
public Props getProps() {
return this._props;
}
-
+
public boolean hasDependencies() {
return this._dependencies.size() > 0;
}
@@ -154,7 +157,7 @@ public String getPath() {
public String getFullPath() {
return this._fullpath;
}
-
+
@Override
public String toString() {
return String.format(
@@ -186,10 +189,14 @@ public int getNumRequiredPermits() {
return _emailList;
}
+ public List<String> getEmailFailureNotificationList() {
+ return _failureEmailList;
+ }
+
public String getJobType() {
return _jobType;
}
-
+
public String getSenderEmail() {
return _sourceEmailList;
}
View
6 azkaban/src/java/azkaban/jobs/JobExecutorManager.java
@@ -438,6 +438,8 @@ public void run() {
emailList = jobDescriptor.getEmailNotificationList();
final List<String> finalEmailList = emailList;
+ final List<String> failedEmailList = jobDescriptor.getEmailFailureNotificationList();
+
senderAddress = jobDescriptor.getSenderEmail();
final String senderEmail = senderAddress;
@@ -481,14 +483,14 @@ public void completed(Status status) {
sendErrorEmail(runningJob,
flow.getExceptions(),
senderEmail,
- finalEmailList);
+ failedEmailList);
break;
default:
sendErrorEmail(runningJob,
new RuntimeException(String.format("Got an unknown status[%s]",
status)),
senderEmail,
- finalEmailList);
+ failedEmailList);
}
} catch(RuntimeException e) {
logger.warn("Exception caught while saving flow/sending emails", e);
Something went wrong with that request. Please try again.