public Assignment getResult() throws NotAliveException, AuthorizationException, org.apache.storm.thrift.TException { if (getState() != org.apache.storm.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { throw new java.lang.IllegalStateException("Method call not finished!"); } org.apache.storm.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.storm.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); org.apache.storm.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); return (new Client(prot)).recv_getLocalAssignmentForStorm(); } }
private void sendAssignmentsToNode(NodeAssignments assignments) { if (this.service.isLocalMode) { //local node Supervisor supervisor = this.service.localSupervisors.get(assignments.getNode()); if (supervisor != null) { supervisor.sendSupervisorAssignments(assignments.getAssignments()); } else { LOG.error("Can not find node {} for assignments distribution", assignments.getNode()); throw new RuntimeException("null for node " + assignments.getNode() + " supervisor instance."); } } else { // distributed mode try (SupervisorClient client = SupervisorClient.getConfiguredClient(service.getConf(), assignments.getHost(), assignments.getServerPort())) { try { client.getClient().sendSupervisorAssignments(assignments.getAssignments()); } catch (Exception e) { //just ignore the exception. LOG.error("Exception when trying to send assignments to node {}: {}", assignments.getNode(), e.getMessage()); } } catch (Throwable e) { //just ignore any error/exception. LOG.error("Exception to create supervisor client for node {}: {}", assignments.getNode(), e.getMessage()); } } } }
/** * Send a heartbeat to local supervisor first to check if supervisor is ok for heartbeating. */ private void heartbeatToMasterIfLocalbeatFail(LSWorkerHeartbeat lsWorkerHeartbeat) { if (ConfigUtils.isLocalMode(this.conf)) { return; } //In distributed mode, send heartbeat directly to master if local supervisor goes down. SupervisorWorkerHeartbeat workerHeartbeat = new SupervisorWorkerHeartbeat(lsWorkerHeartbeat.get_topology_id(), lsWorkerHeartbeat.get_executors(), lsWorkerHeartbeat.get_time_secs()); try (SupervisorClient client = SupervisorClient.getConfiguredClient(conf, Utils.hostname(), supervisorPort)) { client.getClient().sendSupervisorWorkerHeartbeat(workerHeartbeat); } catch (Exception tr1) { //If any error/exception thrown, report directly to nimbus. LOG.warn("Exception when send heartbeat to local supervisor", tr1.getMessage()); try (NimbusClient nimbusClient = NimbusClient.getConfiguredClient(conf)) { nimbusClient.getClient().sendSupervisorWorkerHeartbeat(workerHeartbeat); } catch (Exception tr2) { //if any error/exception thrown, just ignore. LOG.error("Exception when send heartbeat to master", tr2.getMessage()); } } }
public Assignment recv_getLocalAssignmentForStorm() throws NotAliveException, AuthorizationException, org.apache.storm.thrift.TException { getLocalAssignmentForStorm_result result = new getLocalAssignmentForStorm_result(); receiveBase(result, "getLocalAssignmentForStorm"); if (result.is_set_success()) { return result.success; } if (result.e != null) { throw result.e; } if (result.aze != null) { throw result.aze; } throw new org.apache.storm.thrift.TApplicationException(org.apache.storm.thrift.TApplicationException.MISSING_RESULT, "getLocalAssignmentForStorm failed: unknown result"); }
public Client getClient(org.apache.storm.thrift.protocol.TProtocol iprot, org.apache.storm.thrift.protocol.TProtocol oprot) { return new Client(iprot, oprot); } }
public SupervisorClient(Map conf, String host, Integer port, Integer timeout, String asUser) throws TTransportException { super(conf, ThriftConnectionType.SUPERVISOR, host, port, timeout, asUser); client = new Supervisor.Client(_protocol); }
private Assignment getLocalAssignment(Map<String, Object> conf, IStormClusterState stormClusterState, String topologyId) { if (!ConfigUtils.isLocalMode(conf)) { try (SupervisorClient supervisorClient = SupervisorClient.getConfiguredClient(conf, Utils.hostname(), supervisorPort)) { Assignment assignment = supervisorClient.getClient().getLocalAssignmentForStorm(topologyId); return assignment; } catch (Throwable tr1) { //if any error/exception thrown, fetch it from zookeeper return stormClusterState.remoteAssignmentInfo(topologyId, null); } } else { return stormClusterState.remoteAssignmentInfo(topologyId, null); } }
public SupervisorClient(Map conf, String host, int port, Integer timeout) throws TTransportException { super(conf, ThriftConnectionType.SUPERVISOR, host, port, timeout, null); client = new Supervisor.Client(_protocol); }
public void send_getLocalAssignmentForStorm(java.lang.String id) throws org.apache.storm.thrift.TException { getLocalAssignmentForStorm_args args = new getLocalAssignmentForStorm_args(); args.set_id(id); sendBase("getLocalAssignmentForStorm", args); }
public void send_sendSupervisorAssignments(SupervisorAssignments assignments) throws org.apache.storm.thrift.TException { sendSupervisorAssignments_args args = new sendSupervisorAssignments_args(); args.set_assignments(assignments); sendBase("sendSupervisorAssignments", args); }
public Assignment getLocalAssignmentForStorm(java.lang.String id) throws NotAliveException, AuthorizationException, org.apache.storm.thrift.TException { send_getLocalAssignmentForStorm(id); return recv_getLocalAssignmentForStorm(); }
public void send_sendSupervisorWorkerHeartbeat(SupervisorWorkerHeartbeat heartbeat) throws org.apache.storm.thrift.TException { sendSupervisorWorkerHeartbeat_args args = new sendSupervisorWorkerHeartbeat_args(); args.set_heartbeat(heartbeat); sendBase("sendSupervisorWorkerHeartbeat", args); }
public void recv_sendSupervisorAssignments() throws AuthorizationException, org.apache.storm.thrift.TException { sendSupervisorAssignments_result result = new sendSupervisorAssignments_result(); receiveBase(result, "sendSupervisorAssignments"); if (result.aze != null) { throw result.aze; } return; }
public Client getClient(org.apache.storm.thrift.protocol.TProtocol prot) { return new Client(prot); } public Client getClient(org.apache.storm.thrift.protocol.TProtocol iprot, org.apache.storm.thrift.protocol.TProtocol oprot) {
public SupervisorClient(Map conf, String host) throws TTransportException { super(conf, ThriftConnectionType.SUPERVISOR, host, null, null, null); client = new Supervisor.Client(_protocol); }
public void recv_sendSupervisorWorkerHeartbeat() throws AuthorizationException, org.apache.storm.thrift.TException { sendSupervisorWorkerHeartbeat_result result = new sendSupervisorWorkerHeartbeat_result(); receiveBase(result, "sendSupervisorWorkerHeartbeat"); if (result.aze != null) { throw result.aze; } return; }
public void sendSupervisorAssignments(SupervisorAssignments assignments) throws AuthorizationException, org.apache.storm.thrift.TException { send_sendSupervisorAssignments(assignments); recv_sendSupervisorAssignments(); }
public void sendSupervisorWorkerHeartbeat(SupervisorWorkerHeartbeat heartbeat) throws AuthorizationException, org.apache.storm.thrift.TException { send_sendSupervisorWorkerHeartbeat(heartbeat); recv_sendSupervisorWorkerHeartbeat(); }