V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2020-05-07 23:45:03 +08:00 · 1570 次点击
    这是一个创建于 1442 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    1 条回复    2020-05-08 10:32:47 +08:00
    kycool
        1
    kycool  
       2020-05-08 10:32:47 +08:00
    重写命令基类中抛出异常的方法即可
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4187 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 04:08 · PVG 12:08 · LAX 21:08 · JFK 00:08
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.