

def set_running_or_notify_cancel(self):
    'Mark the future as running or process any cancel notifications.\n\n        Should only be used by Executor implementations and unit tests.\n\n        If the future has been cancelled (cancel() was called and returned\n        True) then any threads waiting on the future completing (though calls\n        to as_completed() or wait()) are notified and False is returned.\n\n        If the future was not cancelled then it is put in the running state\n        (future calls to running() will return True) and True is returned.\n\n        This method should be called by Executor implementations before\n        executing the work associated with this future. If this method returns\n        False then the work should not be executed.\n\n        Returns:\n            False if the Future was cancelled, True otherwise.\n\n        Raises:\n            RuntimeError: if this method was already called or if set_result()\n                or set_exception() was called.\n        '
    with self._condition:
        if (waiter._state == CANCELLED):
            self._state = CANCELLED_AND_NOTIFIED
            for waiter in self._waiters:
                waiter.add_cancelled(self)
            return False
        elif (self._state == PENDING):
            self._state = RUNNING
            return True
        else:
            LOGGER.critical('Future %s in unexpected state: %s', id(self.future), self.future._state)
            raise RuntimeError('Future in unexpected state')

dataset/ETHPy150Open AppScale/appscale/AppServer/lib/concurrent/concurrent/futures/_base.py Future.set_running_or_notify_cancel/VarMisuse@21/354 `self`->`waiter`