zeronimo/core.py
def work(self, socket, call, args, kwargs, topics=()):
        """Calls a function and send results to the collector.  It supports
        all of function actions.  A function could return, yield, raise any
        packable objects.
        """
        task_id = uuid4_bytes()
        reply_socket, topics = self.replier(socket, topics, call.reply_to)
        if reply_socket:
            channel = (call.call_id, task_id, topics)
        else:
            channel = (None, None, None)
        f, rpc_spec = self.find_call_target(call)
        if rpc_spec.reject_if.__get__(self.app)(call, topics):
            reply_socket and self.reject(reply_socket, call.call_id, topics)
            return
        reply_socket and self.accept(reply_socket, channel)
        success = False
        with self.catch_exceptions():
            try:
                val = self.call(call, args, kwargs, f, rpc_spec)
            except:
                exc_info = sys.exc_info()
                self.raise_(reply_socket, channel, exc_info)
                reraise(*exc_info)
            success = True
        if not success:
            # catch_exceptions() hides exceptions.
            return
        if isinstance(val, Iterator):
            vals = val
            with self.catch_exceptions():
                try:
                    try:
                        val = next(vals)
                    except StopIteration:
                        pass
                    else:
                        self.send_reply(reply_socket, YIELD, val, *channel)
                        for val in vals:
                            self.send_reply(reply_socket, YIELD, val, *channel)
                    self.send_reply(reply_socket, BREAK, None, *channel)
                except:
                    exc_info = sys.exc_info()
                    self.raise_(reply_socket, channel, exc_info)
                    reraise(*exc_info)
        else:
            self.send_reply(reply_socket, RETURN, val, *channel)
def work(self, socket, call, args, kwargs, topics=()):
        task_id = uuid4_bytes()
        reply_socket, topics = self.replier(socket, topics, call.reply_to)
        if reply_socket:
            channel = (call.call_id, task_id, topics)
        else:
            channel = (None, None, None)
        f, rpc_spec = self.find_call_target(call)
        if rpc_spec.reject_if.__get__(self.app)(call, topics):
            reply_socket and self.reject(reply_socket, call.call_id, topics)
            return
        reply_socket and self.accept(reply_socket, channel)
        success = False
        with self.catch_exceptions():
            try:
                val = self.call(call, args, kwargs, f, rpc_spec)
            except:
                exc_info = sys.exc_info()
                self.raise_(reply_socket, channel, exc_info)
                reraise(*exc_info)
            success = True
        if not success:
            # catch_exceptions() hides exceptions.
            return
        if isinstance(val, Iterator):
            vals = val
            with self.catch_exceptions():
                try:
                    try:
                        val = next(vals)
                    except StopIteration:
                        pass
                    else:
                        self.send_reply(reply_socket, YIELD, val, *channel)
                        for val in vals:
                            self.send_reply(reply_socket, YIELD, val, *channel)
                    self.send_reply(reply_socket, BREAK, None, *channel)
                except:
                    exc_info = sys.exc_info()
                    self.raise_(reply_socket, channel, exc_info)
                    reraise(*exc_info)
        else:
            self.send_reply(reply_socket, RETURN, val, *channel)
def work ( self , socket , call , args , kwargs , topics = ( ) ) : task_id = uuid4_bytes ( ) reply_socket , topics = self . replier ( socket , topics , call . reply_to ) if reply_socket : channel = ( call . call_id , task_id , topics ) else : channel = ( None , None , None ) f , rpc_spec = self . find_call_target ( call ) if rpc_spec . reject_if . __get__ ( self . app ) ( call , topics ) : reply_socket and self . reject ( reply_socket , call . call_id , topics ) return reply_socket and self . accept ( reply_socket , channel ) success = False with self . catch_exceptions ( ) : try : val = self . call ( call , args , kwargs , f , rpc_spec ) except : exc_info = sys . exc_info ( ) self . raise_ ( reply_socket , channel , exc_info ) reraise ( * exc_info ) success = True if not success : # catch_exceptions() hides exceptions. return if isinstance ( val , Iterator ) : vals = val with self . catch_exceptions ( ) : try : try : val = next ( vals ) except StopIteration : pass else : self . send_reply ( reply_socket , YIELD , val , * channel ) for val in vals : self . send_reply ( reply_socket , YIELD , val , * channel ) self . send_reply ( reply_socket , BREAK , None , * channel ) except : exc_info = sys . exc_info ( ) self . raise_ ( reply_socket , channel , exc_info ) reraise ( * exc_info ) else : self . send_reply ( reply_socket , RETURN , val , * channel )
Calls a function and send results to the collector.  It supports
        all of function actions.  A function could return, yield, raise any
        packable objects.
Calls a function and send results to the collector . It supports all of function actions . A function could return yield raise any packable objects .