google app engine - Asynchronous requests in AppEngine -


i'm building app following:

  • get user enter parameters.
  • pass params backend , start task based on params.
  • when task complete redirect user page showing results of task.

the problem here task expected take quite long. hoping make request asynchronous. appengine allow ?

if not, options ? looking @ documentation task queues. while satisfies part of i'm trying do, i'm not clear on how queue notifies client when task complete, redirect can initiated.

also, if results of task have returned calling client ? possible ?

you can't (shouldn't really) wait completion, gae not designed that. launch task, task id (unique, persisted in app) , send id client in response launch request.

the client can check, either polling (at reasonable rate) or on-demand, status page (you can use id find right task). can add progress/eta info on page, down road if desire.

after task completes next status check request client can redirected results page mentioned.

this q&a might well, it's similar scenario, using deferred library: how return data deferred task in google app engine

update:

the task queues preferable deferred library, deferred functionality available using optional countdown or eta arguments taskqueue.add():

  • countdown -- time in seconds future task should run or leased. defaults zero. not specify argument if specified eta.

  • eta -- datetime.datetime specifies absolute earliest time @ task should run. cannot specify argument if countdown argument specified. argument can time zone-aware or time zone-naive, or set time in past. if argument set none, default value now. pull tasks, no worker can lease task before time indicated eta argument.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -