tornado-celery | blocking Celery client for Tornado web framework | Web Framework library
kandi X-RAY | tornado-celery Summary
kandi X-RAY | tornado-celery Summary
tornado-celery is a non-blocking Celery client for Tornado web framework.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Wraps a task .
- Callback for when a result is received .
- Evaluate strs .
tornado-celery Key Features
tornado-celery Examples and Code Snippets
Community Discussions
Trending Discussions on tornado-celery
QUESTION
So I'm trying to accomplish the following. User browses webpage and at the sime time there is a task running in the background. When the task completes it should return args
where one of args
is flag: True
in order to trigger a javascript and javascript shows a modal form.
I tested it before without async tasks and it works, but now with celery it just stores results in database. I did some research on tornado-celery and related stuff but some of components like tornado-redis is not mantained anymore so it would not be vise in my opinion to use that.
So what are my options, thanks?
...ANSWER
Answered 2018-Apr-05 at 22:43If I understand you correctly, then you want to communicate something from the server side back to the client. You generally have three options for that:
1) Make a long pending request to the server - kinda bad. Jumping over the details, it will bog down your web server if not configured to handle that, it will make your site score low on performance tests and if the request fails, everything fails.
2) Poll the server with numerous requests with a time interval (0.2 s, something like that) - better. It will increase the traffic, but the requests will be tiny and will not interfere with the site's performance very much. If you instate a long interval to not load the server with pointless requests, then the users will see the data with a bit of a delay. On the upside this will not fail (if written correctly) even if the connection is interrupted.
3) Websockets where the server can just hit the client with any message whenever needed - nice, but takes some time to get used to. If you want to try, you can use django-channels
which is a nice library for Django websockets.
If I did not understand you correctly and this is not the problem at hand and you are figuring how to get data back from a Celery task to Django, then you can store the Celery task ID-s and use the ID-s to first check, if the task is completed and then query the data from Celery.
QUESTION
It raises an exception when I try to use celery3.1.11, tornado-celery0.3.5 in Tornado4.2 with yield. It works without the yield, but cannot get the result asynchronous...I also find it works when I use rabbitmq as a broker, while redis will raise the below error...
Here is my code.
...ANSWER
Answered 2017-Aug-18 at 23:24The limited docs about tcelery
doesn't explain much and your example doesn't show much either. From the limited docs, it does seem like you're using it as intended (unless I'm missing something) so I'm not sure why your code is not working. I've been successful with the following method:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install tornado-celery
You can use tornado-celery like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page