• <tfoot id='YSRv5'></tfoot>

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

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

      1. <legend id='YSRv5'><style id='YSRv5'><dir id='YSRv5'><q id='YSRv5'></q></dir></style></legend>

        <i id='YSRv5'><tr id='YSRv5'><dt id='YSRv5'><q id='YSRv5'><span id='YSRv5'><b id='YSRv5'><form id='YSRv5'><ins id='YSRv5'></ins><ul id='YSRv5'></ul><sub id='YSRv5'></sub></form><legend id='YSRv5'></legend><bdo id='YSRv5'><pre id='YSRv5'><center id='YSRv5'></center></pre></bdo></b><th id='YSRv5'></th></span></q></dt></tr></i><div id='YSRv5'><tfoot id='YSRv5'></tfoot><dl id='YSRv5'><fieldset id='YSRv5'></fieldset></dl></div>
      2. 多处理队列最大大小限制为 32767

        时间:2023-05-27
        <tfoot id='f0m7g'></tfoot>
      3. <small id='f0m7g'></small><noframes id='f0m7g'>

          <tbody id='f0m7g'></tbody>
          <bdo id='f0m7g'></bdo><ul id='f0m7g'></ul>

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

                  本文介绍了多处理队列最大大小限制为 32767的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在尝试使用多处理编写 Python 2.6 (OSX) 程序,并且我想用超过默认的 32767 个项目来填充队列.

                  I'm trying to write a Python 2.6 (OSX) program using multiprocessing, and I want to populate a Queue with more than the default of 32767 items.

                  from multiprocessing import Queue
                  Queue(2**15) # raises OSError
                  

                  Queue(32767) 工作正常,但任何更大的数字(例如 Queue(32768))都会失败,并出现 OSError: [Errno 22] Invalid argument

                  Queue(32767) works fine, but any higher number (e.g. Queue(32768)) fails with OSError: [Errno 22] Invalid argument

                  这个问题有解决办法吗?

                  Is there a workaround for this issue?

                  推荐答案

                  一种方法是使用自定义类包装您的 multiprocessing.Queue(仅在生产者端,或从消费者透明看法).使用它,您可以将要分派到您正在包装的 Queue 对象的项目排队,并且仅将本地队列(Python list() 对象)中的内容提供给multiprocess.Queue 随着空间变得可用,当 Queue 已满时进行异常处理以节流.

                  One approach would be to wrap your multiprocessing.Queue with a custom class (just on the producer side, or transparently from the consumer perspective). Using that you would queue up items to be dispatched to the Queue object that you're wrapping, and only feed things from the local queue (Python list() object) into the multiprocess.Queue as space becomes available, with exception handling to throttle when the Queue is full.

                  这可能是最简单的方法,因为它对您的其余代码的影响应该最小.自定义类的行为应该像队列一样,同时将底层的 multiprocessing.Queue 隐藏在您的抽象后面.

                  That's probably the easiest approach since it should have the minimum impact on the rest of your code. The custom class should behave just like a Queue while hiding the underlying multiprocessing.Queue behind your abstraction.

                  (一种方法可能是让您的生产者使用线程,一个线程来管理从线程 Queue 到您的 multiprocessing.Queue 和任何其他线程实际上只是喂入线程Queue).

                  (One approach might be to have your producer use threads, one thread to manage the dispatch from a threading Queue to your multiprocessing.Queue and any other threads actually just feeding the threading Queue).

                  这篇关于多处理队列最大大小限制为 32767的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  <legend id='p3tQb'><style id='p3tQb'><dir id='p3tQb'><q id='p3tQb'></q></dir></style></legend>

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

                        <tfoot id='p3tQb'></tfoot>

                          <bdo id='p3tQb'></bdo><ul id='p3tQb'></ul>
                            <tbody id='p3tQb'></tbody>