推荐学习书目
› 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
seizetheday
V2EX  ›  Python

求推荐 python 的任务管理的方法

  •  
  •   seizetheday · Dec 7, 2016 · 5962 views
    This topic created in 3626 days ago, the information mentioned may be changed or developed.
    比如,有 3 个 py 文件: a.py, b.py, c.py

    希望:
    1. 17 : 00 执行 a.py
    2. 每隔 5 分钟执行 b.py
    3. 每隔 1 天执行 c.py

    通过什么包来管理这些任务比较好?

    环境: python 2.7, linux/windows
    24 replies  •  2017-06-07 22:55:03 +08:00
    DozySun
    DozySun
    Dec 7, 2016
    1
    apscheduler
    tonghuashuai
    tonghuashuai
    Dec 7, 2016❤️1
    2
    这样的情况一般用 crontab 最简单把,其他的包什么的估计还得写代码去调度。
    sinux
    sinux
    PRO
    Dec 7, 2016
    3
    native cron
    SlipStupig
    SlipStupig
    Dec 7, 2016
    4
    @tonghuashuai 我也是用 crontab ,但是不知道为什么任务根本没执行
    sevncz
    sevncz
    Dec 7, 2016
    5
    crontab +1
    sunwei0325
    sunwei0325
    Dec 7, 2016
    6
    airflow
    tonghuashuai
    tonghuashuai
    Dec 7, 2016
    7
    @SlipStupig print 下 log 看看
    smartdie
    smartdie
    Dec 7, 2016
    8
    一般用 crontab ,
    如果你的项目里用 celery 了,可以考虑 celery beat
    glasslion
    glasslion
    Dec 7, 2016
    9
    这种简单 情况, crontab 最合适,
    windfarer
    windfarer
    Dec 7, 2016
    10
    crontab 用用就行了
    cdwyd
    cdwyd
    Dec 7, 2016 via Android
    11
    @SlipStupig
    我也遇到了手动运行正常 crontab 不执行的问题,后面发现是路径问题,加一个 os.chdir 到工作目录就可以了
    qweweretrt515
    qweweretrt515
    Dec 7, 2016
    12
    celery
    brucedone
    brucedone
    Dec 7, 2016
    13
    clino
    clino
    Dec 7, 2016 via Android
    14
    buildbot
    lunaticus7
    lunaticus7
    Dec 7, 2016
    15
    celery
    FiveDDD
    FiveDDD
    Dec 7, 2016
    16
    不想添加依赖,就 crontab ;另外项目的话,可以试试 celery , apscheduler 。
    Contextualist
    Contextualist
    Dec 7, 2016 via iPad
    17
    个人比较喜欢 https://github.com/dbader/schedule ,适合简单的任务,比 apscheduler 更轻
    SlipStupig
    SlipStupig
    Dec 7, 2016
    18
    @cdwyd 手动我也不执行
    这个是我的配置文件

    30 23 * * * /home/ubuntu/drogen/starup.sh > /dev/null 2>&1
    10 1 * * 6,0 python ~/jdspier/spidermain.py > /dev/null 2>&1
    */1 * * * * /bin/bash /home/cron.sh > /dev/null 2>&1Ø
    clino
    clino
    Dec 7, 2016 via Android
    19
    buildbot 这种自动构建软件有个好处是能在 web 上看所有 stdio 输出
    Lycnir
    Lycnir
    Dec 7, 2016
    20
    crontab 尽量用全路径
    Chyroc
    Chyroc
    Dec 8, 2016
    21
    luigi?
    zhuf
    zhuf
    Dec 8, 2016
    22
    apscheduler 比较方便
    glogo
    glogo
    Dec 8, 2016
    23
    celery beat 可以,不过比较重型了
    heraldboy
    heraldboy
    Jun 7, 2017
    24
    linux 好处理,关键是 windows 下大家有什么好建议
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2261 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 126ms · UTC 13:37 · PVG 21:37 · LAX 05:37 · JFK 08:37
    ♥ Do have faith in what you're doing.