예제 #1
0
 def get_execution_state(self, topologyName, callback=None):
     if callback:
         self.execution_state_watchers[topologyName].append(callback)
     else:
         execution_state_path = self.get_execution_state_path(topologyName)
         with open(execution_state_path) as f:
             data = f.read()
             executionState = ExecutionState()
             executionState.ParseFromString(data)
             return executionState
예제 #2
0
    def watch_execution_state(data, stats):
      if data:
        executionState = ExecutionState()
        executionState.ParseFromString(data)
        callback(executionState)
      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