use of org.opensearch.cluster.service.PendingClusterTask in project OpenSearch by opensearch-project.
the class PendingClusterTasksResponse method toXContent.
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.startArray(Fields.TASKS);
for (PendingClusterTask pendingClusterTask : this) {
builder.startObject();
builder.field(Fields.INSERT_ORDER, pendingClusterTask.getInsertOrder());
builder.field(Fields.PRIORITY, pendingClusterTask.getPriority());
builder.field(Fields.SOURCE, pendingClusterTask.getSource());
builder.field(Fields.EXECUTING, pendingClusterTask.isExecuting());
builder.field(Fields.TIME_IN_QUEUE_MILLIS, pendingClusterTask.getTimeInQueueInMillis());
builder.field(Fields.TIME_IN_QUEUE, pendingClusterTask.getTimeInQueue());
builder.endObject();
}
builder.endArray();
builder.endObject();
return builder;
}
use of org.opensearch.cluster.service.PendingClusterTask in project OpenSearch by opensearch-project.
the class RestPendingClusterTasksAction method buildTable.
private Table buildTable(RestRequest request, PendingClusterTasksResponse tasks) {
Table t = getTableWithHeader(request);
for (PendingClusterTask task : tasks) {
t.startRow();
t.addCell(task.getInsertOrder());
t.addCell(task.getTimeInQueue());
t.addCell(task.getPriority());
t.addCell(task.getSource());
t.endRow();
}
return t;
}
use of org.opensearch.cluster.service.PendingClusterTask in project OpenSearch by opensearch-project.
the class PendingClusterTasksResponse method toString.
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("tasks: (").append(pendingTasks.size()).append("):\n");
for (PendingClusterTask pendingClusterTask : this) {
sb.append(pendingClusterTask.getInsertOrder()).append("/").append(pendingClusterTask.getPriority()).append("/").append(pendingClusterTask.getSource()).append("/").append(pendingClusterTask.getTimeInQueue()).append("\n");
}
return sb.toString();
}
Aggregations