Exemple #1
0
 def get_topology(self, topologyName, callback=None):
     if callback:
         self.topology_watchers[topologyName].append(callback)
     else:
         topology_path = self.get_topology_path(topologyName)
         with open(topology_path) as f:
             data = f.read()
             topology = Topology()
             topology.ParseFromString(data)
             return topology
Exemple #2
0
    def watch_topology(data, stats):
      if data:
        topology = Topology()
        topology.ParseFromString(data)
        callback(topology)
      else:
        callback(None)

      # Returning False will result in no future watches
      # being triggered. If isWatching is True, then
      # the future watches will be triggered.
      return isWatching