@Override public void run() { try { AsyncRpcClient tajoWorkerRpc = RpcClientManager.getInstance().getClient(worker, TajoWorkerProtocol.class, true, rpcParams); TajoWorkerProtocol.TajoWorkerProtocolService tajoWorkerRpcClient = tajoWorkerRpc.getStub(); tajoWorkerRpcClient.stopExecutionBlock(null, requestProto, NullCallback.get(PrimitiveProtos.BoolProto.class)); } catch (Throwable e) { LOG.error(e.getMessage(), e); } } });
@Override public void run() { try { AsyncRpcClient tajoWorkerRpc = RpcClientManager.getInstance().getClient(worker, TajoWorkerProtocol.class, true, rpcParams); TajoWorkerProtocol.TajoWorkerProtocolService tajoWorkerRpcClient = tajoWorkerRpc.getStub(); tajoWorkerRpcClient.stopExecutionBlock(null, requestProto, NullCallback.get(PrimitiveProtos.BoolProto.class)); } catch (Throwable e) { LOG.error(e.getMessage(), e); } } });
@Override public void run() { try { AsyncRpcClient rpc = RpcClientManager.getInstance().getClient(worker, TajoWorkerProtocol.class, true, rpcParams); TajoWorkerProtocol.TajoWorkerProtocolService tajoWorkerProtocolService = rpc.getStub(); tajoWorkerProtocolService.stopQuery(null, queryId.getProto(), NullCallback.get()); } catch (Throwable e) { LOG.error(e.getMessage(), e); } } });
@Override public void run() { try { AsyncRpcClient rpc = RpcClientManager.getInstance().getClient(worker, TajoWorkerProtocol.class, true, rpcParams); TajoWorkerProtocol.TajoWorkerProtocolService tajoWorkerProtocolService = rpc.getStub(); tajoWorkerProtocolService.stopQuery(null, queryId.getProto(), NullCallback.get()); } catch (Throwable e) { LOG.error(e.getMessage(), e); } } });
@Override public void run() { LOG.info("Start QueryMaster heartbeat thread"); while(!isStopped) { List<QueryMasterTask> tempTasks = new ArrayList<>(); tempTasks.addAll(queryMasterTasks.values()); for(QueryMasterTask eachTask: tempTasks) { NettyClientBase tmClient; try { ServiceTracker serviceTracker = queryMasterContext.getWorkerContext().getServiceTracker(); tmClient = manager.getClient(serviceTracker.getUmbilicalAddress(), QueryCoordinatorProtocol.class, true, rpcClientParams); QueryCoordinatorProtocolService masterClientService = tmClient.getStub(); TajoHeartbeatRequest queryHeartbeat = buildTajoHeartBeat(eachTask); masterClientService.heartbeat(null, queryHeartbeat, NullCallback.get()); } catch (Throwable t) { t.printStackTrace(); } } synchronized(this) { try { this.wait(2000); } catch (InterruptedException e) { break; } } } LOG.info("QueryMaster heartbeat thread stopped"); } }
@Override public void run() { LOG.info("Start QueryMaster heartbeat thread"); while(!isStopped) { List<QueryMasterTask> tempTasks = new ArrayList<QueryMasterTask>(); tempTasks.addAll(queryMasterTasks.values()); for(QueryMasterTask eachTask: tempTasks) { NettyClientBase tmClient; try { ServiceTracker serviceTracker = queryMasterContext.getWorkerContext().getServiceTracker(); tmClient = manager.getClient(serviceTracker.getUmbilicalAddress(), QueryCoordinatorProtocol.class, true, rpcClientParams); QueryCoordinatorProtocolService masterClientService = tmClient.getStub(); TajoHeartbeatRequest queryHeartbeat = buildTajoHeartBeat(eachTask); masterClientService.heartbeat(null, queryHeartbeat, NullCallback.get()); } catch (Throwable t) { t.printStackTrace(); } } synchronized(this) { try { this.wait(2000); } catch (InterruptedException e) { break; } } } LOG.info("QueryMaster heartbeat thread stopped"); } }
private void checkTajoMasterConnectivity(TajoConf tajoConf) throws Exception { RpcClientManager manager = RpcClientManager.getInstance(); ServiceTracker serviceTracker = ServiceTrackerFactory.get(tajoConf); NettyClientBase masterClient = manager.getClient(serviceTracker.getUmbilicalAddress(), QueryCoordinatorProtocol.class, true, RpcParameterFactory.get(tajoConf)); masterClient.getStub(); }
private void checkTajoMasterConnectivity(TajoConf tajoConf) throws Exception { RpcClientManager manager = RpcClientManager.getInstance(); ServiceTracker serviceTracker = ServiceTrackerFactory.get(tajoConf); NettyClientBase masterClient = manager.getClient(serviceTracker.getUmbilicalAddress(), QueryCoordinatorProtocol.class, true, RpcParameterFactory.get(tajoConf)); masterClient.getStub(); }
public List<TajoProtos.WorkerConnectionInfoProto> getAllWorker() { NettyClientBase rpc = null; try { // In TajoMaster HA mode, if backup master be active status, // worker may fail to connect existing active master. Thus, // if worker can't connect the master, worker should try to connect another master and // update master address in worker context. ServiceTracker serviceTracker = workerContext.getServiceTracker(); rpc = manager.getClient(serviceTracker.getUmbilicalAddress(), QueryCoordinatorProtocol.class, true, rpcClientParams); QueryCoordinatorProtocolService masterService = rpc.getStub(); CallFuture<WorkerConnectionsResponse> callBack = new CallFuture<>(); masterService.getAllWorkers(callBack.getController(), PrimitiveProtos.NullProto.getDefaultInstance(), callBack); WorkerConnectionsResponse connectionsProto = callBack.get(); return connectionsProto.getWorkerList(); } catch (Exception e) { LOG.error(e.getMessage(), e); } return new ArrayList<>(); }
/** * Run this instance against the server once. * @return an object of type T * @throws java.io.IOException if a remote or network exception occurs * @throws RuntimeException other unspecified error */ public T withoutRetries() throws IOException, RuntimeException { NettyClientBase client = null; try { beforeCall(); client = manager.getClient(addr, protocol, asyncMode); return call(client); } catch (Throwable t) { Throwable t2 = translateException(t); if (t2 instanceof IOException) { throw (IOException)t2; } else { throw new RuntimeException(t2); } } finally { afterCall(); if(closeConn) { RpcClientManager.cleanup(client); } } }
public List<TajoProtos.WorkerConnectionInfoProto> getAllWorker() { NettyClientBase rpc = null; try { // In TajoMaster HA mode, if backup master be active status, // worker may fail to connect existing active master. Thus, // if worker can't connect the master, worker should try to connect another master and // update master address in worker context. ServiceTracker serviceTracker = workerContext.getServiceTracker(); rpc = manager.getClient(serviceTracker.getUmbilicalAddress(), QueryCoordinatorProtocol.class, true, rpcClientParams); QueryCoordinatorProtocolService masterService = rpc.getStub(); CallFuture<WorkerConnectionsResponse> callBack = new CallFuture<WorkerConnectionsResponse>(); masterService.getAllWorkers(callBack.getController(), PrimitiveProtos.NullProto.getDefaultInstance(), callBack); WorkerConnectionsResponse connectionsProto = callBack.get(); return connectionsProto.getWorkerList(); } catch (Exception e) { LOG.error(e.getMessage(), e); } return new ArrayList<TajoProtos.WorkerConnectionInfoProto>(); }
beforeCall(); if(addr != null) { client = manager.getClient(addr, protocol, asyncMode);
tmClient = manager.getClient(workerContext.getServiceTracker().getUmbilicalAddress(), QueryCoordinatorProtocol.class, true, rpcClientParams);
tmClient = manager.getClient(workerContext.getServiceTracker().getUmbilicalAddress(), QueryCoordinatorProtocol.class, true, rpcClientParams);
/** * It sends a kill RPC request to a corresponding worker. * * @param workerId worker unique Id. * @param taskAttemptId The TaskAttemptId to be killed. */ protected void killTaskAttempt(int workerId, TaskAttemptId taskAttemptId) { NettyClientBase tajoWorkerRpc; ExecutionBlockId ebId = taskAttemptId.getTaskId().getExecutionBlockId(); InetSocketAddress workerAddress = getQuery().getStage(ebId).getAssignedWorkerMap().get(workerId); try { tajoWorkerRpc = RpcClientManager.getInstance().getClient(workerAddress, TajoWorkerProtocol.class, true, rpcParams); TajoWorkerProtocol.TajoWorkerProtocolService tajoWorkerRpcClient = tajoWorkerRpc.getStub(); CallFuture<PrimitiveProtos.BoolProto> callFuture = new CallFuture<>(); tajoWorkerRpcClient.killTaskAttempt(null, taskAttemptId.getProto(), callFuture); if(!callFuture.get().getValue()){ getEventHandler().handle( new TaskFatalErrorEvent(taskAttemptId, new TajoInternalError("Can't kill task :" + taskAttemptId))); } } catch (Exception e) { /* Node RPC failure */ LOG.error(e.getMessage(), e); getEventHandler().handle(new TaskFatalErrorEvent(taskAttemptId, e)); } }
/** * It sends a kill RPC request to a corresponding worker. * * @param workerId worker unique Id. * @param taskAttemptId The TaskAttemptId to be killed. */ protected void killTaskAttempt(int workerId, TaskAttemptId taskAttemptId) { NettyClientBase tajoWorkerRpc; ExecutionBlockId ebId = taskAttemptId.getTaskId().getExecutionBlockId(); InetSocketAddress workerAddress = getQuery().getStage(ebId).getAssignedWorkerMap().get(workerId); try { tajoWorkerRpc = RpcClientManager.getInstance().getClient(workerAddress, TajoWorkerProtocol.class, true, rpcParams); TajoWorkerProtocol.TajoWorkerProtocolService tajoWorkerRpcClient = tajoWorkerRpc.getStub(); CallFuture<PrimitiveProtos.BoolProto> callFuture = new CallFuture<PrimitiveProtos.BoolProto>(); tajoWorkerRpcClient.killTaskAttempt(null, taskAttemptId.getProto(), callFuture); if(!callFuture.get().getValue()){ getEventHandler().handle( new TaskFatalErrorEvent(taskAttemptId, new TajoInternalError("Can't kill task :" + taskAttemptId))); } } catch (Exception e) { /* Node RPC failure */ LOG.error(e.getMessage(), e); getEventHandler().handle(new TaskFatalErrorEvent(taskAttemptId, e)); } }
tajoWorkerRpc = RpcClientManager.getInstance().getClient(addr, TajoWorkerProtocol.class, true, rpcParams);
tajoWorkerRpc = RpcClientManager.getInstance().getClient(addr, TajoWorkerProtocol.class, true, rpcParams);
context.getMasterContext().getQueryMasterContext().getWorkerContext().getServiceTracker(); NettyClientBase tmClient = RpcClientManager.getInstance(). getClient(serviceTracker.getUmbilicalAddress(), QueryCoordinatorProtocol.class, true, rpcParams); QueryCoordinatorProtocolService masterClientService = tmClient.getStub();
context.getMasterContext().getQueryMasterContext().getWorkerContext().getServiceTracker(); NettyClientBase tmClient = RpcClientManager.getInstance(). getClient(serviceTracker.getUmbilicalAddress(), QueryCoordinatorProtocol.class, true, rpcParams); QueryCoordinatorProtocolService masterClientService = tmClient.getStub();