Package org.apache.hadoop.yarn.client.api

Examples of org.apache.hadoop.yarn.client.api.TimelineClient


      System.err.println("Error: " + e.getMessage());
      e.printStackTrace(System.err);
      return;
    }
    Configuration conf = new YarnConfiguration();
    TimelineClient client = TimelineClient.createTimelineClient();
    client.init(conf);
    client.start();
    try {
      if (UserGroupInformation.isSecurityEnabled()
          && conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, false)) {
        Token<TimelineDelegationTokenIdentifier> token =
            client.getDelegationToken(
                UserGroupInformation.getCurrentUser().getUserName());
        UserGroupInformation.getCurrentUser().addToken(token);
      }
      TimelinePutResponse response = client.putEntities(
          entities.getEntities().toArray(
              new TimelineEntity[entities.getEntities().size()]));
      if (response.getErrors().size() == 0) {
        System.out.println("Timeline data is successfully put");
      } else {
        for (TimelinePutResponse.TimelinePutError error : response.getErrors()) {
          System.out.println("TimelineEntity [" + error.getEntityType() + ":" +
              error.getEntityId() + "] is not successfully put. Error code: " +
              error.getErrorCode());
        }
      }
    } catch (Exception e) {
      System.err.println("Error: " + e.getMessage());
      e.printStackTrace(System.err);
    } finally {
      client.stop();
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.yarn.client.api.TimelineClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.