![]() |
App Engine Python SDK
v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
|
Public Member Functions | |
def | __init__ |
def | num_threads |
def | Threads |
def | SubmitItem |
def | QueuedItemCount |
def | Shutdown |
def | Wait |
def | JoinThreads |
def | CheckErrors |
Public Attributes | |
requeue | |
A thread pool which processes WorkItems from a queue. Attributes: requeue: The requeue instance which holds work items for this thread pool.
def google.appengine.tools.adaptive_thread_pool.AdaptiveThreadPool.__init__ | ( | self, | |
num_threads, | |||
queue_size = None , |
|||
base_thread_name = None , |
|||
worker_thread_factory = WorkerThread , |
|||
queue_factory = Queue.Queue |
|||
) |
Initialize an AdaptiveThreadPool. An adaptive thread pool executes WorkItems using a number of WorkerThreads. WorkItems represent items of work that may succeed, soft fail, or hard fail. In addition, a completed work item can signal this AdaptiveThreadPool to enable more or fewer threads. Initially one thread is active. Soft failures are reqeueud to be retried. Hard failures cause this AdaptiveThreadPool to shut down entirely. See the WorkItem class for more details. Args: num_threads: The number of threads to use. queue_size: The size of the work item queue to use. base_thread_name: A string from which worker thread names are derived. worker_thread_factory: A factory which procudes WorkerThreads. queue_factory: Used for dependency injection.
def google.appengine.tools.adaptive_thread_pool.AdaptiveThreadPool.CheckErrors | ( | self | ) |
Output logs for any errors that occurred in the worker threads.
def google.appengine.tools.adaptive_thread_pool.AdaptiveThreadPool.JoinThreads | ( | self | ) |
Wait for all threads to exit.
def google.appengine.tools.adaptive_thread_pool.AdaptiveThreadPool.num_threads | ( | self | ) |
Return the number of threads in this thread pool.
def google.appengine.tools.adaptive_thread_pool.AdaptiveThreadPool.QueuedItemCount | ( | self | ) |
Returns the number of items currently in the queue.
def google.appengine.tools.adaptive_thread_pool.AdaptiveThreadPool.Shutdown | ( | self | ) |
Shutdown the thread pool. Tasks may remain unexecuted in the submit queue.
def google.appengine.tools.adaptive_thread_pool.AdaptiveThreadPool.SubmitItem | ( | self, | |
item, | |||
block = True , |
|||
timeout = 0.0 |
|||
) |
Submit a WorkItem to the AdaptiveThreadPool. Args: item: A WorkItem instance. block: Whether to block on submitting if the submit queue is full. timeout: Time wait for room in the queue if block is True, 0.0 to block indefinitely. Raises: Queue.Full if the submit queue is full.
def google.appengine.tools.adaptive_thread_pool.AdaptiveThreadPool.Threads | ( | self | ) |
Yields the registered threads.
def google.appengine.tools.adaptive_thread_pool.AdaptiveThreadPool.Wait | ( | self | ) |
Wait until all work items have been completed.