sb.append("</span>");
sb.append("</td>");
// Duration
sb.append("<td align=\"right\">");
if(duccwork instanceof DuccWorkReservation) {
DuccWorkReservation reservation = (DuccWorkReservation) duccwork;
String duration;
String decoratedDuration;
switch(reservation.getReservationState()) {
case Completed:
sb.append("<span>");
duration = getDuration(request,reservation);
decoratedDuration = decorateDuration(request,reservation, duration);
sb.append(decoratedDuration);
sb.append("</span>");
break;
default:
sb.append("<span class=\"health_green\""+">");
duration = getDuration(request,reservation,now);
decoratedDuration = decorateDuration(request,reservation, duration);
sb.append(decoratedDuration);
sb.append("</span>");
break;
}
}
else if(duccwork instanceof DuccWorkJob) {
DuccWorkJob job = (DuccWorkJob) duccwork;
switch(job.getJobState()) {
case Completed:
sb.append("<span>");
String duration = getDuration(request,job);
String decoratedDuration = decorateDuration(request,job, duration);
sb.append(decoratedDuration);
sb.append("</span>");
break;
default:
sb.append("<span class=\"health_green\""+">");
duration = getDuration(request,job,now);
decoratedDuration = decorateDuration(request,job, duration);
sb.append(decoratedDuration);
sb.append("</span>");
break;
}
}
sb.append("</td>");
// User
String title = "";
String submitter = duccwork.getStandardInfo().getSubmitter();
if(submitter != null) {
title = "title=\"submitter PID@host: "+submitter+"\"";
}
sb.append("<td "+title+">");
UserId userId = new UserId(duccwork.getStandardInfo().getUser());
sb.append(userId.toString());
sb.append("</td>");
// Class
sb.append("<td>");
sb.append(stringNormalize(duccwork.getSchedulingInfo().getSchedulingClass(),messages.fetch("default")));
sb.append("</td>");
// Type
sb.append("<td>");
sb.append(reservationType);
sb.append("</td>");
// State
sb.append("<td>");
if(duccData.isLive(duccId)) {
if(duccwork.isOperational()) {
sb.append("<span class=\"active_state\">");
}
else {
sb.append("<span class=\"completed_state\">");
}
}
else {
sb.append("<span class=\"historic_state\">");
}
sb.append(duccwork.getStateObject().toString());
if(duccData.isLive(duccId)) {
sb.append("</span>");
}
sb.append("</td>");
// Reason
if(duccwork instanceof DuccWorkReservation) {
sb.append("<td>");
DuccWorkReservation reservation = (DuccWorkReservation) duccwork;
switch(reservation.getCompletionType()) {
case Undefined:
break;
case CanceledByUser:
case CanceledByAdmin:
try {
String cancelUser = duccwork.getStandardInfo().getCancelUser();
if(cancelUser != null) {
sb.append("<span title=\"canceled by "+cancelUser+"\">");
sb.append(duccwork.getCompletionTypeObject().toString());
sb.append("</span>");
}
else {
IRationale rationale = reservation.getCompletionRationale();
if(rationale != null) {
sb.append("<span title=\""+rationale+"\">");
sb.append(duccwork.getCompletionTypeObject().toString());
sb.append("</span>");
}
else {
sb.append(duccwork.getCompletionTypeObject().toString());
}
}
}
catch(Exception e) {
IRationale rationale = reservation.getCompletionRationale();
if(rationale != null) {
sb.append("<span title=\""+rationale+"\">");
sb.append(duccwork.getCompletionTypeObject().toString());
sb.append("</span>");
}
else {
sb.append(duccwork.getCompletionTypeObject().toString());
}
}
break;
default:
IRationale rationale = reservation.getCompletionRationale();
if(rationale != null) {
sb.append("<span title=\""+rationale+"\">");
sb.append(duccwork.getCompletionTypeObject().toString());
sb.append("</span>");
}
else {
sb.append(duccwork.getCompletionTypeObject().toString());
}
break;
}
sb.append("</td>");
}
else if(duccwork instanceof DuccWorkJob) {
DuccWorkJob job = (DuccWorkJob) duccwork;
String reason = getReason(job, DuccType.Reservation).toString();
sb.append("<td>");
sb.append(reason);
sb.append("</td>");
}
// Allocation
sb.append("<td align=\"right\">");
sb.append(duccwork.getSchedulingInfo().getInstancesCount());
sb.append("</td>");
// User Processes
sb.append("<td align=\"right\">");
TreeMap<String,Integer> nodeMap = new TreeMap<String,Integer>();
if(duccwork instanceof DuccWorkReservation) {
DuccWorkReservation reservation = (DuccWorkReservation) duccwork;
if(!reservation.getReservationMap().isEmpty()) {
IDuccReservationMap map = reservation.getReservationMap();
for (DuccId key : map.keySet()) {
IDuccReservation value = reservation.getReservationMap().get(key);
String node = value.getNodeIdentity().getName();
if(!nodeMap.containsKey(node)) {
nodeMap.put(node,new Integer(0));
}
Integer count = nodeMap.get(node);