Search in sources :

Example 1 with SchedulerInformationType

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);
}
Also used : Response(javax.ws.rs.core.Response) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) SchedulerInformationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SchedulerInformationType)

Example 2 with SchedulerInformationType

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;
}
Also used : NodeType(com.evolveum.midpoint.xml.ns._public.common.common_3.NodeType) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) SchedulerInformationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SchedulerInformationType)

Example 3 with SchedulerInformationType

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;
}
Also used : Task(com.evolveum.midpoint.task.api.Task) SchedulerInformationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SchedulerInformationType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Aggregations

SchedulerInformationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SchedulerInformationType)3 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 Task (com.evolveum.midpoint.task.api.Task)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 NodeType (com.evolveum.midpoint.xml.ns._public.common.common_3.NodeType)1 TaskType (com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType)1 Response (javax.ws.rs.core.Response)1