Java Code Examples for com.datatorrent.stram.plan.logical.LogicalPlanConfiguration#setOperatorProperties()

The following examples show how to use com.datatorrent.stram.plan.logical.LogicalPlanConfiguration#setOperatorProperties() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StreamingContainerManager.java    From Bats with Apache License 2.0 6 votes vote down vote up
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));
}
 
Example 2
Source File: StreamingContainerManager.java    From attic-apex-core with Apache License 2.0 6 votes vote down vote up
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));
}
 
Example 3
Source File: StramToNodeSetPropertyRequest.java    From Bats with Apache License 2.0 5 votes vote down vote up
@Override
public StatsListener.OperatorResponse execute(Operator operator, int operatorId, long windowId) throws IOException
{
  final Map<String, String> properties = Collections.singletonMap(propertyKey, propertyValue);
  logger.info("Setting property {} on operator {}", properties, operator);
  LogicalPlanConfiguration.setOperatorProperties(operator, properties);
  return null;
}
 
Example 4
Source File: PlanModifier.java    From Bats with Apache License 2.0 5 votes vote down vote up
/**
 * Set the property on a new operator. Since this is only intended to modify
 * previously added operators, no change to the physical plan is required.
 *
 * @param operatorName
 * @param propertyName
 * @param propertyValue
 */
public void setOperatorProperty(String operatorName, String propertyName, String propertyValue)
{
  OperatorMeta om = assertGetOperator(operatorName);
  if (physicalPlan != null) {
    for (PTOperator oper : physicalPlan.getOperators(om)) {
      if (!physicalPlan.newOpers.containsKey(oper)) {
        throw new ValidationException("Properties can only be set on new operators: " + om + " " + propertyName + " " + propertyValue);
      }
    }
  }
  Map<String, String> props = Collections.singletonMap(propertyName, propertyValue);
  LogicalPlanConfiguration.setOperatorProperties(om.getOperator(), props);
}
 
Example 5
Source File: StramToNodeSetPropertyRequest.java    From attic-apex-core with Apache License 2.0 5 votes vote down vote up
@Override
public StatsListener.OperatorResponse execute(Operator operator, int operatorId, long windowId) throws IOException
{
  final Map<String, String> properties = Collections.singletonMap(propertyKey, propertyValue);
  logger.info("Setting property {} on operator {}", properties, operator);
  LogicalPlanConfiguration.setOperatorProperties(operator, properties);
  return null;
}
 
Example 6
Source File: PlanModifier.java    From attic-apex-core with Apache License 2.0 5 votes vote down vote up
/**
 * Set the property on a new operator. Since this is only intended to modify
 * previously added operators, no change to the physical plan is required.
 *
 * @param operatorName
 * @param propertyName
 * @param propertyValue
 */
public void setOperatorProperty(String operatorName, String propertyName, String propertyValue)
{
  OperatorMeta om = assertGetOperator(operatorName);
  if (physicalPlan != null) {
    for (PTOperator oper : physicalPlan.getOperators(om)) {
      if (!physicalPlan.newOpers.containsKey(oper)) {
        throw new ValidationException("Properties can only be set on new operators: " + om + " " + propertyName + " " + propertyValue);
      }
    }
  }
  Map<String, String> props = Collections.singletonMap(propertyName, propertyValue);
  LogicalPlanConfiguration.setOperatorProperties(om.getOperator(), props);
}