Ejemplo n.º 1
0
def get_topology_builder():
    builder = TopologyBuilder();        
    builder.setSpout("words", WordSpout(), 4)
    builder.setBolt("exclaim1", ExclamationBolt(), 2).shuffleGrouping("words")
    builder.setBolt("exclaim2", ExclamationBolt(), 2).shuffleGrouping("exclaim1")
    return builder
Ejemplo n.º 2
0
def get_topology_builder():
    # FIXME parallelism numbers are completely arbitrary!
    # however the parallelism is greater than 1 so we can see that proper isolation is being performed
    builder = TopologyBuilder();        
    builder.setSpout("maas-spout", MonitoringSpout(), 4)     # Read from Kafka the monitoring data. Or a file to simulate.
    builder.setSpout("scheduler-spout", SchedulerSpout(), 4) # Pull in scheduling policy
    builder.setBolt("lookup-asg-bolt", LookupASGBolt(), 2)\
           .shuffleGrouping("maas-spout")
    builder.setBolt("policy-bolt", PolicyBolt(), 4)\
           .fieldsGrouping("lookup-asg-bolt", Fields(["asg"]))\
           .fieldsGrouping("scheduler-spout", Fields(["asg"]))\
    # Write out our fake policy decisions
    builder.setBolt("log-policy", LogPolicyBolt()).globalGrouping("policy-bolt")
    return builder