List of usage examples for org.apache.hadoop.registry.client.types.yarn YarnRegistryAttributes YARN_ID
String YARN_ID
To view the source code for org.apache.hadoop.registry.client.types.yarn YarnRegistryAttributes YARN_ID.
Click Source Link
From source file:org.apache.slider.client.SliderClient.java
License:Apache License
/** * Log a service record instance/* w w w.ja va 2s . co m*/ * @param instance record * @param verbose verbose logging of all external endpoints */ private void logInstance(ServiceRecord instance, boolean verbose) { if (!verbose) { log.info("{}", instance.get(YarnRegistryAttributes.YARN_ID, "")); } else { log.info("{}: ", instance.get(YarnRegistryAttributes.YARN_ID, "")); logEndpoints(instance); } }
From source file:org.apache.slider.providers.hbase.HBaseProviderService.java
License:Apache License
private void registerHBaseServiceEntry() throws IOException { String name = amState.getApplicationName(); ServiceRecord serviceRecord = new ServiceRecord(); // bond lifespan to the application serviceRecord.set(YarnRegistryAttributes.YARN_ID, yarnRegistry.getApplicationAttemptId().getApplicationId().toString()); serviceRecord.set(YarnRegistryAttributes.YARN_PERSISTENCE, PersistencePolicies.APPLICATION); try {/*from w w w. j a va 2 s . com*/ URL configURL = new URL(amWebAPI, SLIDER_PATH_PUBLISHER + "/" + HBASE_SERVICE_TYPE); serviceRecord.addExternalEndpoint(RegistryTypeUtils .restEndpoint(CustomRegistryConstants.PUBLISHER_CONFIGURATIONS_API, configURL.toURI())); } catch (URISyntaxException e) { log.warn("failed to create config URL: {}", e, e); } log.info("registering {}/{}", name, HBASE_SERVICE_TYPE); yarnRegistry.putService(HBASE_SERVICE_TYPE, name, serviceRecord, true); PublishedConfiguration publishedSite = new PublishedConfiguration("HBase site", siteConf); PublishedConfigSet configSet = amState.getOrCreatePublishedConfigSet(HBASE_SERVICE_TYPE); configSet.put(HBASE_SITE_PUBLISHED_CONFIG, publishedSite); }
From source file:org.apache.slider.server.appmaster.SliderAppMaster.java
License:Apache License
/** * This registers the service instance and its external values * @param instanceName name of this instance * @param appid application ID//from w ww.j a v a2 s .c o m * @throws IOException */ private void registerServiceInstance(String instanceName, ApplicationId appid) throws IOException { // the registry is running, so register services URL amWebURI = new URL(appMasterTrackingUrl); URL agentOpsURI = new URL(agentOpsUrl); URL agentStatusURI = new URL(agentStatusUrl); //Give the provider restricted access to the state, registry setupInitialRegistryPaths(); yarnRegistryOperations = new YarnRegistryViewForProviders(registryOperations, service_user_name, SliderKeys.APP_TYPE, instanceName, appAttemptID); providerService.bindToYarnRegistry(yarnRegistryOperations); sliderAMProvider.bindToYarnRegistry(yarnRegistryOperations); // Yarn registry ServiceRecord serviceRecord = new ServiceRecord(); serviceRecord.set(YarnRegistryAttributes.YARN_ID, appid.toString()); serviceRecord.set(YarnRegistryAttributes.YARN_PERSISTENCE, PersistencePolicies.APPLICATION); serviceRecord.description = "Slider Application Master"; /* SLIDER-531: disable this addition so things compile against versions of the registry with/without the new record format serviceRecord.addExternalEndpoint( RegistryTypeUtils.ipcEndpoint( CustomRegistryConstants.AM_IPC_PROTOCOL, rpcServiceAddress)); */ // internal services sliderAMProvider.applyInitialRegistryDefinitions(amWebURI, agentOpsURI, agentStatusURI, serviceRecord); // provider service dynamic definitions. providerService.applyInitialRegistryDefinitions(amWebURI, agentOpsURI, agentStatusURI, serviceRecord); // register the service's entry log.info("Service Record \n{}", serviceRecord); yarnRegistryOperations.registerSelf(serviceRecord, true); log.info("Registered service under {}; absolute path {}", yarnRegistryOperations.getSelfRegistrationPath(), yarnRegistryOperations.getAbsoluteSelfRegistrationPath()); boolean isFirstAttempt = 1 == appAttemptID.getAttemptId(); // delete the children in case there are any and this is an AM startup. // just to make sure everything underneath is purged if (isFirstAttempt) { yarnRegistryOperations.deleteChildren(yarnRegistryOperations.getSelfRegistrationPath(), true); } }
From source file:org.apache.slider.server.appmaster.SliderAppMaster.java
License:Apache License
/** * Handler for {@link RegisterComponentInstance action} * Register/re-register an ephemeral container that is already in the app state * @param id the component/* w ww . j av a2 s . c o m*/ * @param description */ public boolean registerComponent(ContainerId id, String description) throws IOException { RoleInstance instance = appState.getOwnedContainer(id); if (instance == null) { return false; } // this is where component registrations go log.info("Registering component {}", id); String cid = RegistryPathUtils.encodeYarnID(id.toString()); ServiceRecord container = new ServiceRecord(); container.set(YarnRegistryAttributes.YARN_ID, cid); container.description = description; container.set(YarnRegistryAttributes.YARN_PERSISTENCE, PersistencePolicies.CONTAINER); try { yarnRegistryOperations.putComponent(cid, container); } catch (IOException e) { log.warn("Failed to register container {}/{}: {}", id, description, e, e); } return true; }