def _wait_to_finish(self): loop_start = time.time() while True: operation_state = rpc.get_operation_status( self.service, self._last_operation_handle) if self._op_state_is_error(operation_state): raise OperationalError("Operation is in ERROR_STATE") if not self._op_state_is_executing(operation_state): break time.sleep(self._get_sleep_interval(loop_start))
def _wait_to_finish(self): loop_start = time.time() while True: operation_state = rpc.get_operation_status(self.service, self._last_operation_handle) if operation_state == 'ERROR_STATE': raise OperationalError("Operation is in ERROR_STATE") if operation_state not in ['INITIALIZED_STATE', 'RUNNING_STATE']: break # I'm in INITIALIZED_STATE or RUNNING_STATE so hang out time.sleep(self._get_sleep_interval(loop_start))
def is_executing(self): if self._last_operation_handle is None: raise ProgrammingError("Operation state is not available") operation_state = rpc.get_operation_status( self.service, self._last_operation_handle) return self._op_state_is_executing(operation_state)