<small id='HyD6p'></small><noframes id='HyD6p'>

    1. <i id='HyD6p'><tr id='HyD6p'><dt id='HyD6p'><q id='HyD6p'><span id='HyD6p'><b id='HyD6p'><form id='HyD6p'><ins id='HyD6p'></ins><ul id='HyD6p'></ul><sub id='HyD6p'></sub></form><legend id='HyD6p'></legend><bdo id='HyD6p'><pre id='HyD6p'><center id='HyD6p'></center></pre></bdo></b><th id='HyD6p'></th></span></q></dt></tr></i><div id='HyD6p'><tfoot id='HyD6p'></tfoot><dl id='HyD6p'><fieldset id='HyD6p'></fieldset></dl></div>

        <bdo id='HyD6p'></bdo><ul id='HyD6p'></ul>
    2. <legend id='HyD6p'><style id='HyD6p'><dir id='HyD6p'><q id='HyD6p'></q></dir></style></legend>

    3. <tfoot id='HyD6p'></tfoot>

    4. multiprocessing.Manager 嵌套共享对象不适用于队列

      multiprocessing.Manager nested shared objects doesn#39;t work with Queue(multiprocessing.Manager 嵌套共享对象不适用于队列)
        <tbody id='nrKah'></tbody>
      <tfoot id='nrKah'></tfoot>
    5. <legend id='nrKah'><style id='nrKah'><dir id='nrKah'><q id='nrKah'></q></dir></style></legend>

      1. <small id='nrKah'></small><noframes id='nrKah'>

          <i id='nrKah'><tr id='nrKah'><dt id='nrKah'><q id='nrKah'><span id='nrKah'><b id='nrKah'><form id='nrKah'><ins id='nrKah'></ins><ul id='nrKah'></ul><sub id='nrKah'></sub></form><legend id='nrKah'></legend><bdo id='nrKah'><pre id='nrKah'><center id='nrKah'></center></pre></bdo></b><th id='nrKah'></th></span></q></dt></tr></i><div id='nrKah'><tfoot id='nrKah'></tfoot><dl id='nrKah'><fieldset id='nrKah'></fieldset></dl></div>

                <bdo id='nrKah'></bdo><ul id='nrKah'></ul>

                本文介绍了multiprocessing.Manager 嵌套共享对象不适用于队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                Python docs of the multiprocessing module state:

                Changed in version 3.6: Shared objects are capable of being nested. For example, a shared container object such as a shared list can contain other shared objects which will all be managed and synchronized by the SyncManager.

                This does work with list and dict. However, if I try to create a shared Queue inside a shared dict, I get an error:

                >>> from multiprocessing import Manager
                >>> m = Manager()
                >>> d = m.dict()
                >>> d['a'] = m.list()
                >>> d['b'] = m.dict()
                >>> d['c'] = m.Queue()
                Traceback (most recent call last):
                  File "<stdin>", line 1, in <module>
                  File "<string>", line 2, in __setitem__
                  File "/usr/lib/python3.6/multiprocessing/managers.py", line 772, in _callmethod
                    raise convert_to_error(kind, result)
                multiprocessing.managers.RemoteError: 
                ---------------------------------------------------------------------------
                Traceback (most recent call last):
                  File "/usr/lib/python3.6/multiprocessing/managers.py", line 228, in serve_client
                    request = recv()
                  File "/usr/lib/python3.6/multiprocessing/connection.py", line 251, in recv
                    return _ForkingPickler.loads(buf.getbuffer())
                  File "/usr/lib/python3.6/multiprocessing/managers.py", line 881, in RebuildProxy
                    return func(token, serializer, incref=incref, **kwds)
                TypeError: AutoProxy() got an unexpected keyword argument 'manager_owned'
                ---------------------------------------------------------------------------
                

                Seems like https://hg.python.org/cpython/rev/39e7307f9aee is the changeset which introduced nested shared objects.

                解决方案

                The error is caused by AutoProxy currently not handling all BaseProxy arguments. There's a pull request which has not been merged yet. You either need to monkey-patch AutoProxy, or you look into multiprocessing.managers.py and apply the changes in the patch here directly to your source code.

                It's really important to fix both lines in the patch to prevent a memory leak in the server process. The manager_owned-flag is used to let the BaseProxy code know, when to skip a reference increment for a proxy the manager owns himself (through nesting).

                这篇关于multiprocessing.Manager 嵌套共享对象不适用于队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Adding config modes to Plotly.Py offline - modebar(将配置模式添加到 Plotly.Py 离线 - 模式栏)
                Plotly: How to style a plotly figure so that it doesn#39;t display gaps for missing dates?(Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙?)
                python save plotly plot to local file and insert into html(python将绘图保存到本地文件并插入到html中)
                Plotly: What color cycle does plotly express follow?(情节:情节表达遵循什么颜色循环?)
                How to save plotly express plot into a html or static image file?(如何将情节表达图保存到 html 或静态图像文件中?)
                Plotly: How to make a line plot from a pandas dataframe with a long or wide format?(Plotly:如何使用长格式或宽格式的 pandas 数据框制作线图?)
              • <legend id='P9AIF'><style id='P9AIF'><dir id='P9AIF'><q id='P9AIF'></q></dir></style></legend>

                • <bdo id='P9AIF'></bdo><ul id='P9AIF'></ul>

                          <tbody id='P9AIF'></tbody>

                          <i id='P9AIF'><tr id='P9AIF'><dt id='P9AIF'><q id='P9AIF'><span id='P9AIF'><b id='P9AIF'><form id='P9AIF'><ins id='P9AIF'></ins><ul id='P9AIF'></ul><sub id='P9AIF'></sub></form><legend id='P9AIF'></legend><bdo id='P9AIF'><pre id='P9AIF'><center id='P9AIF'></center></pre></bdo></b><th id='P9AIF'></th></span></q></dt></tr></i><div id='P9AIF'><tfoot id='P9AIF'></tfoot><dl id='P9AIF'><fieldset id='P9AIF'></fieldset></dl></div>

                          <small id='P9AIF'></small><noframes id='P9AIF'>

                          <tfoot id='P9AIF'></tfoot>