Пример #1
0
 def get_scheduler_location(self, topologyName, callback=None):
     if callback:
         self.scheduler_location_watchers[topologyName].append(callback)
     else:
         scheduler_location_path = self.get_scheduler_location_path(
             topologyName)
         with open(scheduler_location_path) as f:
             data = f.read()
             scheduler_location = SchedulerLocation()
             scheduler_location.ParseFromString(data)
             return scheduler_location
Пример #2
0
    def watch_scheduler_location(data, stats):
      if data:
        scheduler_location = SchedulerLocation()
        scheduler_location.ParseFromString(data)
        callback(scheduler_location)
      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