Iterator<DuccId> resourceMapIterator = resourceMap.keySet().iterator();
while(resourceMapIterator.hasNext()) {
DuccId duccId = resourceMapIterator.next();
IResource resource = resourceMap.get(duccId);
Node node = resourceMap.get(duccId).getNode();
NodeIdentity nodeId = node.getNodeIdentity();
if(!processMap.containsKey(duccId)) {
ProcessType processType = null;
switch(duccWorkJob.getServiceDeploymentType()) {
case custom:
case other:
processType = ProcessType.Pop;
break;
case uima:
case unspecified:
processType = ProcessType.Job_Uima_AS_Process;
break;
}
DuccProcess process = new DuccProcess(duccId, node, processType);
long process_max_size_in_bytes = quantum_size_in_bytes * resource.countShares();
CGroupManager.assign(duccWorkJob.getDuccId(), process, process_max_size_in_bytes);
orchestratorCommonArea.getProcessAccounting().addProcess(duccId, duccWorkJob.getDuccId());
processMap.addProcess(process);
process.setResourceState(ResourceState.Allocated);
logger.info(methodName, duccWorkJob.getDuccId(), messages.fetch("resource added")
+" "+messages.fetchLabel("process")+duccId.getFriendly()
+" "+messages.fetchLabel("unique")+duccId.getUnique()
+" "+messages.fetchLabel("name")+nodeId.getName()
+" "+messages.fetchLabel("ip")+nodeId.getIp());
changes++;
// check on usefulness of recent allocation
switch(duccWorkJob.getJobState()) {
// allocation unnecessary if job is already completed
case Completing:
case Completed:
process.setResourceState(ResourceState.Deallocated);
process.setProcessDeallocationType(ProcessDeallocationType.Voluntary);
process.advanceProcessState(ProcessState.Stopped);
logger.warn(methodName, duccWorkJob.getDuccId(),
messages.fetch("resource allocated for completed job")
+" "+
messages.fetchLabel("process")+duccId.getFriendly()
);
break;
default:
// allocation unnecessary if job has excess capacity
if(isExcessCapacity(duccWorkJob,driverStatusReportMap.get(duccId))) {
process.setResourceState(ResourceState.Deallocated);
process.setProcessDeallocationType(ProcessDeallocationType.Voluntary);
process.advanceProcessState(ProcessState.Stopped);
logger.warn(methodName, duccWorkJob.getDuccId(),
messages.fetch("resource allocated for over capacity job")
+" "+
messages.fetchLabel("process")+duccId.getFriendly()
);
}
break;
}
}
else {
logger.warn(methodName, duccWorkJob.getDuccId(), messages.fetch("resource exists")
+" "+messages.fetchLabel("process")+duccId.getFriendly()
+" "+messages.fetchLabel("unique")+duccId.getUnique()
+" "+messages.fetchLabel("name")+nodeId.getName()
+" "+messages.fetchLabel("ip")+nodeId.getIp());
}
}
}
logger.trace(methodName, null, messages.fetch("exit"));
return changes;