/** * Handler for {@link UnregisterComponentInstance} * * unregister a component. At the time this message is received, * the component may not have been registered * @param id the component */ public void unregisterComponent(ContainerId id) { log.info("Unregistering component {}", id); if (yarnRegistryOperations == null) { log.warn("Processing unregister component event before initialization " + "completed; init flag ={}", initCompleted); return; } String cid = RegistryPathUtils.encodeYarnID(id.toString()); try { yarnRegistryOperations.deleteComponent(cid); } catch (IOException e) { log.warn("Failed to delete container {} : {}", id, e, e); } }
/** * Handler for {@link UnregisterComponentInstance} * * unregister a component. At the time this message is received, * the component may not have been registered * @param id the component */ public void unregisterComponent(ContainerId id) { log.info("Unregistering component {}", id); if (yarnRegistryOperations == null) { log.warn("Processing unregister component event before initialization " + "completed; init flag ={}", initCompleted); return; } String cid = RegistryPathUtils.encodeYarnID(id.toString()); try { yarnRegistryOperations.deleteComponent(cid); } catch (IOException e) { log.warn("Failed to delete container {} : {}", id, e, e); } }
/** Set a DNS friendly hostname. * Only add hostname if network is not host or if hostname is * specified via YARN_CONTAINER_RUNTIME_DOCKER_CONTAINER_HOSTNAME * in host network mode */ private void setHostname(DockerRunCommand runCommand, String containerIdStr, String network, String name) throws ContainerExecutionException { if (network.equalsIgnoreCase("host")) { if (name != null && !name.isEmpty()) { LOG.info("setting hostname in container to: " + name); runCommand.setHostname(name); } } else { //get default hostname if (name == null || name.isEmpty()) { name = RegistryPathUtils.encodeYarnID(containerIdStr); String domain = conf.get(RegistryConstants.KEY_DNS_DOMAIN); if (domain != null) { name += ("." + domain); } validateHostname(name); } LOG.info("setting hostname in container to: " + name); runCommand.setHostname(name); } }
String cid = RegistryPathUtils.encodeYarnID(id.toString()); ServiceRecord container = new ServiceRecord(); container.set(YarnRegistryAttributes.YARN_ID, cid);
String cid = RegistryPathUtils.encodeYarnID(id.toString()); ServiceRecord container = new ServiceRecord(); container.set(YarnRegistryAttributes.YARN_ID, cid);
RegistryPathUtils.encodeYarnID(containerId), record);
RegistryPathUtils.encodeYarnID(containerId), record);
String componentsPath = appPath + RegistryConstants.SUBPATH_COMPONENTS; operations.mknode(componentsPath, false); String dns1 = RegistryPathUtils.encodeYarnID(cid1); String dns1path = componentsPath + dns1; operations.bind(dns1path, comp1, BindFlags.CREATE); String dns2 = RegistryPathUtils.encodeYarnID(cid2); String dns2path = componentsPath + dns2; operations.bind(dns2path, comp2, BindFlags.CREATE);