P
P
Pavel2018-09-12 14:58:03
Flask
Pavel, 2018-09-12 14:58:03

What's wrong with celery_self?

I don't understand why it works for me like this

@celery.task(bind=True)
def task_first():
    pass

And I have many such tasks.
But suddenly I decided to add another queue and a new task
@celery.task(bind=True)
def task_second():
    pass

And on you
missing 1 required positional argument: 'celery_self'

And now at least add, at least Bind=True, at least Bind=False, at least without it, it gives the above error, but only on a new task.
How to understand?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan, 2018-09-19
@VanVanuch

Correctly, if bind=True is already specified, then it is assumed that your task will use an instance task, which means that the function receives self as the first argument. It is very strange that it worked differently for you, maybe there were some decorators?
According to the docs, this is how it should work.

@celery.task(bind=True)
def task_first(self):
    pass


@celery.task()
def task_second():
    pass

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question