/** {@inheritDoc} */ @Override public void onStatusChange(JobExecutionState state, RunningState previousStatus, RunningState newStatus) { if (_log.isPresent()) { _log.get().info("JobExection status change for " + state.getJobSpec().toShortString() + ": " + previousStatus + " --> " + newStatus); } }
/** {@inheritDoc} */ @Override public void onStageTransition(JobExecutionState state, String previousStage, String newStage) { if (_log.isPresent()) { _log.get().info("JobExection stage change for " + state.getJobSpec().toShortString() + ": " + previousStage + " --> " + newStage); } }
/** {@inheritDoc} */ @Override public void onMetadataChange(JobExecutionState state, String key, Object oldValue, Object newValue) { if (this.filter.apply(state.getJobSpec())) { this.delegate.onMetadataChange(state, key, oldValue, newValue); } }
/** {@inheritDoc} */ @Override public void onStatusChange(JobExecutionState state, RunningState previousStatus, RunningState newStatus) { if (_log.isPresent()) { _log.get().info("JobExection status change for " + state.getJobSpec().toShortString() + ": " + previousStatus + " --> " + newStatus); } }
/** {@inheritDoc} */ @Override public void onMetadataChange(JobExecutionState state, String key, Object oldValue, Object newValue) { if (_log.isPresent()) { _log.get().info("JobExection metadata change for " + state.getJobSpec().toShortString() + key + ": '" + oldValue + "' --> '" + newValue + "'"); } }
/** {@inheritDoc} */ @Override public void onStatusChange(JobExecutionState state, RunningState previousStatus, RunningState newStatus) { if (this.filter.apply(state.getJobSpec())) { this.delegate.onStatusChange(state, previousStatus, newStatus); } }
/** {@inheritDoc} */ @Override public void onStageTransition(JobExecutionState state, String previousStage, String newStage) { if (this.filter.apply(state.getJobSpec())) { this.delegate.onStageTransition(state, previousStage, newStage); } }
/** {@inheritDoc} */ @Override public void onStageTransition(JobExecutionState state, String previousStage, String newStage) { if (_log.isPresent()) { _log.get().info("JobExection stage change for " + state.getJobSpec().toShortString() + ": " + previousStage + " --> " + newStage); } }
/** {@inheritDoc} */ @Override public void onMetadataChange(JobExecutionState state, String key, Object oldValue, Object newValue) { if (_log.isPresent()) { _log.get().info("JobExection metadata change for " + state.getJobSpec().toShortString() + key + ": '" + oldValue + "' --> '" + newValue + "'"); } }
private static String getEmailBody(JobExecutionState state, RunningState previousStatus, RunningState newStatus) { return new StringBuilder().append("RunningState: ").append(newStatus.toString()).append("\n") .append("JobExecutionState: ").append(state.getJobSpec().toLongString()).append("\n") .append("ExecutionMetadata: ").append(state.getExecutionMetadata()).toString(); }
@Override public void onJobLaunch(JobExecutionDriver jobDriver) { if (this.filter.apply(jobDriver.getJobExecutionState().getJobSpec())) { this.delegate.onJobLaunch(jobDriver); } }
ConfigUtils.getBoolean(state.getJobSpec().getConfig(), ConfigurationKeys.ALERT_EMAIL_ENABLED_KEY, false); boolean notificationEmailEnabled = ConfigUtils.getBoolean(state.getJobSpec().getConfig(), ConfigurationKeys.NOTIFICATION_EMAIL_ENABLED_KEY, false); LOGGER.info("Sending job failure email for job: {}", state.getJobSpec().toShortString()); EmailUtils.sendJobFailureAlertEmail(state.getJobSpec().toShortString(), getEmailBody(state, previousStatus, newStatus), 1, ConfigUtils.configToState(state.getJobSpec().getConfig())); } catch (EmailException ee) { LOGGER.error("Failed to send job failure alert email for job " + state.getJobSpec().toShortString(), ee); LOGGER.info("Sending job completion email for job: {}", state.getJobSpec().toShortString()); EmailUtils.sendJobCompletionEmail(state.getJobSpec().toShortString(), getEmailBody(state, previousStatus, newStatus), newStatus.toString(), ConfigUtils.configToState(state.getJobSpec().getConfig())); } catch (EmailException ee) { LOGGER.error("Failed to send job completion notification email for job " + state.getJobSpec().toShortString(), ee);