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

[召唤 Python 大佬] Django extensions script 启动时怎么捕捉运行状态?

  •  
  •   suant0u ·
    itsuantou · May 7, 2020 · 2804 views
    This topic created in 2333 days ago, the information mentioned may be changed or developed.

    事情的经过是酱紫的. Python 的项目中存在定时任务. 项目容器化(运行时环境和源码打包), 然后 Python 启动 manage.py runscript xxx , 运行时发现 ImportError.... 在 K8s 中, CronJob 对象包装的 Pod 并没有因此而报错, 而是 Success. 看了源码发现是被 except 了 , 而且返回值 false 也没有对最外层返回... 在不更改源码的前提下有办法搞定它吗? 目标是这个 Container 异常退出呀, return code 非 0...

    1 replies  •  2020-05-08 10:32:47 +08:00
    kycool
        1
    kycool  
       May 8, 2020
    重写命令基类中抛出异常的方法即可
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2685 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 07:19 · PVG 15:19 · LAX 00:19 · JFK 03:19
    ♥ Do have faith in what you're doing.