當前位置: 首頁>>代碼示例>>Python>>正文


Python util.info方法代碼示例

本文整理匯總了Python中multiprocessing.util.info方法的典型用法代碼示例。如果您正苦於以下問題:Python util.info方法的具體用法?Python util.info怎麽用?Python util.info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在multiprocessing.util的用法示例。


在下文中一共展示了util.info方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: debug_info

# 需要導入模塊: from multiprocessing import util [as 別名]
# 或者: from multiprocessing.util import info [as 別名]
def debug_info(self, c):
        '''
        Return some info --- useful to spot problems with refcounting
        '''
        self.mutex.acquire()
        try:
            result = []
            keys = self.id_to_obj.keys()
            keys.sort()
            for ident in keys:
                if ident != '0':
                    result.append('  %s:       refcount=%s\n    %s' %
                                  (ident, self.id_to_refcount[ident],
                                   str(self.id_to_obj[ident][0])[:75]))
            return '\n'.join(result)
        finally:
            self.mutex.release() 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:19,代碼來源:managers.py

示例2: _run_server

# 需要導入模塊: from multiprocessing import util [as 別名]
# 或者: from multiprocessing.util import info [as 別名]
def _run_server(cls, registry, address, authkey, serializer, writer,
                    initializer=None, initargs=()):
        '''
        Create a server, report its address and run it
        '''
        if initializer is not None:
            initializer(*initargs)

        # create server
        server = cls._Server(registry, address, authkey, serializer)

        # inform parent process of the server's address
        writer.send(server.address)
        writer.close()

        # run the manager
        util.info('manager serving at %r', server.address)
        server.serve_forever() 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:20,代碼來源:managers.py

示例3: handle_request

# 需要導入模塊: from multiprocessing import util [as 別名]
# 或者: from multiprocessing.util import info [as 別名]
def handle_request(self, c):
        '''
        Handle a new connection
        '''
        funcname = result = request = None
        try:
            connection.deliver_challenge(c, self.authkey)
            connection.answer_challenge(c, self.authkey)
            request = c.recv()
            ignore, funcname, args, kwds = request
            assert funcname in self.public, '%r unrecognized' % funcname
            func = getattr(self, funcname)
        except Exception:
            msg = ('#TRACEBACK', format_exc())
        else:
            try:
                result = func(c, *args, **kwds)
            except Exception:
                msg = ('#TRACEBACK', format_exc())
            else:
                msg = ('#RETURN', result)
        try:
            c.send(msg)
        except Exception, e:
            try:
                c.send(('#TRACEBACK', format_exc()))
            except Exception:
                pass
            util.info('Failure to send message: %r', msg)
            util.info(' ... request was %r', request)
            util.info(' ... exception was %r', e) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:33,代碼來源:managers.py

示例4: shutdown

# 需要導入模塊: from multiprocessing import util [as 別名]
# 或者: from multiprocessing.util import info [as 別名]
def shutdown(self, c):
        '''
        Shutdown this process
        '''
        try:
            try:
                util.debug('manager received shutdown message')
                c.send(('#RETURN', None))

                if sys.stdout != sys.__stdout__:
                    util.debug('resetting stdout, stderr')
                    sys.stdout = sys.__stdout__
                    sys.stderr = sys.__stderr__

                util._run_finalizers(0)

                for p in active_children():
                    util.debug('terminating a child process of manager')
                    p.terminate()

                for p in active_children():
                    util.debug('terminating a child process of manager')
                    p.join()

                util._run_finalizers()
                util.info('manager exiting with exitcode 0')
            except:
                import traceback
                traceback.print_exc()
        finally:
            exit(0) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:33,代碼來源:managers.py

示例5: _debug_info

# 需要導入模塊: from multiprocessing import util [as 別名]
# 或者: from multiprocessing.util import info [as 別名]
def _debug_info(self):
        '''
        Return some info about the servers shared objects and connections
        '''
        conn = self._Client(self._address, authkey=self._authkey)
        try:
            return dispatch(conn, None, 'debug_info')
        finally:
            conn.close() 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:11,代碼來源:managers.py

示例6: _after_fork

# 需要導入模塊: from multiprocessing import util [as 別名]
# 或者: from multiprocessing.util import info [as 別名]
def _after_fork(self):
        self._manager = None
        try:
            self._incref()
        except Exception, e:
            # the proxy may just be for a manager which has shutdown
            util.info('incref failed: %s' % e) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:9,代碼來源:managers.py


注:本文中的multiprocessing.util.info方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。