logger.trace(methodName, null, messages.fetch("enter"));
Iterator<DuccId> iterator = inventoryProcessMap.keySet().iterator();
long t0 = System.currentTimeMillis();
synchronized(workMap) {
while(iterator.hasNext()) {
DuccId processId = iterator.next();
IDuccProcess inventoryProcess = inventoryProcessMap.get(processId);
List<IUimaPipelineAEComponent> upcList = inventoryProcess.getUimaPipelineComponents();
if(upcList != null) {
Iterator<IUimaPipelineAEComponent> upcIterator = upcList.iterator();
while(upcIterator.hasNext()) {
IUimaPipelineAEComponent upc = upcIterator.next();
logger.debug(methodName, null, processId, "pipelineInfo: "+inventoryProcess.getNodeIdentity()+" "+inventoryProcess.getPID()+" "+upc.getAeName()+" "+upc.getAeState()+" "+upc.getInitializationTime());
}
}
ProcessType processType = inventoryProcess.getProcessType();
if(processType != null) {
DuccId jobId = OrchestratorCommonArea.getInstance().getProcessAccounting().getJobId(processId);
if(jobId != null) {
IDuccWork duccWork = workMap.findDuccWork(jobId);
if(duccWork != null) {
DuccType jobType = duccWork.getDuccType();
switch(jobType) {
case Job:
switch(processType) {
case Pop:
OrchestratorCommonArea.getInstance().getProcessAccounting().setStatus(inventoryProcess);
DuccWorkJob job = (DuccWorkJob) duccWork;
switch(inventoryProcess.getProcessState()) {
case Failed:
if(inventoryProcess.getDuccId().getFriendly() == 0) {
jobTerminate(job, JobCompletionType.DriverProcessFailed, new Rationale(inventoryProcess.getReasonForStoppingProcess()), inventoryProcess.getProcessDeallocationType());
}
else {
jobTerminate(job, JobCompletionType.ProcessFailure, new Rationale(inventoryProcess.getReasonForStoppingProcess()), inventoryProcess.getProcessDeallocationType());
}
break;
default:
if(inventoryProcess.isComplete()) {
OrchestratorCommonArea.getInstance().getProcessAccounting().deallocate(job,ProcessDeallocationType.Stopped);
IRationale rationale = new Rationale("state manager reported as normal completion");
int errors = job.getSchedulingInfo().getIntWorkItemsError();
int lost = job.getSchedulingInfo().getIntWorkItemsLost();
if(errors > 0) {
setCompletionIfNotAlreadySet(job, JobCompletionType.Error, new Rationale("state manager detected error work items="+errors));
}
else if(lost > 0) {
setCompletionIfNotAlreadySet(job, JobCompletionType.Lost, new Rationale("state manager detected lost work items="+lost));
}
// <UIMA-3337>
else {
setCompletionIfNotAlreadySet(job, JobCompletionType.EndOfJob, rationale);
}
// </UIMA-3337>
completeJob(job, rationale);
}
break;
}
break;
case Service:
logger.warn(methodName, jobId, processId, "unexpected process type: "+processType);
break;
case Job_Uima_AS_Process:
OrchestratorCommonArea.getInstance().getProcessAccounting().setStatus(inventoryProcess);
break;
}
break;
case Service:
DuccWorkJob service = (DuccWorkJob) duccWork;
switch(processType) {
case Pop:
OrchestratorCommonArea.getInstance().getProcessAccounting().setStatus(inventoryProcess);
if(inventoryProcess.isComplete()) {
OrchestratorCommonArea.getInstance().getProcessAccounting().deallocate(service,ProcessDeallocationType.Stopped);
}
if(!service.hasAliveProcess()) {
completeManagedReservation(service, new Rationale("state manager reported no viable service process exists, type="+processType));
}
break;
case Service:
OrchestratorCommonArea.getInstance().getProcessAccounting().setStatus(inventoryProcess);
if(inventoryProcess.isComplete()) {
OrchestratorCommonArea.getInstance().getProcessAccounting().deallocate(service,ProcessDeallocationType.Stopped);
}
if(!service.hasAliveProcess()) {
completeService(service, new Rationale("state manager reported no viable service process exists, type="+processType));
}
break;
case Job_Uima_AS_Process:
OrchestratorCommonArea.getInstance().getProcessAccounting().setStatus(inventoryProcess);
if(inventoryProcess.isComplete()) {
OrchestratorCommonArea.getInstance().getProcessAccounting().deallocate(service,ProcessDeallocationType.Stopped);
}
if(!service.hasAliveProcess()) {
completeService(service, new Rationale("state manager reported no viable service process exists, type="+processType));
}
break;
}
break;
}
}
else {
StringBuffer sb = new StringBuffer();
sb.append("node:"+inventoryProcess.getNodeIdentity().getName());
sb.append(" ");
sb.append("PID:"+inventoryProcess.getPID());
sb.append(" ");
sb.append("type:"+inventoryProcess.getProcessType());
logger.debug(methodName, jobId, sb);
}
}
else {
StringBuffer sb = new StringBuffer();
sb.append("node:"+inventoryProcess.getNodeIdentity().getName());
sb.append(" ");
sb.append("PID:"+inventoryProcess.getPID());
sb.append(" ");
sb.append("type:"+inventoryProcess.getProcessType());
logger.debug(methodName, jobId, sb);
}
}
else {
DuccId jobId = null;
StringBuffer sb = new StringBuffer();
sb.append("node:"+inventoryProcess.getNodeIdentity().getName());
sb.append(" ");
sb.append("PID:"+inventoryProcess.getPID());
sb.append(" ");