當前位置: 首頁>>代碼示例>>Java>>正文


Java Output.getVerboseMsg方法代碼示例

本文整理匯總了Java中org.apache.kylin.job.execution.Output.getVerboseMsg方法的典型用法代碼示例。如果您正苦於以下問題:Java Output.getVerboseMsg方法的具體用法?Java Output.getVerboseMsg怎麽用?Java Output.getVerboseMsg使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.kylin.job.execution.Output的用法示例。


在下文中一共展示了Output.getVerboseMsg方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: formatNotifications

import org.apache.kylin.job.execution.Output; //導入方法依賴的package包/類
@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);
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:39,代碼來源:CubingJob.java

示例2: formatNotifications

import org.apache.kylin.job.execution.Output; //導入方法依賴的package包/類
@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);
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:53,代碼來源:CubingJob.java


注:本文中的org.apache.kylin.job.execution.Output.getVerboseMsg方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。