1👍
✅
-
When you call
file.delay
, celery queues up the task to run in the background, at some later point. -
If you immediately check
result.successful()
, it’ll be false, as the task hasn’t run yet.
If you need to chain tasks (one firing after another) use Celery’s workflow solutions (in this case chain):
def do_this(password, source12, destination):
chain = file.s(password, source12, destination) | save_to_database.s()
chain()
@celery.task()
def file(password, source12, destination):
foo = password
return foo
@celery.task()
def save_to_database(foo):
Foo.objects.create(result=foo)
Source:stackexchange.com