Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango Celery Task how to know it run?
    primarykey
    data
    text
    <p>I have the following task for Django Celery (using Amazon SQS).</p> <pre><code>@task def upload_task(request, **kwargs): file = request.FILES['file'] ContactCSVModel.import_from_file(file) return True </code></pre> <p>This appears to work i.e. the file is successfully added it to my database, but I'm not sure it's using Celery at all. How do I know if this worked. Should I see something? In the terminal I ran...</p> <p>manage.py <code>celery worker --loglevel=info</code>, which states I have one task called <code>contacts.tasks.upload_task</code>, but I never see anything happen it just states...</p> <blockquote> <p>[2013-03-14 20:52:47,947: INFO/MainProcess] consumer: Connected to sqs://AJSUQJZKNSJA81JM@localhost//</p> </blockquote> <p>Any idea's if my task has run and was completed (yes I know it completed due to it being in the database, but was that via Celery?) </p> <p>this is where the task gets run from</p> <p>views.py</p> <pre><code>@login_required def upload(request): # If we had a POST then get the request post values. if request.method == 'POST': form = ContactUploadForm(request.POST, request.FILES) # Check we have valid data if form.is_valid(): upload_task(request) #file = request.FILES['file'] #ContactCSVModel.import_from_file(file) messages.add_message(request, messages.SUCCESS, 'Items have been added') else: messages.add_message(request, messages.ERROR, ' Cannot upload CSV file.') return render_to_response('contacts/home.html', context_instance=RequestContext(request)) else: form = ContactUploadForm() # Do this part no matter the outcome above. context = {'form': form} return render_to_response('contacts/home.html', context, context_instance=RequestContext(request)) </code></pre> <p>like I said this works the csv data in loaded into the database, but I don't think Celery is doing anything.</p> <p>this is my Celery settings....</p> <pre><code># Celery BROKER_TRANSPORT_OPTIONS = {'queue_name_prefix': 'celery-'} BROKER_TRANSPORT = 'sqs' BROKER_TRANSPORT_OPTIONS = { 'region': 'eu-west-1', } BROKER_USER = 'xyz' BROKER_PASSWORD = 'xyz' </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload