Example usage for org.apache.hadoop.yarn.api.records ApplicationId setClusterTimestamp

List of usage examples for org.apache.hadoop.yarn.api.records ApplicationId setClusterTimestamp

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.api.records ApplicationId setClusterTimestamp.

Prototype

@Private
    @Unstable
    protected abstract void setClusterTimestamp(long clusterTimestamp);

Source Link

Usage

From source file:com.continuuity.weave.yarn.YarnWeaveController.java

License:Open Source License

/**
 * Fetches applicationId from the ZK instance node.
 *//*from  w w w .j ava2  s  .  c o  m*/
private ApplicationId fetchApplicationId() {
    byte[] data = getLiveNodeData();
    if (data == null) {
        LOG.warn("No live data node.");
        return null;
    }
    JsonElement json = new Gson().fromJson(new String(data, Charsets.UTF_8), JsonElement.class);
    if (!json.isJsonObject()) {
        LOG.warn("Unable to decode live data node.");
        return null;
    }
    JsonObject jsonObj = json.getAsJsonObject();
    json = jsonObj.get("data");
    if (!json.isJsonObject()) {
        LOG.warn("Property data not found in live data node.");
        return null;
    }
    jsonObj = json.getAsJsonObject();
    ApplicationId appId = Records.newRecord(ApplicationId.class);
    appId.setId(jsonObj.get("appId").getAsInt());
    appId.setClusterTimestamp(jsonObj.get("appIdClusterTime").getAsLong());

    return appId;
}

From source file:edu.uci.ics.hyracks.yarn.common.protocols.clientrm.YarnClientRMConnection.java

License:Apache License

public void killApplication(String appId) throws Exception {
    KillApplicationRequest killRequest = Records.newRecord(KillApplicationRequest.class);
    ApplicationId aid = Records.newRecord(ApplicationId.class);
    long ts = Long.parseLong(appId.substring(appId.indexOf('_') + 1, appId.lastIndexOf('_')));
    aid.setClusterTimestamp(ts);
    int id = Integer.parseInt(appId.substring(appId.lastIndexOf('_') + 1));
    aid.setId(id);/*w  w w.ja  va  2 s . c om*/
    killRequest.setApplicationId(aid);
    crmp.forceKillApplication(killRequest);
}