def get_pplan(self, topologyName, callback=None): if callback: self.pplan_watchers[topologyName].append(callback) else: pplan_path = self.get_pplan_path(topologyName) with open(pplan_path) as f: data = f.read() pplan = PhysicalPlan() pplan.ParseFromString(data) return pplan
def watch_pplan(data, stats): if data: pplan = PhysicalPlan() pplan.ParseFromString(data) callback(pplan) 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