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.
Definition at line 4 of file HTTP.py.
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(), ConfigBuilder.ConfigBuilder.prepare_ALCA(), ConfigBuilder.ConfigBuilder.prepare_DQM(), ConfigBuilder.ConfigBuilder.prepare_HLT(), ConfigBuilder.ConfigBuilder.prepare_LHE(), ConfigBuilder.ConfigBuilder.prepare_PATFILTER(), 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().
91 """Process pending requests until none are left. 93 This method processes all requests queued with `.put()` until they 94 have been fully processed. It calls the ``request_respond`` callback 95 for all successfully completed requests, and ``request_error`` for 98 Any new requests added by callbacks by invoking ``put()`` are also 99 processed before returning.""" 101 while self.
queue or npending:
104 c.task = self.queue.pop(0)
105 c.buffer = b = StringIO()
106 c.setopt(WRITEFUNCTION, b.write)
108 self.cm.add_handle(c)
112 ret, nhandles = self.cm.perform()
113 if ret != E_CALL_MULTI_PERFORM:
117 numq, ok, err = self.cm.info_read()
121 self.cm.remove_handle(c)
127 for c, errno, errmsg
in err:
129 self.cm.remove_handle(c)
def HTTP.RequestManager.put |
( |
|
self, |
|
|
|
task |
|
) |
| |
Add a new task. The task object should be a tuple and is
passed to ``request_init`` callback passed to the constructor.
Definition at line 85 of file HTTP.py.
86 """Add a new task. The task object should be a tuple and is 87 passed to ``request_init`` callback passed to the constructor.""" 88 self.queue.append(task)
HTTP.RequestManager.handles |
Definition at line 49 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(), core.TriggerBitAnalyzer.TriggerBitAnalyzer.declareHandles(), RazorAnalyzer.RazorAnalyzer.declareHandles(), objects.METAnalyzer.METAnalyzer.declareHandles(), AlphaTAnalyzer.AlphaTAnalyzer.declareHandles(), core.AutoFillTreeProducer.AutoFillTreeProducer.declareHandles(), MT2Analyzer.MT2Analyzer.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(), and objects.PhotonAnalyzer.PhotonAnalyzer.randomCone().
HTTP.RequestManager.queue |
HTTP.RequestManager.request_error |
HTTP.RequestManager.request_init |
HTTP.RequestManager.request_respond |