use of com.evolveum.midpoint.xml.ns._public.common.common_3.SchedulerInformationType in project midpoint by Evolveum.
the class RestConnector method addNodeStatus.
public void addNodeStatus(ClusterStatusInformation info, NodeType nodeInfo, OperationResult result) throws SchemaException {
clusterExecutionHelper.execute(nodeInfo, (client, actualNode, result1) -> {
client.path(TaskConstants.GET_LOCAL_SCHEDULER_INFORMATION_REST_PATH);
Response response = client.get();
Response.StatusType statusInfo = response.getStatusInfo();
LOGGER.debug("Querying remote scheduler information on {} finished with status {}: {}", nodeInfo.getNodeIdentifier(), statusInfo.getStatusCode(), statusInfo.getReasonPhrase());
if (statusInfo.getFamily() == Response.Status.Family.SUCCESSFUL) {
try {
SchedulerInformationType schedulerInfo = clusterExecutionHelper.extractResult(response, SchedulerInformationType.class);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Received from {}:\n{}", nodeInfo.getNodeIdentifier(), prismContext.xmlSerializer().serializeRealValue(schedulerInfo));
}
info.addNodeAndTaskInfo(schedulerInfo);
} catch (SchemaException e) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't parse scheduler information from remote node {}", e, nodeInfo.getNodeIdentifier());
}
} else {
LOGGER.warn("Querying remote scheduler information on {} finished with status {}: {}", nodeInfo.getNodeIdentifier(), statusInfo.getStatusCode(), statusInfo.getReasonPhrase());
}
response.close();
}, null, "get scheduler information", result);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SchedulerInformationType in project midpoint by Evolveum.
the class LocalExecutionManager method getLocalSchedulerInformation.
public SchedulerInformationType getLocalSchedulerInformation(OperationResult result) {
SchedulerInformationType info = new SchedulerInformationType();
NodeType node = localNodeState.getLocalNode();
if (node != null) {
node.setSecret(null);
node.setSecretUpdateTimestamp(null);
node.setTaskExecutionLimitations(null);
}
info.setNode(node);
for (String oid : localScheduler.getLocallyRunningTasksOids(result)) {
TaskType task = new TaskType(taskManager.getPrismContext()).oid(oid);
info.getExecutingTask().add(task);
}
result.computeStatus();
return info;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SchedulerInformationType in project midpoint by Evolveum.
the class ClusterRestController method getLocalSchedulerInformation.
@GetMapping(TaskConstants.GET_LOCAL_SCHEDULER_INFORMATION_REST_PATH)
public ResponseEntity<?> getLocalSchedulerInformation() {
Task task = initRequest();
OperationResult result = createSubresult(task, OPERATION_GET_LOCAL_SCHEDULER_INFORMATION);
ResponseEntity<?> response;
try {
checkNodeAuthentication();
SchedulerInformationType schedulerInformation = taskManager.getLocalSchedulerInformation(result);
response = createResponse(HttpStatus.OK, schedulerInformation, result);
} catch (Throwable t) {
response = handleException(result, t);
}
result.computeStatus();
finishRequest(task, result);
return response;
}
Aggregations