Search in sources :

Example 1 with IncrStatusUmbilicalProtocolImpl

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);
}
Also used : IncrStatusUmbilicalProtocolImpl(com.qlangtech.tis.rpc.server.IncrStatusUmbilicalProtocolImpl) IncrStatusUmbilicalProtocol(com.qlangtech.tis.realtime.yarn.rpc.IncrStatusUmbilicalProtocol) ITISRpcService(com.tis.hadoop.rpc.ITISRpcService) AtomicReference(java.util.concurrent.atomic.AtomicReference) RpcServiceReference(com.tis.hadoop.rpc.RpcServiceReference) AdapterStatusUmbilicalProtocol(com.qlangtech.tis.realtime.yarn.rpc.impl.AdapterStatusUmbilicalProtocol)

Example 2 with IncrStatusUmbilicalProtocolImpl

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);
}
Also used : IncrStatusUmbilicalProtocolImpl(com.qlangtech.tis.rpc.server.IncrStatusUmbilicalProtocolImpl)

Example 3 with IncrStatusUmbilicalProtocolImpl

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)));
}
Also used : PhaseStatusCollection(com.qlangtech.tis.fullbuild.phasestatus.PhaseStatusCollection) IncrStatusUmbilicalProtocolImpl(com.qlangtech.tis.rpc.server.IncrStatusUmbilicalProtocolImpl) HttpExecContext(com.qlangtech.tis.fullbuild.servlet.impl.HttpExecContext) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

IncrStatusUmbilicalProtocolImpl (com.qlangtech.tis.rpc.server.IncrStatusUmbilicalProtocolImpl)3 PhaseStatusCollection (com.qlangtech.tis.fullbuild.phasestatus.PhaseStatusCollection)1 HttpExecContext (com.qlangtech.tis.fullbuild.servlet.impl.HttpExecContext)1 IncrStatusUmbilicalProtocol (com.qlangtech.tis.realtime.yarn.rpc.IncrStatusUmbilicalProtocol)1 AdapterStatusUmbilicalProtocol (com.qlangtech.tis.realtime.yarn.rpc.impl.AdapterStatusUmbilicalProtocol)1 ITISRpcService (com.tis.hadoop.rpc.ITISRpcService)1 RpcServiceReference (com.tis.hadoop.rpc.RpcServiceReference)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1