use of com.qlangtech.tis.fullbuild.taskflow.TISReactor in project tis by qlangtech.
the class DataFlowAppSource method executeDAG.
private ExecuteResult executeDAG(IExecChainContext execChainContext, SqlTaskNodeMeta.SqlDataFlowTopology topology, IDataProcessFeedback dataProcessFeedback, Map<String, TISReactor.TaskAndMilestone> taskMap) {
final ExecuteResult[] faildResult = new ExecuteResult[1];
try {
TISReactor reactor = new TISReactor(execChainContext, taskMap);
String dagSessionSpec = topology.getDAGSessionSpec();
logger.info("dagSessionSpec:" + dagSessionSpec);
// final PrintWriter w = new PrintWriter(sw, true);
ReactorListener listener = new ReactorListener() {
// TODO: Does it really needs handlers to be synchronized?
@Override
public synchronized void onTaskCompleted(Task t) {
processTaskResult(execChainContext, (TISReactor.TaskImpl) t, dataProcessFeedback, new ITaskResultProcessor() {
@Override
public void process(DumpPhaseStatus dumpPhase, TISReactor.TaskImpl task) {
}
@Override
public void process(JoinPhaseStatus joinPhase, TISReactor.TaskImpl task) {
}
});
}
@Override
public synchronized void onTaskFailed(Task t, Throwable err, boolean fatal) {
// w.println("Failed " + t.getDisplayName() + " with " + err);
processTaskResult(execChainContext, (TISReactor.TaskImpl) t, dataProcessFeedback, new ITaskResultProcessor() {
@Override
public void process(DumpPhaseStatus dumpPhase, TISReactor.TaskImpl task) {
dataProcessFeedback.reportDumpTableStatusError(execChainContext, task);
}
@Override
public void process(JoinPhaseStatus joinPhase, TISReactor.TaskImpl task) {
JoinPhaseStatus.JoinTaskStatus stat = joinPhase.getTaskStatus(task.getIdentityName());
// statReceiver.reportBuildIndexStatErr(execContext.getTaskId(),task.getIdentityName());
stat.setWaiting(false);
stat.setFaild(true);
stat.setComplete(true);
}
});
}
};
// 执行DAG地调度
reactor.execute(executorService, reactor.buildSession(dagSessionSpec), listener, new ReactorListener() {
@Override
public void onTaskCompleted(Task t) {
// dumpPhaseStatus.isComplete();
// joinPhaseStatus.isComplete();
}
@Override
public void onTaskFailed(Task t, Throwable err, boolean fatal) {
logger.error(t.getDisplayName(), err);
faildResult[0] = ExecuteResult.createFaild().setMessage("status.runningStatus.isComplete():" + err.getMessage());
}
});
} catch (Exception e) {
throw new RuntimeException(e);
}
return faildResult[0];
}
use of com.qlangtech.tis.fullbuild.taskflow.TISReactor in project tis by qlangtech.
the class DataXExecuteInterceptor method executeDAG.
private void executeDAG(ExecutorService executorService, IExecChainContext execChainContext, String dagSessionSpec, Map<String, TISReactor.TaskAndMilestone> taskMap, ReactorListener reactorListener) {
try {
TISReactor reactor = new TISReactor(execChainContext, taskMap);
// String dagSessionSpec = topology.getDAGSessionSpec();
logger.info("dagSessionSpec:" + dagSessionSpec);
// final PrintWriter w = new PrintWriter(sw, true);
ReactorListener listener = new ReactorListener() {
// TODO: Does it really needs handlers to be synchronized?
// @Override
// public synchronized void onTaskStarted(Task t) {
// // w.println("Started " + t.getDisplayName());
// }
@Override
public synchronized void onTaskCompleted(Task t) {
// w.println("Ended " + t.getDisplayName());
// processTaskResult(execChainContext, (TISReactor.TaskImpl) t, new ITaskResultProcessor() {
// @Override
// public void process(DumpPhaseStatus dumpPhase, TISReactor.TaskImpl task) {
// }
//
// @Override
// public void process(JoinPhaseStatus joinPhase, TISReactor.TaskImpl task) {
// }
// });
}
@Override
public synchronized void onTaskFailed(Task t, Throwable err, boolean fatal) {
// w.println("Failed " + t.getDisplayName() + " with " + err);
// processTaskResult(execChainContext, (TISReactor.TaskImpl) t, new ITaskResultProcessor() {
//
// @Override
// public void process(DumpPhaseStatus dumpPhase, TISReactor.TaskImpl task) {
// IncrStatusUmbilicalProtocolImpl statReceiver = IncrStatusUmbilicalProtocolImpl.getInstance();
// statReceiver.reportDumpTableStatusError(execChainContext.getTaskId(), task.getIdentityName());
// }
//
// @Override
// public void process(JoinPhaseStatus joinPhase, TISReactor.TaskImpl task) {
// JoinPhaseStatus.JoinTaskStatus stat = joinPhase.getTaskStatus(task.getIdentityName());
// // statReceiver.reportBuildIndexStatErr(execContext.getTaskId(),task.getIdentityName());
// stat.setWaiting(false);
// stat.setFaild(true);
// stat.setComplete(true);
// }
// });
}
};
// 执行DAG地调度
// executorService
reactor.execute(executorService, reactor.buildSession(dagSessionSpec), listener, reactorListener);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations