use of org.ow2.proactive.utils.ObjectArrayFormatter in project scheduling by ow2-proactive.
the class StringUtility method jobsAsString.
public static String jobsAsString(List<UserJobData> jobs) {
ObjectArrayFormatter formatter = new ObjectArrayFormatter();
formatter.setMaxColumnLength(30);
formatter.setSpace(4);
List<String> columnNames = new ArrayList<>(7);
columnNames.add("ID");
columnNames.add("NAME");
columnNames.add("OWNER");
columnNames.add("PRIORITY");
columnNames.add("STATUS");
columnNames.add("START AT");
columnNames.add("DURATION");
formatter.setTitle(columnNames);
formatter.addEmptyLine();
for (UserJobData job : jobs) {
formatter.addLine(rowList(job));
}
return Tools.getStringAsArray(formatter);
}
use of org.ow2.proactive.utils.ObjectArrayFormatter in project scheduling by ow2-proactive.
the class StringUtility method taskStatesAsString.
public static String taskStatesAsString(Collection<TaskStateData> tasks, boolean displayTags) {
// create formatter
ObjectArrayFormatter formatter = new ObjectArrayFormatter();
formatter.setMaxColumnLength(80);
// space between column
formatter.setSpace(4);
// title line
List<String> list = new ArrayList<>();
list.add("ID");
list.add("NAME");
if (displayTags) {
list.add("TAG");
}
list.add("ITER");
list.add("DUP");
list.add("STATUS");
list.add("HOSTNAME");
list.add("EXEC DURATION");
list.add("TOT DURATION");
list.add("#NODES USED");
list.add("#EXECUTIONS");
list.add("#NODES KILLED");
formatter.setTitle(list);
formatter.addEmptyLine();
for (TaskStateData taskState : tasks) {
list = new ArrayList<>();
TaskInfoData taskInfo = taskState.getTaskInfo();
TaskIdData taskId = taskInfo.getTaskId();
list.add(String.valueOf(taskId.getId()));
list.add(taskId.getReadableName());
if (displayTags) {
list.add(toStringNullable(taskState.getTag()));
}
list.add((taskState.getIterationIndex() > 0) ? "" + taskState.getIterationIndex() : "");
list.add((taskState.getReplicationIndex() > 0) ? "" + taskState.getReplicationIndex() : "");
list.add(taskInfo.getTaskStatus().toString());
list.add(toStringNullable(taskInfo.getExecutionHostName(), "unknown"));
if (taskInfo.getTaskStatus() == TaskStatusData.IN_ERROR) {
list.add(Tools.getFormattedDuration(taskInfo.getInErrorTime(), taskInfo.getStartTime()));
} else {
list.add(Tools.getFormattedDuration(0, taskInfo.getExecutionDuration()));
}
list.add(Tools.getFormattedDuration(taskInfo.getFinishedTime(), taskInfo.getStartTime()));
list.add("" + taskState.getNumberOfNodesNeeded());
list.add((taskState.getMaxNumberOfExecution() - taskInfo.getNumberOfExecutionLeft()) + "/" + taskState.getMaxNumberOfExecution());
list.add((taskState.getMaxNumberOfExecutionOnFailure() - taskInfo.getNumberOfExecutionOnFailureLeft()) + "/" + taskState.getMaxNumberOfExecutionOnFailure());
formatter.addLine(list);
}
return Tools.getStringAsArray(formatter);
}
use of org.ow2.proactive.utils.ObjectArrayFormatter in project scheduling by ow2-proactive.
the class StringUtility method string.
public static String string(NodeSourceView[] nodeSources) {
ObjectArrayFormatter formatter = new ObjectArrayFormatter();
formatter.setMaxColumnLength(80);
formatter.setSpace(4);
List<String> titles = new ArrayList<>(3);
titles.add("SOURCE_NAME");
titles.add("DESCRIPTION");
titles.add("ADMINISTRATOR");
formatter.setTitle(titles);
formatter.addEmptyLine();
for (NodeSourceView ns : nodeSources) {
List<String> line = new ArrayList<>(3);
line.add(ns.getSourceName());
line.add(ns.getSourceDescription());
line.add(ns.getNodeSourceAdmin());
formatter.addLine(line);
}
return Tools.getStringAsArray(formatter);
}
use of org.ow2.proactive.utils.ObjectArrayFormatter in project scheduling by ow2-proactive.
the class StringUtility method credentialsKeysAsString.
public static String credentialsKeysAsString(Set<String> keys) {
ObjectArrayFormatter formatter = new ObjectArrayFormatter();
formatter.setMaxColumnLength(30);
formatter.setSpace(4);
formatter.setTitle(Collections.singletonList("KEY"));
formatter.addEmptyLine();
for (String key : keys) {
formatter.addLine(Collections.singletonList(key));
}
return Tools.getStringAsArray(formatter);
}
Aggregations