TezAmInstance(ServiceRecord srv) throws IOException { super(srv, TezAmRegistryImpl.IPC_TEZCLIENT); final Endpoint plugin = srv.getInternalEndpoint(TezAmRegistryImpl.IPC_PLUGIN); if (plugin != null) { this.pluginPort = Integer.parseInt(RegistryTypeUtils.getAddressField( plugin.addresses.get(0), AddressTypes.ADDRESS_PORT_FIELD)); } else { this.pluginPort = -1; } }
public ServiceInstanceBase(ServiceRecord srv, String rpcName) throws IOException { if (LOG.isTraceEnabled()) { LOG.trace("Working with ServiceRecord: {}", srv); } final Endpoint rpc = srv.getInternalEndpoint(rpcName); this.host = RegistryTypeUtils.getAddressField(rpc.addresses.get(0), AddressTypes.ADDRESS_HOSTNAME_FIELD); this.rpcPort = Integer.parseInt(RegistryTypeUtils.getAddressField(rpc.addresses.get(0), AddressTypes.ADDRESS_PORT_FIELD)); this.workerIdentity = srv.get(ZkRegistryBase.UNIQUE_IDENTIFIER); this.properties = srv.attributes(); }
public DynamicServiceInstance(ServiceRecord srv) throws IOException { super(srv, IPC_LLAP); final Endpoint shuffle = srv.getInternalEndpoint(IPC_SHUFFLE); final Endpoint mng = srv.getInternalEndpoint(IPC_MNG); final Endpoint outputFormat = srv.getInternalEndpoint(IPC_OUTPUTFORMAT); final Endpoint services = srv.getExternalEndpoint(IPC_SERVICES); this.mngPort = Integer.parseInt(RegistryTypeUtils.getAddressField(mng.addresses.get(0), AddressTypes.ADDRESS_PORT_FIELD)); this.shufflePort = Integer.parseInt(RegistryTypeUtils.getAddressField(shuffle.addresses.get(0), AddressTypes.ADDRESS_PORT_FIELD)); this.outputFormatPort = Integer.valueOf(RegistryTypeUtils.getAddressField(outputFormat.addresses.get(0), AddressTypes.ADDRESS_PORT_FIELD)); this.serviceAddress = RegistryTypeUtils.getAddressField(services.addresses.get(0), AddressTypes.ADDRESS_URI); String memStr = srv.get(ConfVars.LLAP_DAEMON_MEMORY_PER_INSTANCE_MB.varname, ""); String coreStr = srv.get(ConfVars.LLAP_DAEMON_NUM_EXECUTORS.varname, ""); try { this.resource = Resource.newInstance(Integer.parseInt(memStr), Integer.parseInt(coreStr)); } catch (NumberFormatException ex) { throw new IOException("Invalid resource configuration for a LLAP node: memory " + memStr + ", vcores " + coreStr); } }
TezAmInstance(ServiceRecord srv) throws IOException { super(srv, TezAmRegistryImpl.IPC_TEZCLIENT); final Endpoint plugin = srv.getInternalEndpoint(TezAmRegistryImpl.IPC_PLUGIN); if (plugin != null) { this.pluginPort = Integer.parseInt(RegistryTypeUtils.getAddressField( plugin.addresses.get(0), AddressTypes.ADDRESS_PORT_FIELD)); } else { this.pluginPort = -1; } }
public ServiceInstanceBase(ServiceRecord srv, String rpcName) throws IOException { if (LOG.isTraceEnabled()) { LOG.trace("Working with ServiceRecord: {}", srv); } final Endpoint rpc = srv.getInternalEndpoint(rpcName); this.host = RegistryTypeUtils.getAddressField(rpc.addresses.get(0), AddressTypes.ADDRESS_HOSTNAME_FIELD); this.rpcPort = Integer.parseInt(RegistryTypeUtils.getAddressField(rpc.addresses.get(0), AddressTypes.ADDRESS_PORT_FIELD)); this.workerIdentity = srv.get(ZkRegistryBase.UNIQUE_IDENTIFIER); this.properties = srv.attributes(); }
public DynamicServiceInstance(ServiceRecord srv) throws IOException { super(srv, IPC_LLAP); final Endpoint shuffle = srv.getInternalEndpoint(IPC_SHUFFLE); final Endpoint mng = srv.getInternalEndpoint(IPC_MNG); final Endpoint outputFormat = srv.getInternalEndpoint(IPC_OUTPUTFORMAT); final Endpoint services = srv.getExternalEndpoint(IPC_SERVICES); this.mngPort = Integer.parseInt(RegistryTypeUtils.getAddressField(mng.addresses.get(0), AddressTypes.ADDRESS_PORT_FIELD)); this.shufflePort = Integer.parseInt(RegistryTypeUtils.getAddressField(shuffle.addresses.get(0), AddressTypes.ADDRESS_PORT_FIELD)); this.outputFormatPort = Integer.valueOf(RegistryTypeUtils.getAddressField(outputFormat.addresses.get(0), AddressTypes.ADDRESS_PORT_FIELD)); this.serviceAddress = RegistryTypeUtils.getAddressField(services.addresses.get(0), AddressTypes.ADDRESS_URI); String memStr = srv.get(ConfVars.LLAP_DAEMON_MEMORY_PER_INSTANCE_MB.varname, ""); String coreStr = srv.get(ConfVars.LLAP_DAEMON_NUM_EXECUTORS.varname, ""); try { this.resource = Resource.newInstance(Integer.parseInt(memStr), Integer.parseInt(coreStr)); } catch (NumberFormatException ex) { throw new IOException("Invalid resource configuration for a LLAP node: memory " + memStr + ", vcores " + coreStr); } }
/** * Get a single URI endpoint * @param epr endpoint * @return the uri of the first entry in the address list. Null if the endpoint * itself is null * @throws InvalidRecordException if the type is wrong, there are no addresses * or the payload ill-formatted */ public static List<String> retrieveAddressesUriType(Endpoint epr) throws InvalidRecordException { if (epr == null) { return null; } requireAddressType(ADDRESS_URI, epr); List<Map<String, String>> addresses = epr.addresses; if (addresses.size() < 1) { throw new InvalidRecordException(epr.toString(), "No addresses in endpoint"); } List<String> results = new ArrayList<String>(addresses.size()); for (Map<String, String> address : addresses) { results.add(getAddressField(address, ADDRESS_URI)); } return results; }
/** * Get a single URI endpoint * @param epr endpoint * @return the uri of the first entry in the address list. Null if the endpoint * itself is null * @throws InvalidRecordException if the type is wrong, there are no addresses * or the payload ill-formatted */ public static List<String> retrieveAddressesUriType(Endpoint epr) throws InvalidRecordException { if (epr == null) { return null; } requireAddressType(ADDRESS_URI, epr); List<Map<String, String>> addresses = epr.addresses; if (addresses.size() < 1) { throw new InvalidRecordException(epr.toString(), "No addresses in endpoint"); } List<String> results = new ArrayList<String>(addresses.size()); for (Map<String, String> address : addresses) { results.add(getAddressField(address, ADDRESS_URI)); } return results; }