1. 程式人生 > >flask+celery常見問題及解決方法

flask+celery常見問題及解決方法

1、
[[email protected] flask_celery]# celery -A app worker --loglevel=info
Traceback (most recent call last):
  File "/usr/bin/celery", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/celery/__main__.py", line 30, in main
    main()
  File "/usr/lib/python2.7/site-packages/celery/bin/celery.py", line 81, in main
    cmd.execute_from_commandline(argv)
  File "/usr/lib/python2.7/site-packages/celery/bin/celery.py", line 793, in execute_from_commandline
    super(CeleryCommand, self).execute_from_commandline(argv)))
  File "/usr/lib/python2.7/site-packages/celery/bin/base.py", line 309, in execute_from_commandline
    argv = self.setup_app_from_commandline(argv)
  File "/usr/lib/python2.7/site-packages/celery/bin/base.py", line 477, in setup_app_from_commandline
    user_preload = tuple(self.app.user_options['preload'] or ())
AttributeError: 'Flask' object has no attribute 'user_options'


解決方法:
celery -A app.celery worker --loglevel=info


https://groups.google.com/forum/#!topic/python-cn/GreLCH6dNCg


2、
[2016-06-23 03:30:44,519: ERROR/MainProcess] Received unregistered task of type '__main__.add_together'.
The message has been ignored and discarded.


Did you remember to import the module containing this task?
Or maybe you are using relative imports?
Please see http://bit.ly/gLye1c for more information.


The full contents of the message body was:
{'utc': True, 'chord': None, 'args': (4, 4), 'retries': 0, 'expires': None, 'task': '__main__.add_together', 'callbacks': None, 'errbacks': None, 'timelimit': (None, None), 'taskset': None, 'kwargs': {}, 'eta': None, 'id': '4f0b8f7f-8d44-4a75-b2b6-b5fb738287f0'} (221b)
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/celery/worker/consumer.py", line 456, in on_task_received
    strategies[name](message, body,
KeyError: '__main__.add_together'


解決方法:
不要講 add_together 方法寫在主模組中,因為註冊時註冊的task為模組名.add_together, 而呼叫時task為 __main__.add_together


3、
celery -A app.celery worker --loglevel=info
/usr/lib/python2.6/site-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.restful is deprecated, use flask_restful instead.
  .format(x=modname), ExtDeprecationWarning
/usr/lib/python2.6/site-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.restful.reqparse is deprecated, use flask_restful.reqparse instead.
  .format(x=modname), ExtDeprecationWarning
Running a worker with superuser privileges when the
worker accepts messages serialized with pickle is a very bad idea!


If you really want to continue then you have to set the C_FORCE_ROOT
environment variable (but please think about this before you do).


User information: uid=0 euid=0 gid=0 egid=0


解決方法:

export C_FORCE_ROOT="true"

http://xiaorui.cc/2014/04/23/python%E4%BD%BF%E7%94%A8celery%E5%81%9A%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%97%B6%E7%9A%84%E5%B8%B8%E8%A7%81%E7%9A%84%E9%97%AE%E9%A2%98/

相關推薦

flask+celery常見問題解決方法

1、 [[email protected] flask_celery]# celery -A app worker --loglevel=info Traceback (most recent call last):   File "/usr/bin/celery

Maven常見異常解決方法

for display maven2 main collect nts exist temp set 異常1: [ERROR] Failed to execute goal on project biz_zhuhai: Could not resolve dependen

web程序常見錯誤解決方法

開始 個數字 ice 依據 文件中 方法參數 500錯誤 程序 運行 404錯誤產生原因及解決方法 在剛開始進行Web應用開發的時候,經常看見頁面出現404這個數字,我們一般會稱之為運行產生了404錯誤。類似於404這個數字,還有可能在頁面上看到405、500這兩個數字,他

銀河麒麟操作系統常見問題解決方法(四)

更換 架構 ash 信息技術 .cn 計算 科技 安裝問題 cti 銀河麒麟操作系統常見問題及解決方法(四) ——激活問題 銀河麒麟操作系統是國防科大唯一授權給天津麒

NFS服務的簡介常見故障解決方法

NFS文件系統介紹 NFS配置詳解 NFS常見故障及解決方法 NFS文件系統詳解 NFS實現自動掛載 NFS服務的簡介及常見故障解決方法1、NFS基本介紹(1)NFS簡介 NFS 是Network File System的縮寫,即網絡文件系統。一種使用於分散式文件系統的

webpack構建工具常見問題解決方法

webpack 常見問題 build報錯 webpack構建工具常見問題及解決方法 在運用webpack開發項目的時候經常會遇到各種各樣的問題,我對實際開發項目中實際遇到的一些問題 進行總結,希望能幫助到大家。 ?? 1. 構建需要的包未添加依賴報錯 Module not fo

IIS_常見問題解決方法

解決問題 解決辦法 div www. 命令提示符 spa usr ebs occurred 配置錯誤 在唯一密鑰屬性“value”設置為“default.aspx”時,無法添加類型為“add&r

jenkins 常見錯誤解決方法整理

ref 令行 follow ESS tro windows ins 常見錯誤 以管理員身份運行 現象 WMI.WmiException:AccessDenied 解決方法: 以管理員身份運行 cmd 命令行 jenkins-slave install jenkins

常見小票打印機打印故障解決方法匯總視頻教程

mar 而且 電腦 打印機 硬件 外部 col 自主 亂碼 通過對“常見小票打印機故障及解決方法匯總視頻教程”課程學習,達到以下目的:1、可以獨立自主安裝打印機驅動以及安裝打印機硬件設備 2、可以獨立自主排除常見打印機故障學習教程 常見小票打印機故障:【小票打印機不打印故障

Maven常見異常解決方法---測試代碼編譯錯誤

detail mave https ror 錯誤 failure 異常 gin pro [ERROR] Please refer to E:\maven\web_nanchang\target\surefire-reports for the individual test

Solr12-SolrCloud部署中的常見問題解決方法

目錄 1 ZooKeeper管理配置檔案的另一種方法 2 Solr服務不能訪問 3 部分或全部節點處於”Recovering”或”Gone”狀態 4 SolrCloud模式下, 啟動Tomcat服務耗時太久 5 其他問題(尚未驗證, 請存疑) 參考資料 1 ZooKeeper

BCP SQL匯出EXCEL常見問題解決方法;資料匯出儲存過程

一、‘xp_cmdshell’的啟用 SQL Server阻止了對元件‘xp_cmdshell’的過程‘sys.xp_cmdshell’的訪問。因為此元件已作為此服務囂安全配置的一部分而被關 閉。系統管理員可以通過使用sp_configure啟用‘xp_cmdshell’。有關啟用‘xp_cmdshell’

BCP SQL導出EXCEL常見問題解決方法;數據導出存儲過程

添加 啟用 advance query repl 開啟 功能 對組 pla 一、‘xp_cmdshell’的啟用 SQL Server阻止了對組件‘xp_cmdshell’的過程‘sys.xp_cmdshell’的訪問。因為此組件已作為此服務囂安全配置的一部分而被關 閉。系

【轉】【MySQL】Mysql併發時經典常見的死鎖原因解決方法

https://www.cnblogs.com/zejin2008/p/5262751.html   1.    mysql都有什麼鎖   MySQL有三種鎖的級別:頁級、表級、行級。 表級鎖:開銷小,加鎖快;不會出現死

ENVI FLAASH大氣校正常見錯誤解決方法(轉載)

ENVI FLAASH大氣校正常見錯誤及解決方法(轉載) 本文彙總了ENVI FLAASH大氣校正模組中常見的錯誤,並給出解決方法,分為兩部分:執行錯誤和結果錯誤。前面是錯誤提示及說明,後面是錯誤解釋及解決方法。 FLAASH對輸入資料型別有以下幾個要

nginx常見錯誤解決方法

nginx: [error] open() “/var/run/nginx.pid” failed (2: No such file or directory) 今天修改了下nginx配置,重新載入配置檔案的時候報瞭如下錯誤 [root@renguangli ~]# nginx

Solr12 - SolrCloud部署中的常見問題解決方法

文章目錄 1 ZooKeeper管理配置檔案的另一種方法 2 Solr服務不能訪問 3 部分或全部節點處於”Recovering”或”Gone”狀態 4 SolrCloud模式下, 啟動Tomcat服務耗時太久 5 其他問題(尚未驗證, 請存疑)

Resin 常見問題解決方法(FAQ)

                        Resin 常見問題及解決方法(FAQ)   轉載:http://blog.sina.com.cn/s/

部署wordpress和phpMyAdmin常見問題解決方法

部署wordpress和phpMyAdmin常見問題及解決方法 (一) wordpress常見問題:      建立資料庫連線時錯誤      解決:      1. MySQL

java中在使用類時的一些常見錯誤解決方法

關於java中類的一些常見錯誤及解決方法 1.定義了一個主類,如 public class TestCircle{//此時這裡會顯示“class TestCircle”has never been used“ public void main(String[] args){…}; class