Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products. If you have feedback or questions as you navigate the site, click Send Feedback.

Python 2 is no longer supported by the community. We recommend that you migrate Python 2 apps to Python 3.
Stay organized with collections Save and categorize content based on your preferences.

google.appengine.api.background_thread.background_thread module


Background Threads API.

An API for creating background threads.

Background threads created using this API do not inherit the context of their creator and do not need to end before the creator request completes.


google.appengine.api.background_thread.background_thread.start_new_background_thread(target, args, kwargs=None)source

Starts a new background thread.

Creates a new background thread which will call target(*args, **kwargs).

  • target – A callable for the new thread to run.

  • args – Position arguments to be passed to target.

  • kwargs – Keyword arguments to be passed to target.


The thread ID of the background thread.

class google.appengine.api.background_thread.background_thread.BackgroundThread(group=None, target=None, name=None, args=(), kwargs=None, verbose=None)source

Bases: threading.Thread

A threading.Thread-like interface for background threads.


Starts this background thread.

exception google.appengine.api.background_thread.background_thread.Errorsource

Bases: exceptions.Exception

Base exception class for this module.

exception google.appengine.api.background_thread.background_thread.FrontendsNotSupportedsource

Bases: google.appengine.api.background_thread.background_thread.Error

Error raised when a background thread is requested on a front end.

exception google.appengine.api.background_thread.background_thread.BackgroundThreadLimitReachedErrorsource

Bases: google.appengine.api.background_thread.background_thread.Error

Error raised when no further active background threads can be created.