Google App Engine

Background Thread API Reference

The google.appengine.api.background_thread module defines functions and classes for working with background threads, threads which can "outlive" the request that spawned them.

Function

background_thread.start_new_background_thread(target, args, kwargs=None)

Creates and starts a background thread. Returns the thread's id.

Arguments

target
Callable object to run in new thread
args
List of positional arguments passed to target
kwargs
Dictionary of keyword arguments passed to target

BackgroundThread class

A BackgroundThread is like a threading.Thread but can "outlive" the request that spawns it.

Constructor

class background_thread.BackgroundThread(group=None, target=None, name=None, args=None, kwargs=None, verbose=None)
This constructor should always be called with keyword arguments.

Arguments

group
Should be None; reserved for a future extension when a Python ThreadGroup class is implemented.
target
Callable object that will run in the background thread.
name
Thread name.
args
List of positional arguments passed to target
kwargs
Dictionary of keyword arguments passed to target

Instance Methods

start()
Start the thread. Call this at most once per thread.
run()
Method representing the thread's activity; a subclass can override this to do something else instead of calling target.
join(timeout=None)
Wait until the thread terminates. The optional floating point timeout argument specifies a maxium number of seconds to wait.
is_alive()
isAlive()
Returns a Boolean indicating whether the thread is alive.
is_daemon()
isDaemon()
Returns a Boolean indicating whether the thread is a daemon thread.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.