Created
November 15, 2018 23:18
-
-
Save pdtran3k6/95b2c1f31e0db270cdaa3141b93bf7ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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