public static TableOptimizingInfo buildTableOptimizeInfo(
      TableRuntimeMeta optimizingTableRuntime,
      List<OptimizingTaskMeta> processTasks,
      List<TaskRuntime.TaskQuota> quotas) {
    ServerTableIdentifier identifier =
        ServerTableIdentifier.of(
            optimizingTableRuntime.getTableId(),
            optimizingTableRuntime.getCatalogName(),
            optimizingTableRuntime.getDbName(),
            optimizingTableRuntime.getTableName(),
            optimizingTableRuntime.getFormat());
    TableOptimizingInfo tableOptimizeInfo = new TableOptimizingInfo(identifier);
    OptimizingStatus optimizingStatus = optimizingTableRuntime.getTableStatus();
    tableOptimizeInfo.setOptimizeStatus(optimizingStatus.displayValue());
    tableOptimizeInfo.setDuration(
        System.currentTimeMillis() - optimizingTableRuntime.getCurrentStatusStartTime());
    OptimizingConfig optimizingConfig =
        optimizingTableRuntime.getTableConfig().getOptimizingConfig();
    tableOptimizeInfo.setQuota(optimizingConfig.getTargetQuota());
    double quotaOccupy =
        calculateQuotaOccupy(
            processTasks,
            quotas,
            optimizingTableRuntime.getCurrentStatusStartTime(),
            System.currentTimeMillis());
    tableOptimizeInfo.setQuotaOccupation(quotaOccupy);
    FilesStatistics optimizeFileInfo;
    if (optimizingStatus.isProcessing()) {
      MetricsSummary summary = null;
      if (processTasks != null && !processTasks.isEmpty()) {
        List<MetricsSummary> taskSummary =
            processTasks.stream()
                .map(OptimizingTaskMeta::getMetricsSummary)
                .collect(Collectors.toList());
        summary = new MetricsSummary(taskSummary);
      }
      optimizeFileInfo = collectOptimizingFileInfo(summary);
    } else if (optimizingStatus == OptimizingStatus.PENDING) {
      optimizeFileInfo = collectPendingFileInfo(optimizingTableRuntime.getPendingInput());
    } else {
      optimizeFileInfo = null;
    }
    if (optimizeFileInfo != null) {
      tableOptimizeInfo.setFileCount(optimizeFileInfo.getFileCnt());
      tableOptimizeInfo.setFileSize(optimizeFileInfo.getTotalSize());
    }
    tableOptimizeInfo.setGroupName(optimizingTableRuntime.getOptimizerGroup());
    return tableOptimizeInfo;
  }
Build current table optimize info.

@return TableOptimizeInfo
amoro-ams/src/main/java/org/apache/amoro/server/dashboard/utils/OptimizingUtil.java