in tools/cli/src/main/java/org/apache/batchee/cli/command/StepExecutions.java [48:92]
public void doRun() {
final JobOperator operator = operator();
final List<StepExecution> executions = operator.getStepExecutions(id);
if (executions == null || executions.isEmpty()) {
info("Executions of " + id + " not found");
return;
}
info("Step executions of " + id);
final List<Metric.MetricType> metricsOrder = new ArrayList<Metric.MetricType>();
final StringBuilder metrics = new StringBuilder();
for (final Metric.MetricType type : Metric.MetricType.values()) {
metrics.append("\t|\t").append(type.name());
metricsOrder.add(type);
}
final DateFormat format = new SimpleDateFormat("YYYYMMdd hh:mm:ss");
info(" step id\t|\t step name\t|\t start time \t|\t end time \t|\texit status\t|\tbatch status" + metrics.toString());
for (final StepExecution exec : executions) {
final StringBuilder builder = new StringBuilder(String.format("%10d\t|\t%s\t|\t%s\t|\t%s\t|\t%s\t|\t%s",
exec.getStepExecutionId(),
StringUtils.center(exec.getStepName(), 10),
format.format(exec.getStartTime()),
exec.getEndTime() != null ? format.format(exec.getEndTime()) : "-",
StringUtils.center(exec.getExitStatus() == null ? "-" : exec.getExitStatus(), 11),
StringUtils.center(String.valueOf(exec.getBatchStatus()), 12)));
final Map<Metric.MetricType, Long> stepMetrics = new HashMap<Metric.MetricType, Long>();
if (exec.getMetrics() != null) {
for (final Metric m : exec.getMetrics()) {
stepMetrics.put(m.getType(), m.getValue());
}
}
for (final Metric.MetricType type : metricsOrder) {
final Long value = stepMetrics.get(type);
builder.append("\t|\t");
if (value != null) {
builder.append(StringUtils.center(Long.toString(value), type.name().length()));
} else {
builder.append("-");
}
}
info(builder.toString());
}
}