Example usage for org.apache.hadoop.registry.client.types.yarn PersistencePolicies CONTAINER

List of usage examples for org.apache.hadoop.registry.client.types.yarn PersistencePolicies CONTAINER

Introduction

In this page you can find the example usage for org.apache.hadoop.registry.client.types.yarn PersistencePolicies CONTAINER.

Prototype

String CONTAINER

To view the source code for org.apache.hadoop.registry.client.types.yarn PersistencePolicies CONTAINER.

Click Source Link

Document

Remove when the YARN container in the ID field finishes:

Usage

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/*from  www  .  ja  v a 2s.  c  om*/
 * @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;
}