Search in sources :

Example 1 with BuildPhaseStatus

use of com.qlangtech.tis.fullbuild.phasestatus.impl.BuildPhaseStatus in project tis by qlangtech.

the class FullBuildStatCollectorServer method convertPP.

public PPhaseStatusCollection convertPP(PhaseStatusCollection phaseStatusSet) {
    PPhaseStatusCollection.Builder scBuilder = PPhaseStatusCollection.newBuilder();
    scBuilder.setTaskId(phaseStatusSet.getTaskid());
    DumpPhaseStatus dumpPhase = phaseStatusSet.getDumpPhase();
    JoinPhaseStatus joinPhase = phaseStatusSet.getJoinPhase();
    BuildPhaseStatus buildPhase = phaseStatusSet.getBuildPhase();
    IndexBackFlowPhaseStatus indexBackFlowPhase = phaseStatusSet.getIndexBackFlowPhaseStatus();
    if (dumpPhase != null) {
        PDumpPhaseStatus.Builder builder = PDumpPhaseStatus.newBuilder();
        com.qlangtech.tis.rpc.grpc.log.common.TableDumpStatus.Builder tabDump = null;
        DumpPhaseStatus.TableDumpStatus s = null;
        for (Map.Entry<String, DumpPhaseStatus.TableDumpStatus> entry : dumpPhase.tablesDump.entrySet()) {
            s = entry.getValue();
            tabDump = com.qlangtech.tis.rpc.grpc.log.common.TableDumpStatus.newBuilder();
            tabDump.setAllRows(s.getAllRows());
            tabDump.setTableName(s.getName());
            tabDump.setTaskid(s.getTaskid());
            tabDump.setReadRows(s.getReadRows());
            tabDump.setFaild(s.isFaild());
            tabDump.setComplete(s.isComplete());
            tabDump.setWaiting(s.isWaiting());
            builder.putTablesDump(entry.getKey(), tabDump.build());
        }
        scBuilder.setDumpPhase(builder);
    }
    if (joinPhase != null) {
        PJoinPhaseStatus.Builder builder = PJoinPhaseStatus.newBuilder();
        com.qlangtech.tis.rpc.grpc.log.common.JoinTaskStatus.Builder pbuilder = null;
        JoinPhaseStatus.JoinTaskStatus j = null;
        com.qlangtech.tis.rpc.grpc.log.common.JobLog.Builder jlog = null;
        JobLog jl = null;
        for (Map.Entry<String, JoinPhaseStatus.JoinTaskStatus> entry : joinPhase.taskStatus.entrySet()) {
            pbuilder = com.qlangtech.tis.rpc.grpc.log.common.JoinTaskStatus.newBuilder();
            j = entry.getValue();
            pbuilder.setJoinTaskName(j.getName());
            pbuilder.setFaild(j.isFaild());
            pbuilder.setComplete(j.isComplete());
            pbuilder.setWaiting(j.isWaiting());
            for (Map.Entry<Integer, JobLog> e : j.jobsStatus.entrySet()) {
                jl = e.getValue();
                jlog = com.qlangtech.tis.rpc.grpc.log.common.JobLog.newBuilder();
                jlog.setMapper(jl.getMapper());
                jlog.setReducer(jl.getReducer());
                jlog.setWaiting(jl.isWaiting());
                pbuilder.putJobStatus(e.getKey(), jlog.build());
            }
            builder.putTaskStatus(entry.getKey(), pbuilder.build());
        }
        scBuilder.setJoinPhase(builder);
    }
    if (buildPhase != null) {
        PBuildPhaseStatus.Builder builder = PBuildPhaseStatus.newBuilder();
        buildPhase.nodeBuildStatus.entrySet().stream().forEach((e) -> {
            com.qlangtech.tis.fullbuild.phasestatus.impl.BuildSharedPhaseStatus bf = null;
            com.qlangtech.tis.rpc.grpc.log.common.BuildSharedPhaseStatus.Builder bfBuilder = com.qlangtech.tis.rpc.grpc.log.common.BuildSharedPhaseStatus.newBuilder();
            bf = e.getValue();
            bfBuilder.setAllBuildSize(bf.getAllBuildSize());
            bfBuilder.setBuildReaded(bf.getBuildReaded());
            bfBuilder.setTaskid(bf.getTaskid());
            bfBuilder.setSharedName(bf.getSharedName());
            bfBuilder.setFaild(bf.isFaild());
            bfBuilder.setComplete(bf.isComplete());
            bfBuilder.setWaiting(bf.isWaiting());
            builder.putNodeBuildStatus(e.getKey(), bfBuilder.build());
        });
        scBuilder.setBuildPhase(builder);
    }
    if (indexBackFlowPhase != null) {
        PIndexBackFlowPhaseStatus.Builder builder = PIndexBackFlowPhaseStatus.newBuilder();
        indexBackFlowPhase.nodesStatus.entrySet().stream().forEach((e) -> {
            IndexBackFlowPhaseStatus.NodeBackflowStatus ib = e.getValue();
            com.qlangtech.tis.rpc.grpc.log.common.NodeBackflowStatus.Builder ibBuilder = com.qlangtech.tis.rpc.grpc.log.common.NodeBackflowStatus.newBuilder();
            ibBuilder.setNodeName(ib.getName());
            ibBuilder.setAllSize(ib.getAllSize());
            ibBuilder.setReaded(ib.getReaded());
            ibBuilder.setFaild(ib.isFaild());
            ibBuilder.setComplete(ib.isComplete());
            ibBuilder.setWaiting(ib.isWaiting());
            builder.putNodesStatus(e.getKey(), ibBuilder.build());
        });
        scBuilder.setIndexBackFlowPhaseStatus(builder);
    }
    return scBuilder.build();
}
Also used : DumpPhaseStatus(com.qlangtech.tis.fullbuild.phasestatus.impl.DumpPhaseStatus) IndexBackFlowPhaseStatus(com.qlangtech.tis.fullbuild.phasestatus.impl.IndexBackFlowPhaseStatus) BuildPhaseStatus(com.qlangtech.tis.fullbuild.phasestatus.impl.BuildPhaseStatus) JoinPhaseStatus(com.qlangtech.tis.fullbuild.phasestatus.impl.JoinPhaseStatus) JobLog(com.qlangtech.tis.fullbuild.phasestatus.JobLog) Map(java.util.Map)

Example 2 with BuildPhaseStatus

use of com.qlangtech.tis.fullbuild.phasestatus.impl.BuildPhaseStatus in project tis by qlangtech.

the class IncrStatusUmbilicalProtocolImpl method reportBuildIndexStatus.

@Override
public void reportBuildIndexStatus(com.qlangtech.tis.rpc.grpc.log.common.BuildSharedPhaseStatus buildStatus, StreamObserver<Empty> responseObserver) {
    Integer taskid = buildStatus.getTaskid();
    if (taskid == null) {
        throw new IllegalArgumentException("taskid can not be null");
    }
    PhaseStatusCollection phaseStatusSet = TrackableExecuteInterceptor.getTaskPhaseReference(taskid);
    if (phaseStatusSet == null) {
        log.warn("taskid:" + taskid + " relevent phaseStatusSet is null");
        returnEmpty(responseObserver);
        return;
    }
    BuildPhaseStatus status = phaseStatusSet.getBuildPhase();
    BuildSharedPhaseStatus sharedBuildStatus = status.getBuildSharedPhaseStatus(buildStatus.getSharedName());
    if (!sharedBuildStatus.isFaild()) {
        sharedBuildStatus.setFaild(buildStatus.getFaild());
    }
    if (!sharedBuildStatus.isComplete()) {
        sharedBuildStatus.setComplete(buildStatus.getComplete());
    }
    if (sharedBuildStatus.isWaiting()) {
        sharedBuildStatus.setWaiting(buildStatus.getWaiting());
    }
    sharedBuildStatus.setAllBuildSize(buildStatus.getAllBuildSize());
    sharedBuildStatus.setBuildReaded(buildStatus.getBuildReaded());
    status.isComplete();
    returnEmpty(responseObserver);
}
Also used : PhaseStatusCollection(com.qlangtech.tis.fullbuild.phasestatus.PhaseStatusCollection) BuildSharedPhaseStatus(com.qlangtech.tis.fullbuild.phasestatus.impl.BuildSharedPhaseStatus) BuildPhaseStatus(com.qlangtech.tis.fullbuild.phasestatus.impl.BuildPhaseStatus)

Example 3 with BuildPhaseStatus

use of com.qlangtech.tis.fullbuild.phasestatus.impl.BuildPhaseStatus in project tis by qlangtech.

the class LogCollectorClient method convert.

public static PhaseStatusCollection convert(PPhaseStatusCollection stat, ExecutePhaseRange executePhaseRange) {
    PDumpPhaseStatus dumpPhase = stat.getDumpPhase();
    PJoinPhaseStatus joinPhase = stat.getJoinPhase();
    PBuildPhaseStatus buildPhase = stat.getBuildPhase();
    PIndexBackFlowPhaseStatus backflow = stat.getIndexBackFlowPhaseStatus();
    PhaseStatusCollection result = new PhaseStatusCollection(stat.getTaskId(), executePhaseRange);
    if (executePhaseRange.contains(FullbuildPhase.FullDump) && dumpPhase != null) {
        DumpPhaseStatus dump = result.getDumpPhase();
        dumpPhase.getTablesDumpMap().forEach((k, v) -> {
            DumpPhaseStatus.TableDumpStatus s = new DumpPhaseStatus.TableDumpStatus(v.getTableName(), v.getTaskid());
            s.setAllRows(v.getAllRows());
            s.setReadRows(v.getReadRows());
            s.setComplete(v.getComplete());
            s.setFaild(v.getFaild());
            s.setWaiting(v.getWaiting());
            dump.tablesDump.put(k, s);
        });
    }
    if (executePhaseRange.contains(FullbuildPhase.JOIN) && joinPhase != null) {
        JoinPhaseStatus join = result.getJoinPhase();
        Map<String, JoinPhaseStatus.JoinTaskStatus> sm = join.taskStatus;
        joinPhase.getTaskStatusMap().forEach((k, v) -> {
            JoinPhaseStatus.JoinTaskStatus s = new JoinPhaseStatus.JoinTaskStatus(v.getJoinTaskName());
            s.setComplete(v.getComplete());
            s.setFaild(v.getFaild());
            s.setWaiting(v.getWaiting());
            v.getJobStatusMap().forEach((jk, jv) -> {
                JobLog jl = new JobLog();
                jl.setMapper(jv.getMapper());
                jl.setReducer(jv.getReducer());
                jl.setWaiting(jv.getWaiting());
                s.jobsStatus.put(jk, jl);
            });
            sm.put(k, s);
        });
    }
    if (executePhaseRange.contains(FullbuildPhase.BUILD) && buildPhase != null) {
        BuildPhaseStatus build = result.getBuildPhase();
        buildPhase.getNodeBuildStatusMap().forEach((k, v) -> {
            com.qlangtech.tis.fullbuild.phasestatus.impl.BuildSharedPhaseStatus s = new com.qlangtech.tis.fullbuild.phasestatus.impl.BuildSharedPhaseStatus();
            s.setAllBuildSize(v.getAllBuildSize());
            s.setBuildReaded(v.getBuildReaded());
            s.setTaskid(v.getTaskid());
            s.setSharedName(v.getSharedName());
            s.setComplete(v.getComplete());
            s.setFaild(v.getFaild());
            s.setWaiting(v.getWaiting());
            build.nodeBuildStatus.put(k, s);
        });
    }
    if (executePhaseRange.contains(FullbuildPhase.IndexBackFlow) && backflow != null) {
        IndexBackFlowPhaseStatus bf = result.getIndexBackFlowPhaseStatus();
        backflow.getNodesStatusMap().forEach((k, v) -> {
            IndexBackFlowPhaseStatus.NodeBackflowStatus s = new IndexBackFlowPhaseStatus.NodeBackflowStatus(v.getNodeName());
            s.setAllSize((int) v.getAllSize());
            s.setReaded((int) v.getReaded());
            s.setComplete(v.getComplete());
            s.setFaild(v.getFaild());
            s.setWaiting(v.getWaiting());
            bf.nodesStatus.put(k, s);
        });
    }
    return result;
}
Also used : DumpPhaseStatus(com.qlangtech.tis.fullbuild.phasestatus.impl.DumpPhaseStatus) PhaseStatusCollection(com.qlangtech.tis.fullbuild.phasestatus.PhaseStatusCollection) IndexBackFlowPhaseStatus(com.qlangtech.tis.fullbuild.phasestatus.impl.IndexBackFlowPhaseStatus) BuildPhaseStatus(com.qlangtech.tis.fullbuild.phasestatus.impl.BuildPhaseStatus) JoinPhaseStatus(com.qlangtech.tis.fullbuild.phasestatus.impl.JoinPhaseStatus) JobLog(com.qlangtech.tis.fullbuild.phasestatus.JobLog)

Aggregations

BuildPhaseStatus (com.qlangtech.tis.fullbuild.phasestatus.impl.BuildPhaseStatus)3 JobLog (com.qlangtech.tis.fullbuild.phasestatus.JobLog)2 PhaseStatusCollection (com.qlangtech.tis.fullbuild.phasestatus.PhaseStatusCollection)2 DumpPhaseStatus (com.qlangtech.tis.fullbuild.phasestatus.impl.DumpPhaseStatus)2 IndexBackFlowPhaseStatus (com.qlangtech.tis.fullbuild.phasestatus.impl.IndexBackFlowPhaseStatus)2 JoinPhaseStatus (com.qlangtech.tis.fullbuild.phasestatus.impl.JoinPhaseStatus)2 BuildSharedPhaseStatus (com.qlangtech.tis.fullbuild.phasestatus.impl.BuildSharedPhaseStatus)1 Map (java.util.Map)1