com.datatorrent.stram.plan.logical.LogicalPlan.OperatorMeta Java Examples
The following examples show how to use
com.datatorrent.stram.plan.logical.LogicalPlan.OperatorMeta.
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: StreamMapping.java From attic-apex-core with Apache License 2.0 | 6 votes |
private void addSlidingUnifiers() { OperatorMeta sourceOM = streamMeta.getSource().getOperatorMeta(); if (sourceOM.getAttributes().contains(Context.OperatorContext.SLIDE_BY_WINDOW_COUNT)) { if (sourceOM.getValue(Context.OperatorContext.SLIDE_BY_WINDOW_COUNT) < sourceOM.getValue(Context.OperatorContext.APPLICATION_WINDOW_COUNT)) { plan.undeployOpers.addAll(slidingUnifiers); slidingUnifiers.clear(); List<PTOutput> newUpstream = Lists.newArrayList(); PTOperator slidingUnifier; for (PTOutput source : upstream) { slidingUnifier = StreamMapping.createSlidingUnifier(streamMeta, plan, sourceOM.getValue(Context.OperatorContext.APPLICATION_WINDOW_COUNT), sourceOM.getValue(Context.OperatorContext.SLIDE_BY_WINDOW_COUNT)); addInput(slidingUnifier, source, null); this.slidingUnifiers.add(slidingUnifier); newUpstream.add(slidingUnifier.outputs.get(0)); } upstream.clear(); upstream.addAll(newUpstream); } else { LOG.warn("Sliding Window Count {} should be less than APPLICATION WINDOW COUNT {}", sourceOM.getValue(Context.OperatorContext.SLIDE_BY_WINDOW_COUNT), sourceOM.getValue(Context.OperatorContext.APPLICATION_WINDOW_COUNT)); } } }
Example #2
Source File: StreamMapping.java From Bats with Apache License 2.0 | 6 votes |
private void addSlidingUnifiers() { OperatorMeta sourceOM = streamMeta.getSource().getOperatorMeta(); if (sourceOM.getAttributes().contains(Context.OperatorContext.SLIDE_BY_WINDOW_COUNT)) { if (sourceOM.getValue(Context.OperatorContext.SLIDE_BY_WINDOW_COUNT) < sourceOM.getValue(Context.OperatorContext.APPLICATION_WINDOW_COUNT)) { plan.undeployOpers.addAll(slidingUnifiers); slidingUnifiers.clear(); List<PTOutput> newUpstream = Lists.newArrayList(); PTOperator slidingUnifier; for (PTOutput source : upstream) { slidingUnifier = StreamMapping.createSlidingUnifier(streamMeta, plan, sourceOM.getValue(Context.OperatorContext.APPLICATION_WINDOW_COUNT), sourceOM.getValue(Context.OperatorContext.SLIDE_BY_WINDOW_COUNT)); addInput(slidingUnifier, source, null); this.slidingUnifiers.add(slidingUnifier); newUpstream.add(slidingUnifier.outputs.get(0)); } upstream.clear(); upstream.addAll(newUpstream); } else { LOG.warn("Sliding Window Count {} should be less than APPLICATION WINDOW COUNT {}", sourceOM.getValue(Context.OperatorContext.SLIDE_BY_WINDOW_COUNT), sourceOM.getValue(Context.OperatorContext.APPLICATION_WINDOW_COUNT)); } } }
Example #3
Source File: PhysicalPlan.java From attic-apex-core with Apache License 2.0 | 6 votes |
private Set<PTOperator> getDependentPersistOperators(Collection<PTOperator> operators) { Set<PTOperator> persistOperators = new LinkedHashSet<>(); if (operators != null) { for (PTOperator operator : operators) { for (PTInput in : operator.inputs) { if (in.logicalStream.getPersistOperator() != null) { for (InputPortMeta inputPort : in.logicalStream.getSinksToPersist()) { if (inputPort.getOperatorMeta().equals(operator.operatorMeta)) { // Redeploy the stream wide persist operator only if the current sink is being persisted persistOperators.addAll(getOperators(in.logicalStream.getPersistOperator())); break; } } } for (Map.Entry<InputPortMeta, OperatorMeta> entry : in.logicalStream.sinkSpecificPersistOperatorMap.entrySet()) { // Redeploy sink specific persist operators persistOperators.addAll(getOperators(entry.getValue())); } } } } return persistOperators; }
Example #4
Source File: LogicalPlanSerializer.java From attic-apex-core with Apache License 2.0 | 6 votes |
/** * Return information about operators and inner modules of a module. * * @param dag top level DAG * @param moduleMeta module information. DAG within module is used for constructing response. * @return */ private static Map<String, Object> getLogicalModuleDetails(LogicalPlan dag, LogicalPlan.ModuleMeta moduleMeta) { Map<String, Object> moduleDetailMap = new HashMap<>(); ArrayList<String> operatorArray = new ArrayList<>(); moduleDetailMap.put("name", moduleMeta.getName()); moduleDetailMap.put("className", moduleMeta.getGenericOperator().getClass().getName()); moduleDetailMap.put("operators", operatorArray); for (OperatorMeta operatorMeta : moduleMeta.getDag().getAllOperators()) { if (operatorMeta.getModuleName() == null) { String fullName = moduleMeta.getFullName() + LogicalPlan.MODULE_NAMESPACE_SEPARATOR + operatorMeta.getName(); operatorArray.add(fullName); } } ArrayList<Map<String, Object>> modulesArray = new ArrayList<>(); moduleDetailMap.put("modules", modulesArray); for (LogicalPlan.ModuleMeta meta : moduleMeta.getDag().getAllModules()) { modulesArray.add(getLogicalModuleDetails(dag, meta)); } return moduleDetailMap; }
Example #5
Source File: LogicalPlanSerializer.java From Bats with Apache License 2.0 | 6 votes |
/** * Return information about operators and inner modules of a module. * * @param dag top level DAG * @param moduleMeta module information. DAG within module is used for constructing response. * @return */ private static Map<String, Object> getLogicalModuleDetails(LogicalPlan dag, LogicalPlan.ModuleMeta moduleMeta) { Map<String, Object> moduleDetailMap = new HashMap<>(); ArrayList<String> operatorArray = new ArrayList<>(); moduleDetailMap.put("name", moduleMeta.getName()); moduleDetailMap.put("className", moduleMeta.getGenericOperator().getClass().getName()); moduleDetailMap.put("operators", operatorArray); for (OperatorMeta operatorMeta : moduleMeta.getDag().getAllOperators()) { if (operatorMeta.getModuleName() == null) { String fullName = moduleMeta.getFullName() + LogicalPlan.MODULE_NAMESPACE_SEPARATOR + operatorMeta.getName(); operatorArray.add(fullName); } } ArrayList<Map<String, Object>> modulesArray = new ArrayList<>(); moduleDetailMap.put("modules", modulesArray); for (LogicalPlan.ModuleMeta meta : moduleMeta.getDag().getAllModules()) { modulesArray.add(getLogicalModuleDetails(dag, meta)); } return moduleDetailMap; }
Example #6
Source File: StreamMapping.java From attic-apex-core with Apache License 2.0 | 6 votes |
public static PTOperator createSlidingUnifier(StreamMeta streamMeta, PhysicalPlan plan, int operatorApplicationWindowCount, int slidingWindowCount) { int gcd = IntMath.gcd(operatorApplicationWindowCount, slidingWindowCount); OperatorMeta um = streamMeta.getSource() .getSlidingUnifier(operatorApplicationWindowCount / gcd, gcd, slidingWindowCount / gcd); PTOperator pu = plan.newOperator(um, um.getName()); Operator unifier = um.getOperator(); PortMappingDescriptor mergeDesc = new PortMappingDescriptor(); Operators.describe(unifier, mergeDesc); if (mergeDesc.outputPorts.size() != 1) { throw new AssertionError("Unifier must have a single output port, instead found : " + mergeDesc.outputPorts); } pu.unifiedOperatorMeta = streamMeta.getSource().getOperatorMeta(); pu.outputs.add(new PTOutput(mergeDesc.outputPorts.keySet().iterator().next(), streamMeta, pu)); plan.newOpers.put(pu, unifier); return pu; }
Example #7
Source File: StreamingContainerManager.java From attic-apex-core with Apache License 2.0 | 6 votes |
@Override public void read(final Object object, final Input in) throws KryoException { final StreamingContainerManager scm = (StreamingContainerManager)object; final String operatorName = in.readString(); final String propertyName = in.readString(); final String propertyValue = in.readString(); final OperatorMeta logicalOperator = scm.plan.getLogicalPlan().getOperatorMeta(operatorName); if (logicalOperator == null) { throw new IllegalArgumentException("Unknown operator " + operatorName); } scm.setOperatorProperty(logicalOperator, propertyName, propertyValue); }
Example #8
Source File: StramWebServices.java From attic-apex-core with Apache License 2.0 | 6 votes |
@GET @Path(PATH_LOGICAL_PLAN_OPERATORS + "/{operatorName}/attributes") @Produces(MediaType.APPLICATION_JSON) public JSONObject getOperatorAttributes(@PathParam("operatorName") String operatorName, @QueryParam("attributeName") String attributeName) { init(); OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName); if (logicalOperator == null) { throw new NotFoundException(); } HashMap<String, String> map = new HashMap<>(); for (Map.Entry<Attribute<?>, Object> entry : dagManager.getOperatorAttributes(operatorName).entrySet()) { if (attributeName == null || entry.getKey().getSimpleName().equals(attributeName)) { Map.Entry<Attribute<Object>, Object> entry1 = (Map.Entry<Attribute<Object>, Object>)(Map.Entry)entry; map.put(entry1.getKey().getSimpleName(), entry1.getKey().codec.toString(entry1.getValue())); } } return new JSONObject(map); }
Example #9
Source File: LogicalPlanTest.java From attic-apex-core with Apache License 2.0 | 6 votes |
@Test public void testCycleDetectionWithDelay() { TestGeneratorInputOperator opA = dag.addOperator("A", TestGeneratorInputOperator.class); GenericTestOperator opB = dag.addOperator("B", GenericTestOperator.class); GenericTestOperator opC = dag.addOperator("C", GenericTestOperator.class); GenericTestOperator opD = dag.addOperator("D", GenericTestOperator.class); DefaultDelayOperator<Object> opDelay = dag.addOperator("opDelay", new DefaultDelayOperator<>()); DefaultDelayOperator<Object> opDelay2 = dag.addOperator("opDelay2", new DefaultDelayOperator<>()); dag.addStream("AtoB", opA.outport, opB.inport1); dag.addStream("BtoC", opB.outport1, opC.inport1); dag.addStream("CtoD", opC.outport1, opD.inport1); dag.addStream("CtoDelay", opC.outport2, opDelay.input); dag.addStream("DtoDelay", opD.outport1, opDelay2.input); dag.addStream("DelayToB", opDelay.output, opB.inport2); dag.addStream("Delay2ToC", opDelay2.output, opC.inport2); LogicalPlan.ValidationContext vc = new LogicalPlan.ValidationContext(); dag.findStronglyConnected(dag.getMeta(opA), vc); Assert.assertEquals("No invalid cycle", Collections.emptyList(), vc.invalidCycles); Set<OperatorMeta> exp = Sets.newHashSet(dag.getMeta(opDelay2), dag.getMeta(opDelay), dag.getMeta(opC), dag.getMeta(opB), dag.getMeta(opD)); Assert.assertEquals("cycle", exp, vc.stronglyConnected.get(0)); }
Example #10
Source File: StreamMapping.java From Bats with Apache License 2.0 | 6 votes |
public static PTOperator createSlidingUnifier(StreamMeta streamMeta, PhysicalPlan plan, int operatorApplicationWindowCount, int slidingWindowCount) { int gcd = IntMath.gcd(operatorApplicationWindowCount, slidingWindowCount); OperatorMeta um = streamMeta.getSource() .getSlidingUnifier(operatorApplicationWindowCount / gcd, gcd, slidingWindowCount / gcd); PTOperator pu = plan.newOperator(um, um.getName()); Operator unifier = um.getOperator(); PortMappingDescriptor mergeDesc = new PortMappingDescriptor(); Operators.describe(unifier, mergeDesc); if (mergeDesc.outputPorts.size() != 1) { throw new AssertionError("Unifier must have a single output port, instead found : " + mergeDesc.outputPorts); } pu.unifiedOperatorMeta = streamMeta.getSource().getOperatorMeta(); pu.outputs.add(new PTOutput(mergeDesc.outputPorts.keySet().iterator().next(), streamMeta, pu)); plan.newOpers.put(pu, unifier); return pu; }
Example #11
Source File: StreamingContainerManagerTest.java From attic-apex-core with Apache License 2.0 | 6 votes |
@Test public void testValidGenericOperatorDeployInfoType() { GenericTestOperator o1 = dag.addOperator("o1", GenericTestOperator.class); TestGeneratorInputOperator.ValidGenericOperator o2 = dag.addOperator("o2", TestGeneratorInputOperator.ValidGenericOperator.class); dag.addStream("stream1", o1.outport1, o2.input); dag.setAttribute(OperatorContext.STORAGE_AGENT, new MemoryStorageAgent()); StreamingContainerManager scm = new StreamingContainerManager(dag); PhysicalPlan physicalPlan = scm.getPhysicalPlan(); List<PTContainer> containers = physicalPlan.getContainers(); for (int i = 0; i < containers.size(); ++i) { assignContainer(scm, "container" + (i + 1)); } OperatorMeta o2Meta = dag.getMeta(o2); PTOperator o2Physical = physicalPlan.getOperators(o2Meta).get(0); String containerId = o2Physical.getContainer().getExternalId(); OperatorDeployInfo o1DeployInfo = getDeployInfo(scm.getContainerAgent(containerId)).get(0); Assert.assertEquals("type " + o1DeployInfo, OperatorDeployInfo.OperatorType.GENERIC, o1DeployInfo.type); }
Example #12
Source File: StramWebServices.java From attic-apex-core with Apache License 2.0 | 6 votes |
@GET @Path(PATH_LOGICAL_PLAN_OPERATORS + "/{operatorName}/ports/{portName}/attributes") @Produces(MediaType.APPLICATION_JSON) public JSONObject getPortAttributes(@PathParam("operatorName") String operatorName, @PathParam("portName") String portName, @QueryParam("attributeName") String attributeName) { init(); OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName); if (logicalOperator == null) { throw new NotFoundException(); } HashMap<String, String> map = new HashMap<>(); for (Map.Entry<Attribute<?>, Object> entry : dagManager.getPortAttributes(operatorName, portName).entrySet()) { if (attributeName == null || entry.getKey().getSimpleName().equals(attributeName)) { Map.Entry<Attribute<Object>, Object> entry1 = (Map.Entry<Attribute<Object>, Object>)(Map.Entry)entry; map.put(entry1.getKey().getSimpleName(), entry1.getKey().codec.toString(entry1.getValue())); } } return new JSONObject(map); }
Example #13
Source File: LogicalPlanModificationTest.java From attic-apex-core with Apache License 2.0 | 6 votes |
@Test public void testSetOperatorProperty() { GenericTestOperator o1 = dag.addOperator("o1", GenericTestOperator.class); OperatorMeta o1Meta = dag.getMeta(o1); TestPlanContext ctx = new TestPlanContext(); dag.setAttribute(OperatorContext.STORAGE_AGENT, ctx); PhysicalPlan plan = new PhysicalPlan(dag, ctx); ctx.deploy.clear(); ctx.undeploy.clear(); PlanModifier pm = new PlanModifier(plan); try { pm.setOperatorProperty(o1Meta.getName(), "myStringProperty", "propertyValue"); Assert.fail("validation error exepected"); } catch (javax.validation.ValidationException e) { Assert.assertTrue(e.getMessage().contains(o1Meta.toString())); } GenericTestOperator newOperator = new GenericTestOperator(); pm.addOperator("newOperator", newOperator); pm.setOperatorProperty("newOperator", "myStringProperty", "propertyValue"); Assert.assertEquals("", "propertyValue", newOperator.getMyStringProperty()); }
Example #14
Source File: StramWebServices.java From Bats with Apache License 2.0 | 6 votes |
@GET @Path(PATH_LOGICAL_PLAN_OPERATORS + "/{operatorName}/ports/{portName}/attributes") @Produces(MediaType.APPLICATION_JSON) public JSONObject getPortAttributes(@PathParam("operatorName") String operatorName, @PathParam("portName") String portName, @QueryParam("attributeName") String attributeName) { init(); OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName); if (logicalOperator == null) { throw new NotFoundException(); } HashMap<String, String> map = new HashMap<>(); for (Map.Entry<Attribute<?>, Object> entry : dagManager.getPortAttributes(operatorName, portName).entrySet()) { if (attributeName == null || entry.getKey().getSimpleName().equals(attributeName)) { Map.Entry<Attribute<Object>, Object> entry1 = (Map.Entry<Attribute<Object>, Object>)(Map.Entry)entry; map.put(entry1.getKey().getSimpleName(), entry1.getKey().codec.toString(entry1.getValue())); } } return new JSONObject(map); }
Example #15
Source File: StramWebServices.java From attic-apex-core with Apache License 2.0 | 6 votes |
@GET @Path(PATH_LOGICAL_PLAN_OPERATORS + "/{operatorName}/properties") @Produces(MediaType.APPLICATION_JSON) public JSONObject getOperatorProperties(@PathParam("operatorName") String operatorName, @QueryParam("propertyName") String propertyName) throws IOException, JSONException { init(); OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName); BeanMap operatorProperties = null; if (logicalOperator == null) { ModuleMeta logicalModule = dagManager.getModuleMeta(operatorName); if (logicalModule == null) { throw new NotFoundException(); } operatorProperties = LogicalPlanConfiguration.getObjectProperties(logicalModule.getOperator()); } else { operatorProperties = LogicalPlanConfiguration.getObjectProperties(logicalOperator.getOperator()); } Map<String, Object> m = getPropertiesAsMap(propertyName, operatorProperties); return new JSONObject(objectMapper.writeValueAsString(m)); }
Example #16
Source File: StramWebServices.java From Bats with Apache License 2.0 | 6 votes |
@GET @Path(PATH_LOGICAL_PLAN_OPERATORS + "/{operatorName}/ports") @Produces(MediaType.APPLICATION_JSON) public JSONObject getPorts(@PathParam("operatorName") String operatorName) { init(); OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName); Set<LogicalPlan.InputPortMeta> inputPorts; Set<LogicalPlan.OutputPortMeta> outputPorts; if (logicalOperator == null) { ModuleMeta logicalModule = dagManager.getModuleMeta(operatorName); if (logicalModule == null) { throw new NotFoundException(); } inputPorts = logicalModule.getInputStreams().keySet(); outputPorts = logicalModule.getOutputStreams().keySet(); } else { inputPorts = logicalOperator.getInputStreams().keySet(); outputPorts = logicalOperator.getOutputStreams().keySet(); } JSONObject result = getPortsObjects(inputPorts, outputPorts); return result; }
Example #17
Source File: StreamingContainerManager.java From attic-apex-core with Apache License 2.0 | 6 votes |
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 #18
Source File: PlanModifier.java From Bats with Apache License 2.0 | 5 votes |
/** * 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 #19
Source File: PhysicalPlan.java From Bats with Apache License 2.0 | 5 votes |
public List<PTOperator> getLeafOperators() { List<PTOperator> operators = new ArrayList<>(); for (OperatorMeta opMeta : dag.getLeafOperators()) { operators.addAll(getAllOperators(opMeta)); } return operators; }
Example #20
Source File: PlanModifier.java From attic-apex-core with Apache License 2.0 | 5 votes |
private InputPort<?> getInputPort(String operName, String portName) { OperatorMeta om = assertGetOperator(operName); Operators.PortMappingDescriptor portMap = new Operators.PortMappingDescriptor(); Operators.describe(om.getOperator(), portMap); PortContextPair<InputPort<?>> port = portMap.inputPorts.get(portName); if (port == null) { throw new AssertionError(String.format("Invalid port %s (%s)", portName, om)); } return port.component; }
Example #21
Source File: StramLocalCluster.java From attic-apex-core with Apache License 2.0 | 5 votes |
public PTOperator findByLogicalNode(OperatorMeta logicalNode) { List<PTOperator> nodes = dnmgr.getPhysicalPlan().getOperators(logicalNode); if (nodes.isEmpty()) { return null; } return nodes.get(0); }
Example #22
Source File: PlanModifier.java From attic-apex-core with Apache License 2.0 | 5 votes |
/** * 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 #23
Source File: StramWebServices.java From attic-apex-core with Apache License 2.0 | 5 votes |
@GET @Path(PATH_LOGICAL_PLAN_OPERATORS + "/{operatorName}") @Produces(MediaType.APPLICATION_JSON) public JSONObject getLogicalOperator(@PathParam("operatorName") String operatorName) throws Exception { init(); OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName); if (logicalOperator == null) { throw new NotFoundException(); } LogicalOperatorInfo logicalOperatorInfo = dagManager.getLogicalOperatorInfo(operatorName); return new JSONObject(objectMapper.writeValueAsString(logicalOperatorInfo)); }
Example #24
Source File: PlanModifier.java From Bats with Apache License 2.0 | 5 votes |
private OperatorMeta assertGetOperator(String operName) { OperatorMeta om = logicalPlan.getOperatorMeta(operName); if (om == null) { throw new AssertionError("Invalid operator name " + operName); } return om; }
Example #25
Source File: StreamingContainerManager.java From attic-apex-core with Apache License 2.0 | 5 votes |
public List<LogicalOperatorInfo> getLogicalOperatorInfoList() { List<LogicalOperatorInfo> infoList = new ArrayList<>(); Collection<OperatorMeta> allOperators = getLogicalPlan().getAllOperators(); for (OperatorMeta operatorMeta : allOperators) { infoList.add(fillLogicalOperatorInfo(operatorMeta)); } return infoList; }
Example #26
Source File: PhysicalPlan.java From Bats with Apache License 2.0 | 5 votes |
@VisibleForTesting public List<PTOperator> getMergeOperators(OperatorMeta logicalOperator) { List<PTOperator> opers = Lists.newArrayList(); for (StreamMapping ug : this.logicalToPTOperator.get(logicalOperator).outputStreams.values()) { ug.addTo(opers); } return opers; }
Example #27
Source File: StreamingContainerManager.java From attic-apex-core with Apache License 2.0 | 5 votes |
public OperatorAggregationInfo getOperatorAggregationInfo(String operatorName) { OperatorMeta operatorMeta = getLogicalPlan().getOperatorMeta(operatorName); if (operatorMeta == null) { return null; } return fillOperatorAggregationInfo(operatorMeta); }
Example #28
Source File: PlanModifier.java From Bats with Apache License 2.0 | 5 votes |
private InputPort<?> getInputPort(String operName, String portName) { OperatorMeta om = assertGetOperator(operName); Operators.PortMappingDescriptor portMap = new Operators.PortMappingDescriptor(); Operators.describe(om.getOperator(), portMap); PortContextPair<InputPort<?>> port = portMap.inputPorts.get(portName); if (port == null) { throw new AssertionError(String.format("Invalid port %s (%s)", portName, om)); } return port.component; }
Example #29
Source File: StreamingContainerManager.java From attic-apex-core with Apache License 2.0 | 5 votes |
private OperatorAggregationInfo fillOperatorAggregationInfo(OperatorMeta operator) { OperatorAggregationInfo oai = new OperatorAggregationInfo(); Collection<PTOperator> physicalOperators = getPhysicalPlan().getAllOperators(operator); if (physicalOperators.isEmpty()) { return null; } oai.name = operator.getName(); for (PTOperator physicalOperator : physicalOperators) { if (!physicalOperator.isUnifier()) { OperatorStatus os = physicalOperator.stats; oai.latencyMA.addNumber(os.latencyMA.getAvg()); oai.cpuPercentageMA.addNumber(os.cpuNanosPMSMA.getAvg() / 10000); oai.tuplesEmittedPSMA.addNumber(os.tuplesEmittedPSMA.get()); oai.tuplesProcessedPSMA.addNumber(os.tuplesProcessedPSMA.get()); oai.currentWindowId.addNumber(os.currentWindowId.get()); oai.recoveryWindowId.addNumber(toWsWindowId(physicalOperator.getRecoveryCheckpoint().windowId)); if (os.lastHeartbeat != null) { oai.lastHeartbeat.addNumber(os.lastHeartbeat.getGeneratedTms()); } oai.checkpointTime.addNumber(os.checkpointTimeMA.getAvg()); } } return oai; }
Example #30
Source File: StreamingContainerManager.java From attic-apex-core with Apache License 2.0 | 5 votes |
public void setOperatorProperty(String operatorName, String propertyName, String propertyValue) { OperatorMeta logicalOperator = plan.getLogicalPlan().getOperatorMeta(operatorName); if (logicalOperator == null) { throw new IllegalArgumentException("Unknown operator " + operatorName); } writeJournal(new SetOperatorProperty(operatorName, propertyName, propertyValue)); setOperatorProperty(logicalOperator, propertyName, propertyValue); }