0

I have a simple issue, we have as follows:

@task()
def upload_image(request):
     var = request.POST

     # ... do something

And we call it in another method the delay for this method like this:

job = upload_image.delay(request)

This not works obviously, after I read, you can pass messages to a celery task like a simple arg, args or kwargs** but what I just want is to pass a simple object, not a string or list of strings, is there anyway to do this in celery?

Regards!

3 Answers 3

1

This does not work with the standard pickler. See more here (basically a duplicate): passing django request object to celery task

Sign up to request clarification or add additional context in comments.

Comments

0

As you can read from the docs your example should work.

from celery import task

@task()
def add(x, y):
    return x + y

add.delay(2, 2)

Comments

0

This should work as long as you're using standard pickle serializer.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.