Have you done the celery tutorial?

Async tasks require you to have a broker (rabbitmq or something) and also
to create some workers that actually execute the task.

On Fri, Jan 9, 2015 at 12:55 AM, Sugita Shinsuke <shinr...@gmail.com> wrote:

> Hi somecallitblues
>
> Thank you for replying.
> I installed Celery 3.1.17.
>
> And, I setup
>
> I created add method in tasks.py
>
> my tasks.py
> ----
> from __future__ import absolute_import
>
> from celery import shared_task
>
>
> @shared_task
> def add(x, y):
>     return x + y
> ----
>
> I also called my add method from my view.
>
> hoge_view.py
> ---
> def run_celery(request):
>     result = add.delay(3, 8)
>     while not result.ready():
>         print 'spam'
>     print result.get()
>     return HttpResponse("test")
> ---
>
> I called it from url.
>
> "error: timed out" was occurred.
>
> Why is it timed out? Could you help me?
>
>
> 2015年1月8日木曜日 19時19分20秒 UTC+9 somecallitblues:
>>
>> Look into celery. It's the best and easiest way to run bg jobs imo
>> On 08/01/2015 9:10 pm, "Sugita Shinsuke" <shin...@gmail.com> wrote:
>>
>>> Hi there.
>>>
>>> I'd like to run background application.
>>>
>>> I coded this code.
>>>
>>> I wrote the urls.py and I added in the view.
>>>
>>> def run_junix(request):
>>>     cmd = "cd app_path;nohup python background_app.py &"
>>>     import subprocess
>>>     proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
>>> stderr=subprocess.STDOUT)
>>>
>>>     return HttpResponse("bg test")
>>>
>>> Is it good way? or using supervisor or, if you know the better way,
>>> would you tell me?
>>>
>>> Anyone who know this matter, please help.
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-users/0a8222ff-a22c-44a5-a098-2b663aaca294%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/0a8222ff-a22c-44a5-a098-2b663aaca294%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b5e2226c-9825-4409-bc91-4b97f5c0609e%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/b5e2226c-9825-4409-bc91-4b97f5c0609e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei2ktiVr9w5YLN1sBND%3Dzp1vpWeEDa6H_BMpTyAXToy3iw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to