use of com.qlangtech.tis.rpc.server.IncrStatusUmbilicalProtocolImpl in project tis by qlangtech.
the class DataXExecuteInterceptor method getDataXExecReporter.
protected RpcServiceReference getDataXExecReporter() {
IncrStatusUmbilicalProtocolImpl statusServer = IncrStatusUmbilicalProtocolImpl.getInstance();
IncrStatusUmbilicalProtocol statReceiveSvc = new AdapterStatusUmbilicalProtocol() {
@Override
public void reportDumpTableStatus(DumpPhaseStatus.TableDumpStatus tableDumpStatus) {
statusServer.reportDumpTableStatus(tableDumpStatus.getTaskid(), tableDumpStatus.isComplete(), tableDumpStatus.isWaiting(), tableDumpStatus.isFaild(), tableDumpStatus.getName());
}
};
AtomicReference<ITISRpcService> ref = new AtomicReference<>();
ref.set(new DataXAssembleSvcCompsite(statReceiveSvc));
return new RpcServiceReference(ref);
}
use of com.qlangtech.tis.rpc.server.IncrStatusUmbilicalProtocolImpl in project tis by qlangtech.
the class DataXExecuteInterceptor method createDataXJob.
protected IRemoteTaskTrigger createDataXJob(DataXJobSubmit.IDataXJobContext execChainContext, DataXJobSubmit submit, DataXJobSubmit.InstanceType expectDataXJobSumit, RpcServiceReference statusRpc, DataxProcessor appSource, String fileName) {
if (expectDataXJobSumit == DataXJobSubmit.InstanceType.DISTRIBUTE) {
IncrStatusUmbilicalProtocolImpl statCollect = IncrStatusUmbilicalProtocolImpl.getInstance();
// 将指标纬度统计向注册到内存中,下一步可提供给DataX终止功能使用
statCollect.getAppSubExecNodeMetrixStatus(execChainContext.getTaskContext().getIndexName(), fileName);
}
return submit.createDataXJob(execChainContext, statusRpc, appSource, fileName);
}
use of com.qlangtech.tis.rpc.server.IncrStatusUmbilicalProtocolImpl in project tis by qlangtech.
the class TisServlet method doDelete.
/**
* 执行任务终止
*
* @param req
* @param resp
* @throws ServletException
* @throws IOException
*/
@Override
protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
HttpExecContext execContext = new HttpExecContext(req, Maps.newHashMap(), true);
int taskId = execContext.getInt(IExecChainContext.KEY_TASK_ID);
// 当前是否是异步任务
final boolean asynJob = execContext.getBoolean(IExecChainContext.KEY_ASYN_JOB_NAME);
String appName = execContext.getString(IFullBuildContext.KEY_APP_NAME);
logger.info("receive a processing job CANCEL signal,taskId:{},asynJob:{},appName:{}", taskId, asynJob, appName);
if (asynJob) {
IncrStatusUmbilicalProtocolImpl incrController = IncrStatusUmbilicalProtocolImpl.getInstance();
// 给远程进程服下毒丸,让其终止
incrController.stop(appName);
} else {
Map.Entry<String, ExecuteLock> targetExecLock = null;
synchronized (this) {
for (Map.Entry<String, ExecuteLock> execLock : idles.entrySet()) {
if (execLock.getValue().matchTask(taskId)) {
targetExecLock = execLock;
}
}
if (targetExecLock == null) {
writeResult(false, "任务已经失效,无法终止", resp);
return;
}
targetExecLock.getValue().cancelAllFuture();
targetExecLock.getValue().clearLockFutureQueue();
}
}
PhaseStatusCollection phaseStatusCollection = TrackableExecuteInterceptor.getTaskPhaseReference(taskId);
if (phaseStatusCollection != null) {
// 这样会将当前状态写入本地磁盘
phaseStatusCollection.flushStatus2Local();
}
writeResult(true, null, resp, new KV(IExecChainContext.KEY_TASK_ID, String.valueOf(taskId)));
}
Aggregations