它可以安全地修补一个由纯用标准lib 写成的模块。
- there are few pure mysql adapters:
- PyMysql has a sqlalchemy test suite, you could run the test for your cases.
- There is a module named pymysql_sa to provide dialect for sqlalchemy
- Flask is wrote by pure python and 100% WSGI 1.0 compliant. use eventlet.wsgi to provide the service.
使用绿色模块进行单抓取任务。 将任务放入队列, 由事件提供, 每个任务工人从队列中获取一份工作, 然后在完成抓取后将结果保存到 db 中, 或发送到事件 。 Event 对象以触发等待任务完成的工作 。 或者, 两者 。
更新 :
该事件官方文件强烈建议使用主模块拳头线上的补丁, 并可以安全地多次调用 monkey_ patch 。 更多信息请访问< a href=> http://eventlet. net/doc/patching.html> rel=“ nofollow” > http://eventlet. net/doc/patch.html
There some green module can working with eventlet, all of them are in the eventlet.green. A list on bitbucket.
Make sure use the green module in your code, or patch them before import 3th modules which use the standard libs.
但猴子小狗只接受少数模块, 需要手工导入绿色模块 。
def monkey_patch(**on):
"""Globally patches certain system modules to be greenthread-friendly.
The keyword arguments afford some control over which modules are patched.
If no keyword arguments are supplied, all possible modules are patched.
If keywords are set to True, only the specified modules are patched. E.g.,
``monkey_patch(socket=True, select=True)`` patches only the select and
socket modules. Most arguments patch the single module of the same name
(os, time, select). The exceptions are socket, which also patches the ssl
module if present; and thread, which patches thread, threading, and Queue.
It s safe to call monkey_patch multiple times.
"""
accepted_args = set(( os , select , socket ,
thread , time , psycopg , MySQLdb ))
default_on = on.pop("all",None)