久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

        <bdo id='y6wiM'></bdo><ul id='y6wiM'></ul>
    1. <tfoot id='y6wiM'></tfoot>
    2. <small id='y6wiM'></small><noframes id='y6wiM'>

      <i id='y6wiM'><tr id='y6wiM'><dt id='y6wiM'><q id='y6wiM'><span id='y6wiM'><b id='y6wiM'><form id='y6wiM'><ins id='y6wiM'></ins><ul id='y6wiM'></ul><sub id='y6wiM'></sub></form><legend id='y6wiM'></legend><bdo id='y6wiM'><pre id='y6wiM'><center id='y6wiM'></center></pre></bdo></b><th id='y6wiM'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='y6wiM'><tfoot id='y6wiM'></tfoot><dl id='y6wiM'><fieldset id='y6wiM'></fieldset></dl></div>
      <legend id='y6wiM'><style id='y6wiM'><dir id='y6wiM'><q id='y6wiM'></q></dir></style></legend>
      1. Gevent 猴子補丁破壞多處理

        Gevent monkeypatching breaking multiprocessing(Gevent 猴子補丁破壞多處理)

          <tbody id='7lQ7C'></tbody>

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

            • <tfoot id='7lQ7C'></tfoot>

              <small id='7lQ7C'></small><noframes id='7lQ7C'>

                • <bdo id='7lQ7C'></bdo><ul id='7lQ7C'></ul>
                  本文介紹了Gevent 猴子補丁破壞多處理的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我正在嘗試使用多處理的池來運行一組進程,每個進程都將運行一個 gevent 的 greenlets 池.這樣做的原因是有很多網絡活動,但也有很多 CPU 活動,所以為了最大化我的帶寬和我所有的 CPU 內核,我需要多個進程和 gevent 的異步猴子補丁.我正在使用多處理的管理器創建一個隊列,進程將訪問該隊列以獲取要處理的數據.

                  I am attempting to use multiprocessing's pool to run a group of processes, each of which will run a gevent pool of greenlets. The reason for this is that there is a lot of network activity, but also a lot of CPU activity, so to maximise my bandwidth and all of my CPU cores, I need multiple processes AND gevent's async monkey patching. I am using multiprocessing's manager to create a queue which the processes will access to get data to process.

                  這是代碼的簡化片段:

                  import multiprocessing
                  
                  from gevent import monkey
                  monkey.patch_all(thread=False)
                  
                  manager = multiprocessing.Manager()
                  q = manager.Queue()
                  

                  這是它產生的異常:

                  Traceback (most recent call last):
                    File "multimonkeytest.py", line 7, in <module>
                      q = manager.Queue()
                    File "/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/managers.py", line 667, in temp
                      token, exp = self._create(typeid, *args, **kwds)
                    File "/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/managers.py", line 565, in _create
                      conn = self._Client(self._address, authkey=self._authkey)
                    File "/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/connection.py", line 175, in Client
                      answer_challenge(c, authkey)
                    File "/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/connection.py", line 409, in answer_challenge
                      message = connection.recv_bytes(256)         # reject large message
                   IOError: [Errno 35] Resource temporarily unavailable
                  

                  我相信這一定是由于普通 socket 模塊和 gevent 的 socket 模塊的行為之間存在一些差異.

                  I believe this must be due to some difference between the behaviour of the normal socket module and gevent's socket module.

                  如果我在子進程中進行monkeypatch,則隊列創建成功,但是當子進程嘗試從隊列中獲取()時,會發生非常相似的異常.由于在子進程中執行大量網絡請求,因此確實需要對套接字進行修補.

                  If I monkeypatch within the subprocess, The queue is created successfully, but when the subprocess tries to get() from the queue, a very similar exception occurs. The socket does need to be monkeypatched due to doing large numbers of network requests in the subprocesses.

                  我的 gevent 版本,我認為是最新的:

                  My version of gevent, which I believe is the latest:

                  >>> gevent.version_info
                  (1, 0, 0, 'alpha', 3)
                  

                  有什么想法嗎?

                  推薦答案

                  使用 monkey.patch_all(thread=False, socket=False)

                  我在類似的情況下遇到了同樣的問題,并在 patch_socket() 函數下的 gevent/monkey.py 中將其追蹤到第 115 行:_socket.socket = socket.socket.將此行注釋掉可以防止損壞.

                  I have run into the same issue in a similar situation and tracked this down to line 115 in gevent/monkey.py under the patch_socket() function: _socket.socket = socket.socket. Commenting this line out prevents the breakage.

                  這是 gevent 用它自己的替換 stdlib socket 庫的地方.multiprocessing.connection 非常廣泛地使用 socket 庫,顯然不能容忍這種變化.

                  This is where gevent replaces the stdlib socket library with its own. multiprocessing.connection uses the socket library quite extensively, and is apparently not tolerant to this change.

                  具體來說,在您導入的模塊執行 gevent.monkey.patch_all() 調用而不設置 socket=False 的任何情況下,您都會看到這一點.在我的例子中,是 grequests 做到了這一點,我必須重寫套接字模塊的補丁來修復這個錯誤.

                  Specifically, you will see this in any scenario where a module you import performs a gevent.monkey.patch_all() call without setting socket=False. In my case it was grequests that did this, and I had to override the patching of the socket module to fix this error.

                  這篇關于Gevent 猴子補丁破壞多處理的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  What exactly is Python multiprocessing Module#39;s .join() Method Doing?(Python 多處理模塊的 .join() 方法到底在做什么?)
                  Passing multiple parameters to pool.map() function in Python(在 Python 中將多個參數傳遞給 pool.map() 函數)
                  multiprocessing.pool.MaybeEncodingError: #39;TypeError(quot;cannot serialize #39;_io.BufferedReader#39; objectquot;,)#39;(multiprocessing.pool.MaybeEncodingError: TypeError(cannot serialize _io.BufferedReader object,)) - IT屋-程序員軟件開
                  Python Multiprocess Pool. How to exit the script when one of the worker process determines no more work needs to be done?(Python 多進程池.當其中一個工作進程確定不再需要完成工作時,如何退出腳本?) - IT屋-程序員
                  How do you pass a Queue reference to a function managed by pool.map_async()?(如何將隊列引用傳遞給 pool.map_async() 管理的函數?)
                  yet another confusion with multiprocessing error, #39;module#39; object has no attribute #39;f#39;(與多處理錯誤的另一個混淆,“模塊對象沒有屬性“f)

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

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

                        <tfoot id='8Utme'></tfoot>
                        • <bdo id='8Utme'></bdo><ul id='8Utme'></ul>

                            <small id='8Utme'></small><noframes id='8Utme'>

                              <tbody id='8Utme'></tbody>
                            主站蜘蛛池模板: 性一交一乱一伦视频免费观看 | 婷婷91| 国产成人99久久亚洲综合精品 | 国产激情在线 | 日韩免费网站 | 黄色大全免费看 | 国产在线观看网站 | 久久久精品日本 | 久草网址 | 91se在线| 一区二区三区在线观看视频 | 狠狠操狠狠操 | 久久久久无码国产精品一区 | 在线播放中文字幕 | 高清视频一区二区三区 | 美女黄18岁以下禁止观看 | 久久精品在线 | 久久av一区 | 狠狠草视频 | 中文字幕一区在线观看视频 | 成人一区二区三区视频 | 免费色网址 | 亚洲一区欧美一区 | 国产精品视频观看 | 亚洲国产精品视频 | 国产成人网 | 欧美激情久久久久久 | 久久久久国产精品www | 你懂的国产 | 免费观看av | 中文字幕乱码一区二区三区 | 99久久免费精品 | 91精品国产高清一区二区三区 | 午夜av一区二区 | 国产精品自产拍在线观看蜜 | 亚洲视频一区在线观看 | 成人性视频在线播放 | 亚洲一区视频在线播放 | 国产高清精品在线 | 国产毛片久久久 | 日本一区二区高清视频 |