Skip to content

Instantly share code, notes, and snippets.

@pdtran3k6
Created November 15, 2018 23:18
Show Gist options
  • Save pdtran3k6/95b2c1f31e0db270cdaa3141b93bf7ee to your computer and use it in GitHub Desktop.
Save pdtran3k6/95b2c1f31e0db270cdaa3141b93bf7ee to your computer and use it in GitHub Desktop.
public class TonyJobMetadata {
private static final Log LOG = LogFactory.getLog(TonyJobMetadata.class);
private String id;
private String url;
private long started;
private long completed;
private String status;
private String user;
public TonyJobMetadata(String id, String url, long started, long completed, String status, String user) {
this.id = id;
this.url = url;
this.started = started;
this.completed = completed;
this.status = status;
this.user = user;
}
public static TonyJobMetadata newInstance(Configuration yarnConf, String appId, long started, long completed,
boolean status) {
String jobStatus = status ? "SUCCEEDED" : "FAILED";
String user = null;
try {
user = UserGroupInformation.getCurrentUser().getShortUserName();
} catch (IOException e) {
LOG.error("Failed reading from disk. Set user to null", e);
}
return new TonyJobMetadata(appId, Utils.buildRMUrl(yarnConf, appId), started, completed, jobStatus, user);
}
// Getters and setters...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment