Skip to content
Long running tasks for Google AppEngine
Python Makefile
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.


Longtask for Long running tasks

Many things take longer than a user is willing to wait. See this Blogposting for further references. AppEngine with it's request deadline of 10s (later lifted to 30s and then to 60s) is also not willing to wait very long. longtask encapsulates a pattern to do the actual work in a taskqueue while providing users with updates (and finally the results) via self reloading webpages. Per default this is limited to tasks running not more than 10 minutes but with the use of backends this can be incerased to nearly unlimited runtime.

Usage is extremely simple:

class myTask(longtask.LongRunningTaskHandler):
    def execute_task(self, parameters):
        self.log_progress("Starting", step=0, total_steps=5)
        for x in range(5):
            self.log_progress("Step %d" % (x + 1), step=(x + 1), total_steps=5)
        return "<html><body>Done!</body></html>"

Thats basically all you need.


I strongly suggest to create a ./lib/ directory within your AppEngine application and put gae_longtask there.

mkdir -p lib
git submodule add git:// lib/gaetk_longtask
echo "import os.path" > lib/
echo "import site" >> lib/
echo "site.addsitedir(os.path.dirname(__file__))" >> lib/
echo "./gaetk_longtask" >> lib/submodules.pth

Now within your application first import lib to initialize the library directory, then import longtask.

See also

Bitdeli Badge

You can’t perform that action at this time.