Package core :: Package controllers :: Package threads :: Module threadpool :: Class WorkRequest
[hide private]
[frames] | no frames]

Class WorkRequest



A request to execute a callable for putting in the request queue later.

See the module function makeRequests() for the common case where you want to build several work requests for the same callable but different arguments for each call.

Instance Methods [hide private]
  __init__(self, callable, args=None, kwds=None, requestID=None, callback=None, ownerObj=None)
A work request consists of the a callable to be executed by a worker thread, a list of positional arguments, a dictionary of keyword arguments.

Method Details [hide private]

__init__(self, callable, args=None, kwds=None, requestID=None, callback=None, ownerObj=None)
(Constructor)

 

A work request consists of the a callable to be executed by a worker thread, a list of positional arguments, a dictionary of keyword arguments.

A callback function can be specified, that is called when the results of the request are picked up from the result queue. It must accept two arguments, the request object and it's results in that order. If you want to pass additional information to the callback, just stick it on the request object.

requestID, if given, must be hashable as it is used by the ThreadPool class to store the results of that work request in a dictionary. It defaults to the return value of id(self).