Search in sources :

Example 1 with RUNNING

use of com.flink.platform.common.enums.ExecutionStatus.RUNNING in project flink-platform-backend by itinycheng.

the class FlowExecuteThread method run.

@Override
public void run() {
    // Update status of jobFlowRun.
    JobFlowRun newJobFlowRun = new JobFlowRun();
    newJobFlowRun.setId(jobFlowRun.getId());
    newJobFlowRun.setStatus(RUNNING);
    jobFlowRunService.updateById(newJobFlowRun);
    // Process job flow.
    JobFlowDag flow = jobFlowRun.getFlow();
    flow.getBeginVertices().forEach(jobVertex -> execVertex(jobVertex, flow));
    // Wait until all vertices are executed.
    while (JobFlowDagHelper.hasUnExecutedVertices(flow)) {
        ThreadUtil.sleep(5000);
    }
    // Wait for all jobs complete.
    CompletableFuture.allOf(runningJobs.values().toArray(new CompletableFuture[0])).thenAccept(unused -> completeAndNotify(flow)).thenAccept(unused -> jobExecService.shutdownNow());
}
Also used : SpringContext(com.flink.platform.web.common.SpringContext) ThreadUtil(com.flink.platform.web.util.ThreadUtil) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) JobVertex(com.flink.platform.common.model.JobVertex) CompletableFuture(java.util.concurrent.CompletableFuture) JobFlowRunService(com.flink.platform.dao.service.JobFlowRunService) Supplier(java.util.function.Supplier) CollectionUtils(org.apache.commons.collections4.CollectionUtils) RUNNING(com.flink.platform.common.enums.ExecutionStatus.RUNNING) JobFlowDagHelper(com.flink.platform.web.util.JobFlowDagHelper) Slf4j(lombok.extern.slf4j.Slf4j) ExecutionStatus(com.flink.platform.common.enums.ExecutionStatus) WorkerConfig(com.flink.platform.web.config.WorkerConfig) Map(java.util.Map) JobFlowRun(com.flink.platform.dao.entity.JobFlowRun) AlertSendingService(com.flink.platform.web.service.AlertSendingService) JobFlowDag(com.flink.platform.dao.entity.JobFlowDag) ExecutorService(java.util.concurrent.ExecutorService) CompletableFuture(java.util.concurrent.CompletableFuture) JobFlowDag(com.flink.platform.dao.entity.JobFlowDag) JobFlowRun(com.flink.platform.dao.entity.JobFlowRun)

Aggregations

ExecutionStatus (com.flink.platform.common.enums.ExecutionStatus)1 RUNNING (com.flink.platform.common.enums.ExecutionStatus.RUNNING)1 JobVertex (com.flink.platform.common.model.JobVertex)1 JobFlowDag (com.flink.platform.dao.entity.JobFlowDag)1 JobFlowRun (com.flink.platform.dao.entity.JobFlowRun)1 JobFlowRunService (com.flink.platform.dao.service.JobFlowRunService)1 SpringContext (com.flink.platform.web.common.SpringContext)1 WorkerConfig (com.flink.platform.web.config.WorkerConfig)1 AlertSendingService (com.flink.platform.web.service.AlertSendingService)1 JobFlowDagHelper (com.flink.platform.web.util.JobFlowDagHelper)1 ThreadUtil (com.flink.platform.web.util.ThreadUtil)1 Map (java.util.Map)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ExecutorService (java.util.concurrent.ExecutorService)1 Supplier (java.util.function.Supplier)1 Slf4j (lombok.extern.slf4j.Slf4j)1 CollectionUtils (org.apache.commons.collections4.CollectionUtils)1