async def execute(self, raise_on_error=True):
        "Execute all the commands in the current pipeline"
        stack = self.command_stack
        if not stack:
            return []
        if self.scripts:
            await self.load_scripts()
        if self.transaction or self.explicit_transaction:
            exec = self._execute_transaction
        else:
            exec = self._execute_pipeline

        conn = self.connection
        if not conn:
            conn = self.connection_pool.get_connection()
            # assign to self.connection so reset() releases the connection
            # back to the pool after we're done
            self.connection = conn

        try:
            return await exec(conn, stack, raise_on_error)
        except (ConnectionError, TimeoutError) as e:
            conn.disconnect()
            if not conn.retry_on_timeout and isinstance(e, TimeoutError):
                raise
            # if we were watching a variable, the watch is no longer valid
            # since this connection has died. raise a WatchError, which
            # indicates the user should retry his transaction. If this is more
            # than a temporary failure, the WATCH that the user next issues
            # will fail, propegating the real ConnectionError
            if self.watching:
                raise WatchError("A ConnectionError occured on while watching "
                                 "one or more keys")
            # otherwise, it's safe to retry since the transaction isn't
            # predicated on any state
            return await exec(conn, stack, raise_on_error)
        finally:
            await self.reset()
async def execute ( self , raise_on_error = True ) : stack = self . command_stack if not stack : return [ ] if self . scripts : await self . load_scripts ( ) if self . transaction or self . explicit_transaction : exec = self . _execute_transaction else : exec = self . _execute_pipeline conn = self . connection if not conn : conn = self . connection_pool . get_connection ( ) self . connection = conn try : return await exec ( conn , stack , raise_on_error ) except ( ConnectionError , TimeoutError ) as e : conn . disconnect ( ) if not conn . retry_on_timeout and isinstance ( e , TimeoutError ) : raise if self . watching : raise WatchError ( "A ConnectionError occured on while watching " "one or more keys" ) return await exec ( conn , stack , raise_on_error ) finally : await self . reset ( )
Execute all the commands in the current pipeline