List of usage examples for org.apache.hadoop.yarn.api.records ApplicationId setId
@Private
@Unstable
protected abstract void setId(int id);
From source file:com.continuuity.weave.yarn.YarnWeaveController.java
License:Open Source License
/** * Fetches applicationId from the ZK instance node. *//*from www .ja va 2 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);//from www.j ava2s . co m int id = Integer.parseInt(appId.substring(appId.lastIndexOf('_') + 1)); aid.setId(id); killRequest.setApplicationId(aid); crmp.forceKillApplication(killRequest); }