CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions | Variables
visDQMUpload Namespace Reference

Classes

class  HTTPSCertAuth
 
class  HTTPSCertAuthenticate
 

Functions

def encode
 
def filetype
 
def marshall
 
def upload
 

Variables

tuple buf = file.read()
 
 context = None
 
tuple hasher = hashlib.md5()
 
 HTTPS = httplib.HTTPSConnection
 
 ssl_cert_file = None
 
 ssl_key_file = None
 
tuple x509_path = os.getenv("X509_USER_PROXY", None)
 

Function Documentation

def visDQMUpload.encode (   args,
  files 
)
  Encode form (name, value) and (name, filename, type) elements into
  multi-part/form-data. We don't actually need to know what we are
  uploading here, so just claim it's all text/plain.

Definition at line 47 of file visDQMUpload.py.

References filetype(), and str.

Referenced by marshall().

47 
48 def encode(args, files):
49  """
50  Encode form (name, value) and (name, filename, type) elements into
51  multi-part/form-data. We don't actually need to know what we are
52  uploading here, so just claim it's all text/plain.
53  """
54  boundary = b'----------=_DQM_FILE_BOUNDARY_=-----------'
55  (body, crlf) = (b'', b'\r\n')
56  for (key, value) in args.items():
57  payload = str(value).encode('utf-8')
58  body += b'--' + boundary + crlf
59  body += (b'Content-Disposition: form-data; name="%s"' % key.encode('utf-8')) + crlf
60  body += crlf + payload + crlf
61  for (key, filename) in files.items():
62  body += b'--' + boundary + crlf
63  body += (b'Content-Disposition: form-data; name="%s"; filename="%s"'
64  % (key.encode('utf-8'), os.path.basename(filename).encode('utf-8'))) + crlf
65  body += (b'Content-Type: %s' % filetype(filename).encode('utf-8')) + crlf
66  body += (b'Content-Length: %d' % os.stat(filename)[ST_SIZE]) + crlf
67  with open(filename, 'rb') as file:
68  body += crlf + file.read() + crlf
69  body += b'--' + boundary + b'--' + crlf + crlf
70  return (b'multipart/form-data; boundary=' + boundary, body)
#define str(s)
def visDQMUpload.filetype (   filename)

Definition at line 44 of file visDQMUpload.py.

Referenced by encode().

44 
45 def filetype(filename):
46  return mimetypes.guess_type(filename)[0] or 'application/octet-stream'
def visDQMUpload.marshall (   args,
  files,
  request 
)
  Marshalls the arguments to the CGI script as multi-part/form-data,
  not the default application/x-www-form-url-encoded.  This improves
  the transfer of the large inputs and eases command line invocation
  of the CGI script.

Definition at line 71 of file visDQMUpload.py.

References encode(), and str.

Referenced by upload().

71 
72 def marshall(args, files, request):
73  """
74  Marshalls the arguments to the CGI script as multi-part/form-data,
75  not the default application/x-www-form-url-encoded. This improves
76  the transfer of the large inputs and eases command line invocation
77  of the CGI script.
78  """
79  (type, body) = encode(args, files)
80  request.add_header('Content-Type', type)
81  request.add_header('Content-Length', str(len(body)))
82  request.data = body
#define str(s)
def visDQMUpload.upload (   url,
  args,
  files 
)

Definition at line 83 of file visDQMUpload.py.

References marshall().

83 
84 def upload(url, args, files):
85  ident = "visDQMUpload DQMGUI/%s python/%s" % \
86  (os.getenv('DQMGUI_VERSION', '?'), "%d.%d.%d" % sys.version_info[:3])
87  datareq = urllib2.Request(url + '/data/put')
88  datareq.add_header('Accept-encoding', 'gzip')
89  datareq.add_header('User-agent', ident)
90  marshall(args, files, datareq)
91  if 'https://' in url:
92  result = urllib2.build_opener(HTTPSCertAuthenticate()).open(datareq)
93  else:
94  result = urllib2.build_opener(urllib2.ProxyHandler({})).open(datareq)
95 
96  data = result.read()
97  if result.headers.get ('Content-encoding', '') == 'gzip':
98  data = gzip.GzipFile (fileobj=StringIO(data)).read ()
99  return (result.headers, data)

Variable Documentation

tuple visDQMUpload.buf = file.read()

Definition at line 153 of file visDQMUpload.py.

Referenced by XMLProcessor._toXMLCh(), LutXml.addData(), LutXml.addParameter(), DDScope.addScope(), npstat::ArrayND< Numeric, StackLen, StackDim >.addToProjection(), CSCFileDumper.analyze(), ParticleListDrawer.analyze(), EcalTPGParamBuilder.analyze(), HGCalWaferValidation.analyze(), JanAlignmentAlgorithm.begin(), PickEvents.beginJob(), EcalSelectiveReadoutValidation.bookHistograms(), AlignmentTask.buildEqualMeanUMeanVRotZConstraints(), AlignmentTask.buildFixedDetectorsConstraints(), PPSAlignmentHarvester.buildModeGraph(), AlignmentTask.buildOneRotZPerPotConstraints(), AlignmentTask.buildStandardConstraints(), evf::EvFDaqDirector.bumpFile(), edm::storage::DCacheStorageMaker.check(), clangcms::EDMPluginDumper.checkASTDecl(), FedRawDataInputSource.checkNext(), XrdAdaptor::ClientRequest.ClientRequest(), WatcherStreamFileReader.closeFile(), LaserSorter.closeOutStream(), hitfit::Constrained_Top.Constrained_Top(), hitfit::Constrained_Z.Constrained_Z(), convertFile(), FFTJetCorrector< Jet, Adjustable >.correct(), crc32c_sw(), evf::EvFDaqDirector.createBoLSFile(), evf::EvFDaqDirector.createLumiSectionFiles(), CSCChamberDataItr.CSCChamberDataItr(), CSCDDUDataItr.CSCDDUDataItr(), CSCDMBHeader.CSCDMBHeader(), CSCDMBTrailer.CSCDMBTrailer(), DDRotation.DDRotation(), evf::EvFBuildingThrottle.dowork(), dumpFiles(), GeometryInfoDump.dumpInfo(), EcalLaserAPDPNRatiosXMLTranslator.dumpXML(), EcalLinearCorrectionsXMLTranslator.dumpXML(), EcalTPGParamBuilder.EcalTPGParamBuilder(), ElectronPFIsolationWithConeVeto.ElectronPFIsolationWithConeVeto(), CTPPSProtonReconstructionEfficiencyEstimatorMC.endJob(), CTPPSProtonReconstructionEfficiencyEstimatorData.endJob(), dqm::DQMFileSaverBase.filename(), SiPixelRawDataErrorModule.fill(), SiPixelRawDataErrorModule.fillFED(), SiPixelDataQuality.fillGlobalQualityPlot(), SiStripHistoPlotter.fillNamedImageBuffer(), evf::DirManager.findHighestRun(), evf::DirManager.findHighestRunDir(), evf::DirManager.findRunDir(), hitfit::Top_Fit.fit(), citk.for(), CTPPSTotemDataFormatter.formatRawData(), EcalSelectiveReadoutValidation.frame2Energy(), FRDEventMsgView.FRDEventMsgView(), get_info(), HcalQIEManager.getHfQieTable(), WatcherStreamFileReader.getInputFile(), InterpolatedPulse< 1500U >.getIntegral(), evf::EvFDaqDirector.getLumisectionToStart(), HcalLutManager.getLutSetFromFile(), evf::EvFDaqDirector.getNextFromFileBroker(), evf::EvFDaqDirector.getNFilesFromEoLS(), InterpolatedPulse< 1500U >.getPeakValue(), HcalQIEManager.getQIETableFromFile(), HcalQIEManager.getTableFromDb(), SimpleSAXParser.getToken(), evf::EvFDaqDirector.grabNextJsonFile(), npstat::HistoND< Numeric, Axis >.HistoND(), DTTPGLutFile.ignoreLines(), L1TriggerLutFile.ignoreLines(), PPSAlignmentWorker::SectorData.init(), RPCCompDetId.initGas(), evf::EvFDaqDirector.initRun(), evf::EvFDaqDirector.inputThrottled(), InterpolatedPulse< 1500U >.InterpolatedPulse(), ConstantStepOdeSolver.interpolateIntegrated(), CTPPSRPAlignmentCorrectionsMethods.iovValueToString(), L1Analysis::L1AnalysisEvent.L1AnalysisEvent(), dqmservices::DQMProtobufReader.load(), L1MuGMTLUT.Load(), MonitorXMLParser.load(), MatacqProducer.loadOrbitOffset(), edm::storage::RemoteFile.local(), lutFmt(), LzmaDec_DecodeReal(), makeGifHists(), L1MuGMTLUT.MakeSubClass(), FFTSpecificScaleCalculator< MyJet, Adjustable >.map(), FedRawDataInputSource.maybeOpenNewLumiSection(), MuonPFIsolationWithConeVeto.MuonPFIsolationWithConeVeto(), now(), DQMNet.onPeerData(), npstat::LinInterpolatedTableND< Numeric, Axis >.operator()(), InterpolatedPulse< 1500U >.operator*=(), InterpolatedPulse< 1500U >.operator=(), InterpolatedPulse< 1500U >.operator==(), ReadRepacker.pack(), DQMNet.packQualityData(), dqm::impl::MonitorElement.packScalarData(), l1t::stage2::RegionalMuonGMTPacker.packTF(), edm::service::CPU.parseCPUInfo(), PrescaleWeightProvider.parseL1Seeds(), PhotonPFIsolationWithConeVeto.PhotonPFIsolationWithConeVeto(), MODCCSHFDat.populateClob(), IODConfig.populateClob(), edm::service::SimpleMemoryCheck.postEndJob(), bitset_utilities.printWords(), TotemTriggerRawToDigi.ProcessLoneGFrame(), npstat::ArrayND< Numeric, StackLen, StackDim >.processSubrange(), TotemTriggerRawToDigi.produce(), CSCDCCUnpacker.produce(), npstat::ArrayND< Numeric, StackLen, StackDim >.project(), dqm::impl::MonitorElement.qualityTagString(), HiEvtPlaneFlatten.rangeString(), SectorProcessorLUT.read_file(), TStorageFactoryFile.ReadBuffersSync(), lhef::CBInputStream.readBytes(), lhef::STLInputStream.readBytes(), lhef::StorageInputStream.readBytes(), PhysicsTools::MVAComputer.readCalibration(), MODCCSHFDat.readClob(), IODConfig.readClob(), LmfSource.readEventWithinFile(), L1MuGMTHWFileReader.readNextEvent(), readParticlesFromHepMC(), readRemote(), EcalLaserCondTools::FileReader.readTime(), HcalSimpleRecAlgoImpl.removePileup(), edm::service::IgProfService.replace(), edm::service::IgProfService.replaceU64(), npstat::ArrayND< Numeric, StackLen, StackDim >.rotate(), LegacyIOHelper.save(), JanAlignmentAlgorithm.saveDiagnostics(), StraightTrackAlignment.saveDiagnostics(), dqm::DQMFileSaverPB.savePB(), AbsFFTJetScaleCalculator< MyJet, Adjustable >.scale(), EcalSelectiveReadoutValidation.selectFedsForLog(), MillePedeTrees.SetBowsParameters(), gen::Pythia6Service.setCSAParams(), PlotMillePede.SetNbins(), DDExpandedView.setScope(), InterpolatedPulse< 1500U >.setShape(), MillePedeTrees.SetSurfDefDeltaBows(), StraightTrackAlignment.setToString(), MillePedeTrees.SetUseSignedR(), SiPixelEDAClient.SiPixelEDAClient(), EcalDumpRaw.srRange(), L1MuGMTLUT::PortDecoder.str(), edm::StreamerOutputModuleCommon.StreamerOutputModuleCommon(), LaserSorter.streamFileName(), npstat::ArrayND< Numeric, StackLen, StackDim >.subtractFromProjection(), dqm::impl::MonitorElement.tagLabelString(), EcalLaserCondTools.timeToString(), cms::MD5Result.toString(), LmfSource.toString(), LaserSorter.toString(), EcalDumpRaw.tpgTag(), TrackingAnalyser.TrackingAnalyser(), ConstantStepOdeSolver.truncateCoordinate(), EcalDumpRaw.ttfTag(), CSCSPEvent.unpack(), CSCSPCounters.unpack(), CSCTFEvent.unpack(), ReadRepacker.unpack(), CSCSP_MBblock.unpack(), CSCSPTrailer.unpack(), CSCSPRecord.unpack(), CSCSP_MEblock.unpack(), CSCSPHeader.unpack(), CSCSP_SPblock.unpack(), CSCDDUEventData.unpack_data(), CSCEventData.unpack_data(), StraightTrackAlignment.updateDiagnosticHistograms(), evf::EvFDaqDirector.updateFuLock(), VersionedSelector< edm::Ptr< reco::Photon > >.VersionedSelector(), WatcherStreamFileReader.WatcherStreamFileReader(), CSCWireGeometry.wireValues(), CTPPSProtonReconstructionPlotter::SingleRPPlots.write(), CTPPSProtonReconstructionEfficiencyEstimatorData::ArmData.write(), CTPPSTrackDistributionPlotter::ArmPlots.write(), CTPPSProtonReconstructionPlotter::MultiRPPlots.write(), MuonAssociatorByHitsHelper.write_matched_simtracks(), EcalDccWeightBuilder.writeWeightToRootFile(), xMLCh2String(), edm::storage::LStoreFile::MutexWrapper.~MutexWrapper(), and TagNames.~TagNames().

visDQMUpload.context = None

Definition at line 30 of file visDQMUpload.py.

Referenced by fireworks.addDashedLine(), edm::ProductRegistryHelper.addToRegistry(), EcalBarrelMonitorDbModule.analyze(), edmtest::HcalDumpConditions.analyze(), edm.callWithTryCatchAndPrint(), edm::ProductRegistry.checkDictionariesOfConsumedTypes(), convert_boolean(), edm::StreamerInputSource.declareStreamers(), edm::Worker.doWorkAsync(), edm::Worker.doWorkNoPrefetchingAsync(), edm::Schedule.endJob(), edm::ProductRegistry.initializeLookupTables(), edm::core::OutputModuleCore.keepThisBranch(), load_dddefinition(), edm.loadExtraClasses(), fireworks.makeRhoZSuperCluster(), edm::eventsetup::ESSourceDataProxyBase.prefetchAsyncImpl(), evf::FastMonitoringService.preGlobalEarlyTermination(), evf::FastMonitoringService.preSourceEarlyTermination(), evf::FastMonitoringService.preStreamEarlyTermination(), edm::WorkerManager.processAccumulatorsAsync(), edm::WorkerManager.processOneOccurrenceAsync(), RPCDBCom.RPCDBCom(), edm::UnscheduledCallProducer.runAccumulatorsAsync(), edm::Path.runAllModulesAsync(), edm::Worker.runModule(), edm::Worker.runModuleAfterAsyncPrefetch(), edm::Worker.runModuleDirectly(), edm::WorkerInPath.runWorkerAsync(), FWTextTableCellRenderer.setHighlightContext(), and TestBase.TestBase().

tuple visDQMUpload.hasher = hashlib.md5()

Definition at line 151 of file visDQMUpload.py.

Referenced by DTCombinatorialPatternReco::TriedPattern.hash_combine(), cond::GTEntry_t.hashvalue(), and edm::RootInputFileSequence.skipToItemInNewFile().

visDQMUpload.HTTPS = httplib.HTTPSConnection

Definition at line 24 of file visDQMUpload.py.

visDQMUpload.ssl_cert_file = None

Definition at line 29 of file visDQMUpload.py.

string visDQMUpload.ssl_key_file = None

Definition at line 28 of file visDQMUpload.py.

tuple visDQMUpload.x509_path = os.getenv("X509_USER_PROXY", None)

Definition at line 100 of file visDQMUpload.py.