Public Member Functions | |
def | __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) |
def | process (self) |
def | put (self, task) |
Public Attributes | |
cm | |
free | |
handles | |
queue | |
request_error | |
request_init | |
request_respond | |
Private Member Functions | |
def | _request_error (self, c, task, errmsg, errno) |
def | _request_init (self, c, url) |
def | _request_respond (self, args) |
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 27 of file HTTP.py.
|
private |
Default request error callback.
Definition at line 78 of file HTTP.py.
|
private |
|
private |
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 91 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 Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.dumpPython(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.open(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.outputEventContent(), 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 51 of file HTTP.py.
Referenced by HTTP.RequestManager.process().
HTTP.RequestManager.handles |
Definition at line 50 of file HTTP.py.
Referenced by SimpleMuonAnalyzer.SimpleMuonAnalyzer.declareHandles(), ZEleEleAnalyzer.ZEleEleAnalyzer.declareHandles(), ZMuMuAnalyzer.ZMuMuAnalyzer.declareHandles(), TriggerAnalyzer.TriggerAnalyzer.declareHandles(), MetAnalyzer.MetAnalyzer.declareHandles(), SimpleJetAnalyzer.SimpleJetAnalyzer.declareHandles(), objects.TauAnalyzer.TauAnalyzer.declareHandles(), core.TriggerBitFilter.TriggerBitFilter.declareHandles(), core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.declareHandles(), RazorAnalyzer.RazorAnalyzer.declareHandles(), objects.METAnalyzer.METAnalyzer.declareHandles(), core.TriggerBitAnalyzer.TriggerBitAnalyzer.declareHandles(), AlphaTAnalyzer.AlphaTAnalyzer.declareHandles(), MT2Analyzer.MT2Analyzer.declareHandles(), core.AutoFillTreeProducer.AutoFillTreeProducer.declareHandles(), objects.PhotonAnalyzer.PhotonAnalyzer.declareHandles(), JetAnalyzer.JetAnalyzer.declareHandles(), objects.VertexAnalyzer.VertexAnalyzer.declareHandles(), objects.IsoTrackAnalyzer.IsoTrackAnalyzer.declareHandles(), core.PileUpAnalyzer.PileUpAnalyzer.declareHandles(), objects.LeptonAnalyzer.LeptonAnalyzer.declareHandles(), objects.JetAnalyzer.JetAnalyzer.declareHandles(), core.AutoFillTreeProducer.AutoFillTreeProducer.fillTree(), objects.LeptonAnalyzer.LeptonAnalyzer.makeAllElectrons(), objects.LeptonAnalyzer.LeptonAnalyzer.makeAllMuons(), objects.IsoTrackAnalyzer.IsoTrackAnalyzer.makeIsoTrack(), objects.LeptonAnalyzer.LeptonAnalyzer.makeLeptons(), objects.PhotonAnalyzer.PhotonAnalyzer.makePhotons(), objects.TauAnalyzer.TauAnalyzer.makeTaus(), objects.METAnalyzer.METAnalyzer.makeTkMETs(), SimpleMuonAnalyzer.SimpleMuonAnalyzer.process(), SimpleJetAnalyzer.SimpleJetAnalyzer.process(), MetAnalyzer.MetAnalyzer.process(), core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.process(), core.TriggerBitFilter.TriggerBitFilter.process(), TriggerAnalyzer.TriggerAnalyzer.process(), JetAnalyzer.JetAnalyzer.process(), core.TriggerBitAnalyzer.TriggerBitAnalyzer.process(), DiLeptonAnalyzer.DiLeptonAnalyzer.process(), objects.VertexAnalyzer.VertexAnalyzer.process(), core.PileUpAnalyzer.PileUpAnalyzer.process(), objects.JetAnalyzer.JetAnalyzer.process(), objects.PhotonAnalyzer.PhotonAnalyzer.randomCone(), and core.Analyzer.Analyzer.readCollections().
HTTP.RequestManager.queue |
Definition at line 52 of file HTTP.py.
Referenced by HTTP.RequestManager.process().
HTTP.RequestManager.request_error |
Definition at line 47 of file HTTP.py.
Referenced by HTTP.RequestManager.process().
HTTP.RequestManager.request_init |
Definition at line 48 of file HTTP.py.
Referenced by HTTP.RequestManager.process().
HTTP.RequestManager.request_respond |
Definition at line 46 of file HTTP.py.
Referenced by HTTP.RequestManager.process().