Verified Commit 9e979e3a authored by Egor Dubenetskiy's avatar Egor Dubenetskiy 🚴🏼

Не работаешь — сэлэри не получаешь

parent d0636eff
from celery.decorators import task
@task
def topic_index(**kwargs):
index = kwargs.get('index')
key = kwargs.get('key')
topic_id = kwargs.get('topic_id')
topic_blog_id = kwargs.get('topic_blog_id')
topic_user_id = kwargs.get('topic_user_id')
topic_type = kwargs.get('topic_type')
topic_title = kwargs.get('topic_title')
topic_text = kwargs.get('topic_text')
topic_tags = kwargs.get('topic_tags')
topic_date = kwargs.get('topic_date')
topic_publish = kwargs.get('topic_publish')
topic_tags = topic_tags.split(',')
doc_body = {
'blog_id': int(topic_blog_id),
'user_id': int(topic_user_id),
'type': topic_type,
'title': topic_title.strip(),
'text': topic_text.strip(),
'tags': topic_tags,
'date': topic_date,
'publish': topic_publish
}
es.index(index=index, doc_type=key, id=int(topic_id), body=doc_body)
\ No newline at end of file
summary = kwargs.get('summary')
details = kwargs.get('details')
print(summary, details)
from celery import execute
import logging
# XXX: Does not work properly
Logger = logging.getLogger()
Logger.setLevel(logging.DEBUG)
execute.send_task("tasks.topic_index", countdown=3)
......@@ -13,3 +13,4 @@ speaklater==1.3
webassets==0.12.0
Werkzeug==0.11.15
vklancer
celery
......@@ -212,3 +212,7 @@ commands:
flask: *flask
redis: *redis
celery: *celery
semantics_example: !Command
container: python
run: [python3, echoes/memantic/__init__.py]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment