Search in sources :

Example 1 with StramToNodeSetPropertyRequest

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

the class StreamingContainerManager method setOperatorProperty.

private void setOperatorProperty(OperatorMeta logicalOperator, String propertyName, String propertyValue) {
    Map<String, String> properties = Collections.singletonMap(propertyName, propertyValue);
    LogicalPlanConfiguration.setOperatorProperties(logicalOperator.getOperator(), properties);
    List<PTOperator> operators = plan.getOperators(logicalOperator);
    for (PTOperator o : operators) {
        StramToNodeSetPropertyRequest request = new StramToNodeSetPropertyRequest();
        request.setOperatorId(o.getId());
        request.setPropertyKey(propertyName);
        request.setPropertyValue(propertyValue);
        addOperatorRequest(o, request);
        // re-apply to checkpointed state on deploy
        updateOnDeployRequests(o, new SetOperatorPropertyRequestFilter(propertyName), request);
    }
    // should probably not record it here because it's better to get confirmation from the operators first.
    // but right now, the operators do not give confirmation for the requests.  so record it here for now.
    recordEventAsync(new StramEvent.SetOperatorPropertyEvent(logicalOperator.getName(), propertyName, propertyValue));
}
Also used : PTOperator(com.datatorrent.stram.plan.physical.PTOperator) StramEvent(com.datatorrent.stram.api.StramEvent) StramToNodeSetPropertyRequest(com.datatorrent.stram.api.StramToNodeSetPropertyRequest)

Example 2 with StramToNodeSetPropertyRequest

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

the class StreamingContainerManager method setPhysicalOperatorProperty.

private void setPhysicalOperatorProperty(PTOperator o, String propertyName, String propertyValue) {
    String operatorName = o.getName();
    StramToNodeSetPropertyRequest request = new StramToNodeSetPropertyRequest();
    request.setOperatorId(o.getId());
    request.setPropertyKey(propertyName);
    request.setPropertyValue(propertyValue);
    addOperatorRequest(o, request);
    updateOnDeployRequests(o, new SetOperatorPropertyRequestFilter(propertyName), request);
    // should probably not record it here because it's better to get confirmation from the operators first.
    // but right now, the operators do not give confirmation for the requests. so record it here for now.
    recordEventAsync(new StramEvent.SetPhysicalOperatorPropertyEvent(operatorName, o.getId(), propertyName, propertyValue));
}
Also used : StramEvent(com.datatorrent.stram.api.StramEvent) StramToNodeSetPropertyRequest(com.datatorrent.stram.api.StramToNodeSetPropertyRequest)

Aggregations

StramEvent (com.datatorrent.stram.api.StramEvent)2 StramToNodeSetPropertyRequest (com.datatorrent.stram.api.StramToNodeSetPropertyRequest)2 PTOperator (com.datatorrent.stram.plan.physical.PTOperator)1