org.apache.kylin.job.execution.Output类的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.apache.kylin.job.execution.Output类的一些代码示例,展示了Output类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Output类的具体详情如下:
包路径:org.apache.kylin.job.execution.Output
类名称:Output

Output介绍

[英]Created by qianzhou on 1/6/15.
[中]钱周于2015年1月6日创作。

代码示例

代码示例来源:origin: apache/kylin

protected final boolean isDiscarded() {
  final ExecutableState status = getOutput().getState();
  return status == ExecutableState.DISCARDED;
}

代码示例来源:origin: apache/kylin

private JobInstance.JobStep parseToJobStep(AbstractExecutable task, int i, Output stepOutput) {
  Preconditions.checkNotNull(stepOutput);
  JobInstance.JobStep result = new JobInstance.JobStep();
  result.setId(task.getId());
  result.setName(task.getName());
  result.setSequenceID(i);
  result.setStatus(parseToJobStepStatus(stepOutput.getState()));
  for (Map.Entry<String, String> entry : stepOutput.getExtra().entrySet()) {
    if (entry.getKey() != null && entry.getValue() != null) {
      result.putInfo(entry.getKey(), entry.getValue());
    }
  }
  result.setExecStartTime(AbstractExecutable.getStartTime(stepOutput));
  result.setExecEndTime(AbstractExecutable.getEndTime(stepOutput));
  if (task instanceof ShellExecutable) {
    result.setExecCmd(((ShellExecutable) task).getCmd());
  }
  if (task instanceof MapReduceExecutable) {
    result.setExecCmd(((MapReduceExecutable) task).getMapReduceParams());
    result.setExecWaitTime(AbstractExecutable.getExtraInfoAsLong(stepOutput, MapReduceExecutable.MAP_REDUCE_WAIT_TIME, 0L) / 1000);
  }
  if (task instanceof HadoopShellExecutable) {
    result.setExecCmd(((HadoopShellExecutable) task).getJobParams());
  }
  return result;
}

代码示例来源:origin: apache/kylin

public final long getLastModified() {
  return getOutput().getLastModified();
}

代码示例来源:origin: apache/kylin

.getCube(CubingExecutableUtil.getCubeName(this.getParams()));
final Output output = getManager().getOutput(getId());
state = output.getState();
if (state != ExecutableState.ERROR
    && !cubeInstance.getDescriptor().getStatusNeedNotify().contains(state.toString())) {
  for (AbstractExecutable task : getTasks()) {
    errorOutput = getManager().getOutput(task.getId());
    if (errorOutput.getState() == ExecutableState.ERROR) {
      errorTask = task;
      break;
    final String mrJobId = errorOutput.getExtra().get(ExecutableConstants.MR_JOB_ID);
    dataMap.put("mr_job_id", StringUtil.noBlank(mrJobId, "Not initialized"));
  } else {
      Matcher.quoteReplacement(StringUtil.noBlank(output.getVerboseMsg(), "no error message")));

代码示例来源:origin: apache/kylin

result.setRelatedCube(CubingExecutableUtil.getCubeName(job.getParams()));
result.setDisplayCubeName(CubingExecutableUtil.getCubeName(job.getParams()));
result.setLastModified(output.getLastModified());
result.setSubmitter(job.getSubmitter());
result.setUuid(job.getId());
result.setType(CubeBuildTypeEnum.CHECKPOINT);
result.setStatus(parseToJobStatus(output.getState()));
result.setBuildInstance(AbstractExecutable.getBuildInstance(output));
result.setExecStartTime(AbstractExecutable.getStartTime(output));

代码示例来源:origin: apache/kylin

public static String getBuildInstance(Output output) {
  final String str = output.getExtra().get(BUILD_INSTANCE);
  if (str != null) {
    return str;
  }
  return "unknown";
}

代码示例来源:origin: KylinOLAP/Kylin

final Output output = jobService.getOutput(getId());
String logMsg;
switch (output.getState()) {
  case ERROR:
    logMsg = output.getVerboseMsg();
    break;
  case DISCARDED:

代码示例来源:origin: apache/kylin

/**
 * Get a job step output
 * 
 * @return
 * @throws IOException
 */
@RequestMapping(value = "/{jobId}/steps/{stepId}/output", method = { RequestMethod.GET }, produces = {
    "application/json" })
@ResponseBody
public Map<String, String> getStepOutput(@PathVariable String jobId, @PathVariable String stepId) {
  Map<String, String> result = new HashMap<String, String>();
  result.put("jobId", jobId);
  result.put("stepId", String.valueOf(stepId));
  result.put("cmd_output", jobService.getExecutableManager().getOutput(stepId).getVerboseMsg());
  return result;
}

代码示例来源:origin: apache/kylin

result.setDisplayCubeName(cube != null ? cube.getDisplayName() : CubingExecutableUtil.getCubeName(cubeJob.getParams()));
result.setRelatedSegment(CubingExecutableUtil.getSegmentId(cubeJob.getParams()));
result.setLastModified(output.getLastModified());
result.setSubmitter(job.getSubmitter());
result.setUuid(job.getId());
result.setType(CubeBuildTypeEnum.BUILD);
result.setStatus(parseToJobStatus(output.getState()));
result.setBuildInstance(AbstractExecutable.getBuildInstance(output));
result.setMrWaiting(AbstractExecutable.getExtraInfoAsLong(output, CubingJob.MAP_REDUCE_WAIT_TIME, 0L) / 1000);

代码示例来源:origin: apache/kylin

public static long getExtraInfoAsLong(Output output, String key, long defaultValue) {
  final String str = output.getExtra().get(key);
  if (str != null) {
    return Long.parseLong(str);
  } else {
    return defaultValue;
  }
}

代码示例来源:origin: org.apache.kylin/kylin-engine-mr

.getCube(CubingExecutableUtil.getCubeName(this.getParams()));
final Output output = getManager().getOutput(getId());
state = output.getState();
if (state != ExecutableState.ERROR
    && !cubeInstance.getDescriptor().getStatusNeedNotify().contains(state.toString())) {
  for (AbstractExecutable task : getTasks()) {
    errorOutput = getManager().getOutput(task.getId());
    if (errorOutput.getState() == ExecutableState.ERROR) {
      errorTask = task;
      break;
    final String mrJobId = errorOutput.getExtra().get(ExecutableConstants.MR_JOB_ID);
    dataMap.put("mr_job_id", StringUtil.noBlank(mrJobId, "Not initialized"));
  } else {
      Matcher.quoteReplacement(StringUtil.noBlank(output.getVerboseMsg(), "no error message")));

代码示例来源:origin: org.apache.kylin/kylin-job

final Output output = jobService.getOutput(getId());
String logMsg = "";
switch (output.getState()) {
case ERROR:
  logMsg = output.getVerboseMsg();
  break;
case DISCARDED:

代码示例来源:origin: apache/kylin

protected final boolean isPaused() {
  final ExecutableState status = getOutput().getState();
  return status == ExecutableState.STOPPED;
}

代码示例来源:origin: apache/kylin

result.setLastModified(output.getLastModified());
result.setSubmitter(cubeJob.getSubmitter());
result.setUuid(cubeJob.getId());
result.setType(CubeBuildTypeEnum.BUILD);
result.setStatus(parseToJobStatus(output.getState()));
result.setMrWaiting(AbstractExecutable.getExtraInfoAsLong(output, CubingJob.MAP_REDUCE_WAIT_TIME, 0L) / 1000);
result.setBuildInstance(AbstractExecutable.getBuildInstance(output));

代码示例来源:origin: apache/kylin

result.setStatus(parseToJobStepStatus(stepOutput.getState()));
for (Map.Entry<String, String> entry : stepOutput.getExtra().entrySet()) {
  if (entry.getKey() != null && entry.getValue() != null) {
    result.putInfo(entry.getKey(), entry.getValue());

代码示例来源:origin: apache/kylin

protected final Map<String, String> getExtraInfo() {
  return getOutput().getExtra();
}

代码示例来源:origin: KylinOLAP/Kylin

public final long getLastModified() {
  return executableManager.getOutput(getId()).getLastModified();
}

代码示例来源:origin: apache/kylin

@Override
  public boolean apply(CheckpointExecutable executable) {
    try {
      Output output = allOutputs.get(executable.getId());
      if (output == null) {
        return false;
      }
      ExecutableState state = output.getState();
      boolean ret = statusList.contains(state);
      return ret;
    } catch (Exception e) {
      throw e;
    }
  }
}, new Predicate<CheckpointExecutable>() {

代码示例来源:origin: org.apache.kylin/kylin-engine-mr

public static JobInstance parseToJobInstance(CheckpointExecutable job, Map<String, Output> outputs) {
  if (job == null) {
    logger.warn("job is null.");
    return null;
  }
  Output output = outputs.get(job.getId());
  if (output == null) {
    logger.warn("job output is null.");
    return null;
  }
  final JobInstance result = new JobInstance();
  result.setName(job.getName());
  result.setRelatedCube(CubingExecutableUtil.getCubeName(job.getParams()));
  result.setDisplayCubeName(CubingExecutableUtil.getCubeName(job.getParams()));
  result.setLastModified(output.getLastModified());
  result.setSubmitter(job.getSubmitter());
  result.setUuid(job.getId());
  result.setType(CubeBuildTypeEnum.CHECKPOINT);
  result.setStatus(parseToJobStatus(output.getState()));
  result.setExecStartTime(AbstractExecutable.getStartTime(output));
  result.setExecEndTime(AbstractExecutable.getEndTime(output));
  result.setExecInterruptTime(AbstractExecutable.getInterruptTime(output));
  result.setDuration(AbstractExecutable.getDuration(result.getExecStartTime(), result.getExecEndTime(),
      result.getExecInterruptTime()) / 1000);
  for (int i = 0; i < job.getTasks().size(); ++i) {
    AbstractExecutable task = job.getTasks().get(i);
    result.addStep(parseToJobStep(task, i, outputs.get(task.getId())));
  }
  return result;
}

代码示例来源:origin: org.apache.kylin/kylin-tool

private JobInstance.JobStep parseToJobStep(AbstractExecutable task, int i, Output stepOutput) {
  Preconditions.checkNotNull(stepOutput);
  JobInstance.JobStep result = new JobInstance.JobStep();
  result.setId(task.getId());
  result.setName(task.getName());
  result.setSequenceID(i);
  result.setStatus(parseToJobStepStatus(stepOutput.getState()));
  for (Map.Entry<String, String> entry : stepOutput.getExtra().entrySet()) {
    if (entry.getKey() != null && entry.getValue() != null) {
      result.putInfo(entry.getKey(), entry.getValue());
    }
  }
  result.setExecStartTime(AbstractExecutable.getStartTime(stepOutput));
  result.setExecEndTime(AbstractExecutable.getEndTime(stepOutput));
  if (task instanceof ShellExecutable) {
    result.setExecCmd(((ShellExecutable) task).getCmd());
  }
  if (task instanceof MapReduceExecutable) {
    result.setExecCmd(((MapReduceExecutable) task).getMapReduceParams());
    result.setExecWaitTime(AbstractExecutable.getExtraInfoAsLong(stepOutput, MapReduceExecutable.MAP_REDUCE_WAIT_TIME, 0L) / 1000);
  }
  if (task instanceof HadoopShellExecutable) {
    result.setExecCmd(((HadoopShellExecutable) task).getJobParams());
  }
  return result;
}

相关文章