8. Publishing Per-Framework Data in Applications

Developers can define the information they would like to record for their applications by composing TimelineEntity and TimelineEvent objects, and then putting the entities and events to the Timeline server via TimelineClient. For example:

 // Create and start the Timeline client
 TimelineClient client = TimelineClient.createTimelineClient();
 client.init(conf);
 client.start();

 TimelineEntity entity = null;
 // Compose the entity
 try {
 TimelinePutResponse response = client.putEntities(entity);
 } catch (IOException e) {
 // Handle the exception
 } catch (YarnException e) {
 // Handle the exception
 }

 // Stop the Timeline client
 client.stop();

loading table of contents...