Google App Engine deferred.defer() failing when method returns
--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Quirky Dreamscape Looping
--
Chapters
00:00 Google App Engine Deferred.Defer() Failing When Method Returns
00:39 Accepted Answer Score 10
00:58 Answer 2 Score 2
01:34 Thank you
--
Full question
https://stackoverflow.com/questions/4924...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #googleappengine #exception #task
#avk47
    Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Quirky Dreamscape Looping
--
Chapters
00:00 Google App Engine Deferred.Defer() Failing When Method Returns
00:39 Accepted Answer Score 10
00:58 Answer 2 Score 2
01:34 Thank you
--
Full question
https://stackoverflow.com/questions/4924...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #googleappengine #exception #task
#avk47
ACCEPTED ANSWER
Score 10
You should use:
result = deferred.defer(meeple_tasks.buildGames)
If you use buildGames(), that invokes the function right then and there, passing the return value to defer(). By removing the parenthesis, you pass the function itself to defer.
ANSWER 2
Score 2
You need to call your deferred task like this:
deferred.defer(meeple_tasks.buildGames)
"obj must be callable" means that (in your case) the value True is not callable. How I wrote the deferred call with "defer" the buildGames method call to another process (or task) by inserting it in a queue and letting the AppEngine framework deal with it.
Note that you cannot return anything with deferred tasks. They will be running on a different process and probably on a totally different server. As per the documentation they are Background workers.