推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
Feiox
V2EX  ›  Python

如何基于 Celery 做爬虫但遇到些坑,如重复执行了一个任务、 db 对象内数据有错误

  •  
  •   Feiox ·
    feiox · Apr 28, 2015 · 3558 views
    This topic created in 4061 days ago, the information mentioned may be changed or developed.

    因为要爬特定领域内的一些站点。每次存储过程需要反复和数据库进行信息增删。
    现在我遇到三个问题:

    1. 出现重复执行的任务
    2. db 对象里有错误数据(而且都是固定的一个值)
    3. 明明不改有重复的数据却提示我主键重复,而且每次都是那固定几个。但去数据库中找,发现这些数据又已经存在

    运行模式:celery -A celeryd worker -P eventlet -c 100 -l info
    而且,并放量越多,错误越多。
    broker 使用的是 Redis,数据库用的是 MariaDB。

    2 replies    2015-04-29 09:01:05 +08:00
    ledzep2
        2
    ledzep2  
       Apr 29, 2015
    如果有用Late Ack, 那任务没正常返回, 可能会有重复执行.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3266 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 175ms · UTC 10:59 · PVG 18:59 · LAX 03:59 · JFK 06:59
    ♥ Do have faith in what you're doing.