Search in sources :

Example 1 with StramToNodeChangeLoggersRequest

use of com.datatorrent.stram.api.StramToNodeChangeLoggersRequest in project apex-core by apache.

the class StreamingContainerManager method setLoggersLevel.

/**
   * Send requests to change logger levels to all containers
   *
   * @param changedLoggers loggers that were changed.
   */
public void setLoggersLevel(Map<String, String> changedLoggers) {
    LOG.debug("change logger request");
    StramToNodeChangeLoggersRequest request = new StramToNodeChangeLoggersRequest();
    request.setTargetChanges(changedLoggers);
    for (StreamingContainerAgent stramChildAgent : containers.values()) {
        stramChildAgent.addOperatorRequest(request);
    }
}
Also used : StramToNodeChangeLoggersRequest(com.datatorrent.stram.api.StramToNodeChangeLoggersRequest)

Example 2 with StramToNodeChangeLoggersRequest

use of com.datatorrent.stram.api.StramToNodeChangeLoggersRequest in project apex-core by apache.

the class StreamingContainer method processNodeRequests.

private void processNodeRequests(boolean flagInvalid) {
    for (StramToNodeRequest req : nodeRequests) {
        if (req.isDeleted()) {
            continue;
        }
        if (req instanceof StramToNodeChangeLoggersRequest) {
            handleChangeLoggersRequest((StramToNodeChangeLoggersRequest) req);
            continue;
        }
        Node<?> node = nodes.get(req.getOperatorId());
        if (node == null) {
            logger.warn("Node for operator {} is not found, probably not deployed yet", req.getOperatorId());
            continue;
        }
        Thread thread = node.context.getThread();
        if (thread == null || !thread.isAlive()) {
            if (flagInvalid) {
                logger.warn("Received request with invalid operator id {} ({})", req.getOperatorId(), req);
                req.setDeleted(true);
            }
        } else {
            logger.debug("request received: {}", req);
            OperatorRequest requestExecutor = requestFactory.getRequestExecutor(nodes.get(req.operatorId), req);
            if (requestExecutor != null) {
                node.context.request(requestExecutor);
            } else {
                logger.warn("No executor identified for the request {}", req);
            }
            req.setDeleted(true);
        }
    }
}
Also used : StramToNodeChangeLoggersRequest(com.datatorrent.stram.api.StramToNodeChangeLoggersRequest) StramToNodeRequest(com.datatorrent.stram.api.StreamingContainerUmbilicalProtocol.StramToNodeRequest) OperatorRequest(com.datatorrent.api.StatsListener.OperatorRequest)

Aggregations

StramToNodeChangeLoggersRequest (com.datatorrent.stram.api.StramToNodeChangeLoggersRequest)2 OperatorRequest (com.datatorrent.api.StatsListener.OperatorRequest)1 StramToNodeRequest (com.datatorrent.stram.api.StreamingContainerUmbilicalProtocol.StramToNodeRequest)1