本文整理匯總了Java中org.apache.kylin.job.constant.ExecutableConstants.NOTIFY_EMAIL_TEMPLATE屬性的典型用法代碼示例。如果您正苦於以下問題:Java ExecutableConstants.NOTIFY_EMAIL_TEMPLATE屬性的具體用法?Java ExecutableConstants.NOTIFY_EMAIL_TEMPLATE怎麽用?Java ExecutableConstants.NOTIFY_EMAIL_TEMPLATE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.kylin.job.constant.ExecutableConstants
的用法示例。
在下文中一共展示了ExecutableConstants.NOTIFY_EMAIL_TEMPLATE屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleMetaDataPersistException
/**
* build fail because the metadata store has problem.
* @param exception
*/
@Override
protected void handleMetaDataPersistException(Exception exception) {
String title = "[ERROR] - [" + getDeployEnvName() + "] - [" + getProjectName() + "] - "
+ CubingExecutableUtil.getCubeName(this.getParams());
String content = ExecutableConstants.NOTIFY_EMAIL_TEMPLATE;
final String UNKNOWN = "UNKNOWN";
String errMsg = null;
if (exception != null) {
final StringWriter out = new StringWriter();
exception.printStackTrace(new PrintWriter(out));
errMsg = out.toString();
}
content = content.replaceAll("\\$\\{job_name\\}", getName());
content = content.replaceAll("\\$\\{result\\}", ExecutableState.ERROR.toString());
content = content.replaceAll("\\$\\{env_name\\}", getDeployEnvName());
content = content.replaceAll("\\$\\{project_name\\}", getProjectName());
content = content.replaceAll("\\$\\{cube_name\\}", CubingExecutableUtil.getCubeName(this.getParams()));
content = content.replaceAll("\\$\\{source_records_count\\}", UNKNOWN);
content = content.replaceAll("\\$\\{start_time\\}", UNKNOWN);
content = content.replaceAll("\\$\\{duration\\}", UNKNOWN);
content = content.replaceAll("\\$\\{mr_waiting\\}", UNKNOWN);
content = content.replaceAll("\\$\\{last_update_time\\}", UNKNOWN);
content = content.replaceAll("\\$\\{submitter\\}", StringUtil.noBlank(getSubmitter(), "missing submitter"));
content = content.replaceAll("\\$\\{error_log\\}",
Matcher.quoteReplacement(StringUtil.noBlank(errMsg, "no error message")));
try {
InetAddress inetAddress = InetAddress.getLocalHost();
content = content.replaceAll("\\$\\{job_engine\\}", inetAddress.getCanonicalHostName());
} catch (UnknownHostException e) {
logger.warn(e.getLocalizedMessage(), e);
}
sendMail(Pair.of(title, content));
}
示例2: formatNotifications
@Override
protected Pair<String, String> formatNotifications(ExecutableState state) {
final Output output = jobService.getOutput(getId());
String logMsg;
switch (output.getState()) {
case ERROR:
logMsg = output.getVerboseMsg();
break;
case DISCARDED:
logMsg = "";
break;
case SUCCEED:
logMsg = "";
break;
default:
return null;
}
String content = ExecutableConstants.NOTIFY_EMAIL_TEMPLATE;
content = content.replaceAll("\\$\\{job_name\\}", getName());
content = content.replaceAll("\\$\\{result\\}", state.toString());
content = content.replaceAll("\\$\\{cube_name\\}", getCubeName());
content = content.replaceAll("\\$\\{start_time\\}", new Date(getStartTime()).toString());
content = content.replaceAll("\\$\\{duration\\}", getDuration() / 60000 + "mins");
content = content.replaceAll("\\$\\{mr_waiting\\}", getMapReduceWaitTime() / 60000 + "mins");
content = content.replaceAll("\\$\\{last_update_time\\}", new Date(getLastModified()).toString());
content = content.replaceAll("\\$\\{submitter\\}", getSubmitter());
content = content.replaceAll("\\$\\{error_log\\}", logMsg);
try {
InetAddress inetAddress = InetAddress.getLocalHost();
content = content.replaceAll("\\$\\{job_engine\\}", inetAddress.getCanonicalHostName());
} catch (UnknownHostException e) {
logger.warn(e.getLocalizedMessage(), e);
}
String title = "["+ state.toString() + "] - [Kylin Cube Build Job]-" + getCubeName();
return Pair.of(title, content);
}
示例3: formatNotifications
@Override
protected Pair<String, String> formatNotifications(ExecutableContext context, ExecutableState state) {
CubeInstance cubeInstance = CubeManager.getInstance(context.getConfig())
.getCube(CubingExecutableUtil.getCubeName(this.getParams()));
final Output output = getManager().getOutput(getId());
String logMsg;
state = output.getState();
if (state != ExecutableState.ERROR
&& !cubeInstance.getDescriptor().getStatusNeedNotify().contains(state.toString())) {
logger.info("state:" + state + " no need to notify users");
return null;
}
switch (state) {
case ERROR:
logMsg = output.getVerboseMsg();
break;
case DISCARDED:
logMsg = "job has been discarded";
break;
case SUCCEED:
logMsg = "job has succeeded";
break;
default:
return null;
}
String content = ExecutableConstants.NOTIFY_EMAIL_TEMPLATE;
content = content.replaceAll("\\$\\{job_name\\}", getName());
content = content.replaceAll("\\$\\{result\\}", state.toString());
content = content.replaceAll("\\$\\{env_name\\}", getDeployEnvName());
content = content.replaceAll("\\$\\{project_name\\}", getProjectName());
content = content.replaceAll("\\$\\{cube_name\\}", CubingExecutableUtil.getCubeName(this.getParams()));
content = content.replaceAll("\\$\\{source_records_count\\}", String.valueOf(findSourceRecordCount()));
content = content.replaceAll("\\$\\{start_time\\}", new Date(getStartTime()).toString());
content = content.replaceAll("\\$\\{duration\\}", getDuration() / 60000 + "mins");
content = content.replaceAll("\\$\\{mr_waiting\\}", getMapReduceWaitTime() / 60000 + "mins");
content = content.replaceAll("\\$\\{last_update_time\\}", new Date(getLastModified()).toString());
content = content.replaceAll("\\$\\{submitter\\}", StringUtil.noBlank(getSubmitter(), "missing submitter"));
content = content.replaceAll("\\$\\{error_log\\}",
Matcher.quoteReplacement(StringUtil.noBlank(logMsg, "no error message")));
try {
InetAddress inetAddress = InetAddress.getLocalHost();
content = content.replaceAll("\\$\\{job_engine\\}", inetAddress.getCanonicalHostName());
} catch (UnknownHostException e) {
logger.warn(e.getLocalizedMessage(), e);
}
String title = "[" + state.toString() + "] - [" + getDeployEnvName() + "] - [" + getProjectName() + "] - "
+ CubingExecutableUtil.getCubeName(this.getParams());
return Pair.of(title, content);
}