Public Member Functions | |
def | __init__ |
def | process |
def | put |
Public Attributes | |
cm | |
free | |
handles | |
queue | |
request_error | |
request_init | |
request_respond | |
Private Member Functions | |
def | _request_error |
def | _request_init |
def | _request_respond |
Manager of multiple concurrent or overlapping HTTP requests. This is a utility class acting as a pump of several overlapping HTTP requests against any number of HTTP or HTTPS servers. It uses a configurable number of simultaneous connections, ten by default. The actual connection layer is handled using curl, and the client classes need to aware of this to a limited degree. The client supplies optional callback methods for initialising, responding and handling errors on connections. At the very least the request response callback should be defined. This class is not designed for multi-threaded use. It employs overlapping requests, but in a single thread. Only one thread at a time should be calling `process()`; several threads may call `.put()` provided the caller uses a mutex so that only one thread calls into the method at a time.
def HTTP.RequestManager.__init__ | ( | self, | |
num_connections = 10 , |
|||
ssl_opts = None , |
|||
user_agent = None , |
|||
request_headers = None , |
|||
request_init = None , |
|||
request_respond = None , |
|||
request_error = None , |
|||
handle_init = None |
|||
) |
Initialise the request manager. The arguments are: :arg num_connections: maximum number of simultaneous connections. :arg ssl_opts: optional SSLOptions (Monitoring.Core.X509) for SSL X509 parametre values, e.g. for X509 client authentication. :arg user_agent: sets user agent identification string if defined. :arg request_headers: if defined, specifies list of additional HTTP request headers to be added to each request. :arg request_init: optional callback to initialise requests; the default assumes each task is a URL to access and sets the `URL` property on the curl object to the task value. :arg request_respond: callback for handling responses; at the very minimum this should be defined as the default one does nothing. :arg request_error: callback for handling connection errors; the default one raises a RuntimeException. :arg handle_init: callback for customising connection handles at creation time; the callback will be invoked for each connection object as it's created and queued to the idle connection list.
Definition at line 26 of file HTTP.py.
|
private |
|
private |
|
private |
Default request response callback.
def HTTP.RequestManager.process | ( | self | ) |
Process pending requests until none are left. This method processes all requests queued with `.put()` until they have been fully processed. It calls the ``request_respond`` callback for all successfully completed requests, and ``request_error`` for all failed ones. Any new requests added by callbacks by invoking ``put()`` are also processed before returning.
Definition at line 90 of file HTTP.py.
References HTTP.RequestManager.free, HTTP.RequestManager.queue, HTTP.RequestManager.request_error, HTTP.RequestManager.request_init, and HTTP.RequestManager.request_respond.
Referenced by ConfigBuilder.ConfigBuilder.addExtraStream(), ConfigBuilder.ConfigBuilder.completeInputCommand(), ConfigBuilder.ConfigBuilder.doNotInlineEventContent(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.dumpPython(), ConfigBuilder.ConfigBuilder.PrintAllModules.leave(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.open(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.outputEventContent(), ConfigBuilder.ConfigBuilder.prepare_FASTSIM(), ConfigBuilder.ConfigBuilder.prepare_HLT(), ConfigBuilder.ConfigBuilder.prepare_LHE(), ConfigBuilder.ConfigBuilder.prepare_VALIDATION(), ConfigBuilder.ConfigBuilder.renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder.renameInputTagsInSequence(), ConfigBuilder.ConfigBuilder.scheduleSequence(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.setProcess(), and Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.setProperty().
def HTTP.RequestManager.put | ( | self, | |
task | |||
) |
HTTP.RequestManager.free |
Definition at line 50 of file HTTP.py.
Referenced by HTTP.RequestManager.process().
HTTP.RequestManager.queue |
Definition at line 51 of file HTTP.py.
Referenced by HTTP.RequestManager.process().
HTTP.RequestManager.request_error |
Definition at line 46 of file HTTP.py.
Referenced by HTTP.RequestManager.process().
HTTP.RequestManager.request_init |
Definition at line 47 of file HTTP.py.
Referenced by HTTP.RequestManager.process().
HTTP.RequestManager.request_respond |
Definition at line 45 of file HTTP.py.
Referenced by HTTP.RequestManager.process().