celery

打造基于Python的流式数据分析平台

霸气de小男生 提交于 2019-12-01 04:54:21
基于Python已经有多个科学研究和数据分析库,使用非常方便。结合OpenStack( http://www.openstack.org )、RabbitMQ( http://www.rabbitmq.com )、Celery( http://www.celeryproject.org )可以打造一个实时数据的分析平台。 OpenStack是基于Python开发的云计算平台,可以进行虚拟机的调度和管理,以及数据的虚拟化存储。RabbitMQ是一个消息总线服务器,支持通过消息的数据快速收发和任务数据的调度、分派,Celery实现并行的Worker数据分析模型。三个软件模块的结合可以完成虚拟机管理、任务管理、实时数据收发的相关任务,并使用numPy等科学计算库执行数据分析。 如下图所示: 感觉上,功能满强的哦!以后有时间了,再来慢慢研究。 来源: oschina 链接: https://my.oschina.net/u/2306127/blog/417718

Celery scheduled tasks problems with Timezone

泪湿孤枕 提交于 2019-12-01 04:53:21
I'm using celery in a server where server time is now BST , and suddenly my scheduled tasks are executing one hour before! Previously, server time was Europe/London which was GMT but now due to day light saving it has become BST (GMT + 1) I've configured celery to use the timezone like: CELERY_TIMEZONE = 'Europe/London' Then when calling tasks, I've also localized value for the eta parameter to 'Europe/London' like this: from datetime import datetime from pytz import timezone locale_to_use = timezone('Europe/London') current_time = locale_to_use.localize(datetime.now()) And used this current

Celery error : result.get times out

一个人想着一个人 提交于 2019-12-01 04:23:17
问题 I've installed Celery and I'm trying to test it with the Celery First Steps Doc. I tried using both Redis and RabbitMQ as brokers and backends, but I can't get the result with : result.get(timeout = 10) Each time, I get this error : Traceback (most recent call last): File "<input>", line 11, in <module> File "/home/mehdi/.virtualenvs/python3/lib/python3.4/site-packages/celery/result.py", line 169, in get no_ack=no_ack, File "/home/mehdi/.virtualenvs/python3/lib/python3.4/site-packages/celery

Running celeryd_multi with supervisor

笑着哭i 提交于 2019-12-01 04:09:16
I'm working with djcelery and supervisor. I was running a celery with supervisor and everything worked fine, once I realized that I needed to change it to celery multi everything broke up. If I run celeryd_multi in a terminal it works but always run in background, like supervisor need that the command run in foreground there where the problem is. This is my celery.ini : [program:celery_{{ division }}] command = {{ virtualenv_bin_dir }}/python manage.py celeryd_multi start default mailchimp -c:mailchimp 3 -c:default 5 --loglevel=info --logfile={{ log_dir }}/celery/%n.log --pidfile={{ run_dir }}

Celery: Callback after task hierarchy

大城市里の小女人 提交于 2019-12-01 03:25:08
I'm using Celery from a webapp to start a task hierarchy. Tasks I'm using the following tasks: task_a task_b task_c notify_user A Django view starts several task_a instances. Each of them does some processing and then starts several task_b instances. And each of those does some processing and then starts several task_c instances. To visualize: Goals My goal is to execute all the tasks, and to run a callback function as soon as the entire hierarchy has finished. Additionally, I want to be able to pass data from the lowest tasks to the top level. The view should just "kick off" the tasks and

Start celery worker throws “no attribute 'worker_state_db'”

╄→尐↘猪︶ㄣ 提交于 2019-12-01 03:06:54
When I am trying to start celery worker in Django app as: celery -A myApp worker -l info I get following error: File "/home/alexander/.pyenv/versions/3.5.1/envs/myApp/lib/python3.5/site-packages/celery/utils/collections.py", line 134, in __getattr__ type(self).__name__, k)) AttributeError: 'Settings' object has no attribute 'worker_state_db' If you know how to solve it please write your idea! Alexander Tyapkov The bug appears if an exception is raised while parsing settings. Such as when we set Django's SECRET_KEY (or any other setting) via an environment variable: SECRET_KEY = os.environ[

Celery scheduled tasks problems with Timezone

烈酒焚心 提交于 2019-12-01 03:03:58
问题 I'm using celery in a server where server time is now BST , and suddenly my scheduled tasks are executing one hour before! Previously, server time was Europe/London which was GMT but now due to day light saving it has become BST (GMT + 1) I've configured celery to use the timezone like: CELERY_TIMEZONE = 'Europe/London' Then when calling tasks, I've also localized value for the eta parameter to 'Europe/London' like this: from datetime import datetime from pytz import timezone locale_to_use =

Celery Result backend. DisabledBackend object has no attribute _get_task_meta_for

三世轮回 提交于 2019-12-01 02:51:12
问题 I have configured celery and the backend: cleryapp = Celery( 'tasks_app', brocker='amqp://guest@localhost//', backend='db+postgresql://guest@localhost:5432' ) 'results' appears disabled when i start the worker, but I read on another question here that that's not the issue. The database is getting all the data correctly, but result = AsyncResult(task_id) raises AttributeError: 'DisabledBackend' object has no attribute '_get_task_meta_for' 回答1: I found a more convenient way to do that. result =

Cython保护python代码

安稳与你 提交于 2019-12-01 02:48:14
注:.pyc也有一定的保护性,容易被反编译出源码... 项目发布时,为防止源码泄露,需要对源码进行一定的保护机制,本文使用Cython将.py文件转为.so进行保护。这一方法,虽仍能被反编译,但难度会比较大。另外,Cython是Python的超集。 自行安装Cython 1,创建complie.py文件 from Cython.Build import cythonizefrom Cython.Distutils import build_extfrom setuptools import setupfrom setuptools.extension import Extensionsetup( ext_modules=cythonize( [ Extension('project.*', ['project/*.py']), Extension('project.api.*', ['project/api/*.py']), Extension('project.api.bizs.*', ['project/api/bizs/*.py']), Extension('project.api.data.export*', ['project/api/data/export/*.py']), Extension('project.api.exceptions.*', ['project

django中使用celery

本秂侑毒 提交于 2019-12-01 01:53:35
1.目录结构     在settings配置中添加 INSTALLED_APPS = [ 'celery', ] 2.celery.py import os import django#导入django的环境这样就可以在celery中运行orm os.environ.setdefault("DJANGO_SETTINGS_MODULE", "repi.settings") django.setup() from celery import Celery#本地的redis链接 broker='redis://127.0.0.1:6379/3' backend='redis://127.0.0.1:6379/4' app=Celery('celery_stask',broker=broker,backend=backend,include=['celery_stask.stask'])#celery_stask.stask任务文件 # app=Celery('celery_stask',include=['celery_stask.stask']) # 时区 app.conf.timezone = 'Asia/Shanghai' # 是否使用UTC app.conf.enable_utc = False from datetime import timedelta app.conf