use of com.datatorrent.stram.plan.physical.PTOperator in project apex-core by apache.
the class StreamingContainerManager method setPhysicalOperatorProperty.
/**
* Set property on a physical operator. The property change is applied asynchronously on the deployed operator.
*
* @param operatorId
* @param propertyName
* @param propertyValue
*/
public void setPhysicalOperatorProperty(int operatorId, String propertyName, String propertyValue) {
PTOperator o = this.plan.getAllOperators().get(operatorId);
if (o == null) {
return;
}
writeJournal(new SetPhysicalOperatorProperty(operatorId, propertyName, propertyValue));
setPhysicalOperatorProperty(o, propertyName, propertyValue);
}
use of com.datatorrent.stram.plan.physical.PTOperator in project apex-core by apache.
the class StreamingContainerManager method stopRecording.
public void stopRecording(int operId, String portName) {
StreamingContainerAgent sca = getContainerAgentFromOperatorId(operId);
StramToNodeRequest request = new StramToNodeRequest();
request.setOperatorId(operId);
if (!StringUtils.isBlank(portName)) {
request.setPortName(portName);
}
request.setRequestType(StramToNodeRequest.RequestType.STOP_RECORDING);
sca.addOperatorRequest(request);
PTOperator operator = plan.getAllOperators().get(operId);
if (operator != null) {
// no stop on deploy, but remove existing start
updateOnDeployRequests(operator, new RecordingRequestFilter(), null);
}
}
use of com.datatorrent.stram.plan.physical.PTOperator in project apex-core by apache.
the class StreamingContainerManager method getPhysicalOperatorProperty.
public FutureTask<Object> getPhysicalOperatorProperty(int operatorId, String propertyName, long waitTime) {
PTOperator o = this.plan.getAllOperators().get(operatorId);
StramToNodeGetPropertyRequest request = new StramToNodeGetPropertyRequest();
request.setOperatorId(operatorId);
request.setPropertyName(propertyName);
addOperatorRequest(o, request);
RequestHandler task = new RequestHandler();
task.requestId = nodeToStramRequestIds.incrementAndGet();
task.waitTime = waitTime;
request.requestId = task.requestId;
FutureTask<Object> future = new FutureTask<>(task);
dispatch(future);
return future;
}
use of com.datatorrent.stram.plan.physical.PTOperator in project apex-core by apache.
the class StreamingContainerManager method newStreamingContainerContext.
private StreamingContainerContext newStreamingContainerContext(PTContainer container) {
try {
int bufferServerMemory = 0;
Iterator<PTOperator> operatorIterator = container.getOperators().iterator();
while (operatorIterator.hasNext()) {
bufferServerMemory += operatorIterator.next().getBufferServerMemory();
}
LOG.debug("Buffer Server Memory {}", bufferServerMemory);
// the logical plan is not to be serialized via RPC, clone attributes only
StreamingContainerContext scc = new StreamingContainerContext(plan.getLogicalPlan().getAttributes().clone(), null);
scc.attributes.put(ContainerContext.IDENTIFIER, container.getExternalId());
scc.attributes.put(ContainerContext.BUFFER_SERVER_MB, bufferServerMemory);
scc.attributes.put(ContainerContext.BUFFER_SERVER_TOKEN, container.getBufferServerToken());
scc.startWindowMillis = this.vars.windowStartMillis;
return scc;
} catch (CloneNotSupportedException ex) {
throw new RuntimeException("Cannot clone DAG attributes", ex);
}
}
use of com.datatorrent.stram.plan.physical.PTOperator 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));
}
Aggregations