org.apache.flink.runtime.webmonitor.WebMonitorUtils.createDetailsForJob()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(120)

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

WebMonitorUtils.createDetailsForJob介绍

暂无

代码示例

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

@Override
public CompletableFuture<JobDetails> requestJobDetails(Time timeout) {
  final ExecutionGraph currentExecutionGraph = executionGraph;
  return CompletableFuture.supplyAsync(() -> WebMonitorUtils.createDetailsForJob(currentExecutionGraph), scheduledExecutorService);
}

代码示例来源:origin: org.apache.flink/flink-runtime

@Override
public CompletableFuture<JobDetails> requestJobDetails(Time timeout) {
  final ExecutionGraph currentExecutionGraph = executionGraph;
  return CompletableFuture.supplyAsync(() -> WebMonitorUtils.createDetailsForJob(currentExecutionGraph), scheduledExecutorService);
}

代码示例来源:origin: org.apache.flink/flink-runtime

@Nullable
@Override
public JobDetails getAvailableJobDetails(JobID jobId) {
  final ArchivedExecutionGraph archivedExecutionGraph = serializableExecutionGraphs.get(jobId);
  if (archivedExecutionGraph != null) {
    return WebMonitorUtils.createDetailsForJob(archivedExecutionGraph);
  } else {
    return null;
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

@Nullable
@Override
public JobDetails getAvailableJobDetails(JobID jobId) {
  final ArchivedExecutionGraph archivedExecutionGraph = serializableExecutionGraphs.get(jobId);
  if (archivedExecutionGraph != null) {
    return WebMonitorUtils.createDetailsForJob(archivedExecutionGraph);
  } else {
    return null;
  }
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

@Nullable
@Override
public JobDetails getAvailableJobDetails(JobID jobId) {
  final ArchivedExecutionGraph archivedExecutionGraph = serializableExecutionGraphs.get(jobId);
  if (archivedExecutionGraph != null) {
    return WebMonitorUtils.createDetailsForJob(archivedExecutionGraph);
  } else {
    return null;
  }
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

@Override
public CompletableFuture<JobDetails> requestJobDetails(@RpcTimeout Time timeout) {
  final ExecutionGraph currentExecutionGraph = executionGraph;
  return CompletableFuture.supplyAsync(() -> WebMonitorUtils.createDetailsForJob(currentExecutionGraph), scheduledExecutorService);
}

代码示例来源:origin: org.apache.flink/flink-runtime-web_2.10

@Override
  public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
    StringWriter writer = new StringWriter();
    try (JsonGenerator gen = JsonFactory.jacksonFactory.createGenerator(writer)) {
      gen.writeStartObject();
      gen.writeArrayFieldStart("running");
      gen.writeEndArray();
      gen.writeArrayFieldStart("finished");
      writeJobDetailOverviewAsJson(WebMonitorUtils.createDetailsForJob(graph), gen, System.currentTimeMillis());
      gen.writeEndArray();
      gen.writeEndObject();
    }
    String json = writer.toString();
    String path = ALL_JOBS_REST_PATH;
    return Collections.singleton(new ArchivedJson(path, json));
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

@Override
  public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
    ResponseBody json = new MultipleJobsDetails(Collections.singleton(WebMonitorUtils.createDetailsForJob(graph)));
    String path = getMessageHeaders().getTargetRestEndpointURL()
      .replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
    return Collections.singletonList(new ArchivedJson(path, json));
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime

@Override
  public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
    ResponseBody json = new MultipleJobsDetails(Collections.singleton(WebMonitorUtils.createDetailsForJob(graph)));
    String path = getMessageHeaders().getTargetRestEndpointURL()
      .replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
    return Collections.singletonList(new ArchivedJson(path, json));
  }
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

@Override
  public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
    ResponseBody json = new MultipleJobsDetails(Collections.singleton(WebMonitorUtils.createDetailsForJob(graph)));
    String path = getMessageHeaders().getTargetRestEndpointURL()
      .replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
    return Collections.singletonList(new ArchivedJson(path, json));
  }
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

@Override
  public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
    StringWriter writer = new StringWriter();
    try (JsonGenerator gen = JsonFactory.JACKSON_FACTORY.createGenerator(writer)) {
      gen.writeStartObject();
      gen.writeArrayFieldStart(MultipleJobsDetails.FIELD_NAME_JOBS);
      final JobDetails.JobDetailsSerializer jobDetailsSerializer = new JobDetails.JobDetailsSerializer();
      jobDetailsSerializer.serialize(WebMonitorUtils.createDetailsForJob(graph), gen, null);
      gen.writeEndArray();
      gen.writeEndObject();
    }
    String json = writer.toString();
    String path = ALL_JOBS_REST_PATH;
    return Collections.singleton(new ArchivedJson(path, json));
  }
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

@Override
public void put(ArchivedExecutionGraph archivedExecutionGraph) throws IOException {
  final JobStatus jobStatus = archivedExecutionGraph.getState();
  final JobID jobId = archivedExecutionGraph.getJobID();
  final String jobName = archivedExecutionGraph.getJobName();
  Preconditions.checkArgument(
    jobStatus.isGloballyTerminalState(),
    "The job " + jobName + '(' + jobId +
      ") is not in a globally terminal state. Instead it is in state " + jobStatus + '.');
  switch (jobStatus) {
    case FINISHED:
      numFinishedJobs++;
      break;
    case CANCELED:
      numCanceledJobs++;
      break;
    case FAILED:
      numFailedJobs++;
      break;
    default:
      throw new IllegalStateException("The job " + jobName + '(' +
        jobId + ") should have been in a globally terminal state. " +
        "Instead it was in state " + jobStatus + '.');
  }
  // write the ArchivedExecutionGraph to disk
  storeArchivedExecutionGraph(archivedExecutionGraph);
  final JobDetails detailsForJob = WebMonitorUtils.createDetailsForJob(archivedExecutionGraph);
  jobDetailsCache.put(jobId, detailsForJob);
  archivedExecutionGraphCache.put(jobId, archivedExecutionGraph);
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

@Override
public void put(ArchivedExecutionGraph archivedExecutionGraph) throws IOException {
  final JobStatus jobStatus = archivedExecutionGraph.getState();
  final JobID jobId = archivedExecutionGraph.getJobID();
  final String jobName = archivedExecutionGraph.getJobName();
  Preconditions.checkArgument(
    jobStatus.isGloballyTerminalState(),
    "The job " + jobName + '(' + jobId +
      ") is not in a globally terminal state. Instead it is in state " + jobStatus + '.');
  switch (jobStatus) {
    case FINISHED:
      numFinishedJobs++;
      break;
    case CANCELED:
      numCanceledJobs++;
      break;
    case FAILED:
      numFailedJobs++;
      break;
    default:
      throw new IllegalStateException("The job " + jobName + '(' +
        jobId + ") should have been in a globally terminal state. " +
        "Instead it was in state " + jobStatus + '.');
  }
  // write the ArchivedExecutionGraph to disk
  storeArchivedExecutionGraph(archivedExecutionGraph);
  final JobDetails detailsForJob = WebMonitorUtils.createDetailsForJob(archivedExecutionGraph);
  jobDetailsCache.put(jobId, detailsForJob);
  archivedExecutionGraphCache.put(jobId, archivedExecutionGraph);
}

代码示例来源:origin: org.apache.flink/flink-runtime

@Override
public void put(ArchivedExecutionGraph archivedExecutionGraph) throws IOException {
  final JobStatus jobStatus = archivedExecutionGraph.getState();
  final JobID jobId = archivedExecutionGraph.getJobID();
  final String jobName = archivedExecutionGraph.getJobName();
  Preconditions.checkArgument(
    jobStatus.isGloballyTerminalState(),
    "The job " + jobName + '(' + jobId +
      ") is not in a globally terminal state. Instead it is in state " + jobStatus + '.');
  switch (jobStatus) {
    case FINISHED:
      numFinishedJobs++;
      break;
    case CANCELED:
      numCanceledJobs++;
      break;
    case FAILED:
      numFailedJobs++;
      break;
    default:
      throw new IllegalStateException("The job " + jobName + '(' +
        jobId + ") should have been in a globally terminal state. " +
        "Instead it was in state " + jobStatus + '.');
  }
  // write the ArchivedExecutionGraph to disk
  storeArchivedExecutionGraph(archivedExecutionGraph);
  final JobDetails detailsForJob = WebMonitorUtils.createDetailsForJob(archivedExecutionGraph);
  jobDetailsCache.put(jobId, detailsForJob);
  archivedExecutionGraphCache.put(jobId, archivedExecutionGraph);
}

相关文章