add application IDs in project daily cost
@@ -273,7 +273,8 @@ private void computeAndApplyChargeInt(
projectName, user, containerLog.getContainerid(), charge);
//** ProjectDailyCost charging**
chargeProjectDailyCost(chargedProjectsDailyCost, projectName,
- user, curentDay, charge);
+ user, curentDay, charge,
+ containerId.getApplicationAttemptId().getApplicationId());
} else {
//The container has finished running
@@ -295,7 +296,7 @@ private void computeAndApplyChargeInt(
//** ProjectDailyCost charging**
chargeProjectDailyCost(chargedProjectsDailyCost, projectName,
- user, curentDay, charge);
+ user, curentDay, charge, containerId.getApplicationAttemptId().getApplicationId());
}
} else {
if (checkpoint == containerLog.getStart() &&
@@ -368,7 +369,7 @@ private void chargeProjectQuota(
private void chargeProjectDailyCost(
Map<ProjectDailyId, ProjectDailyCost> chargedProjectsDailyCost,
- String projectid, String user, long day, float charge) {
+ String projectid, String user, long day, float charge, ApplicationId appId) {
LOG.debug("Quota: project " + projectid + " user " + user + " has used "
+ charge + " credits, on day: " + day);
@@ -381,11 +382,11 @@ private void chargeProjectDailyCost(
ProjectDailyCost projectDailyCost = projectsDailyCostCache.get(key);
if (projectDailyCost == null) {
- projectDailyCost = new ProjectDailyCost(projectid, user, day, 0);
+ projectDailyCost = new ProjectDailyCost(projectid, user, day, 0, appId.toString());
projectsDailyCostCache.put(key, projectDailyCost);
}
- projectDailyCost.incrementCharge(charge);
+ projectDailyCost.incrementCharge(charge, appId.toString());
chargedProjectsDailyCost.put(key, projectDailyCost);
@@ -414,6 +415,7 @@ public void recover() throws IOException {
final long day = TimeUnit.DAYS.convert(System.currentTimeMillis(),
TimeUnit.MILLISECONDS);
+ cashDay = day;
LightWeightRequestHandler recoveryHandler = new LightWeightRequestHandler(
YARNOperationType.TEST) {
@Override
