CMS 3D CMS Logo

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

Functions

def auth_wget
 

Variables

tuple all_files = file_list_re.findall(filedir_html)
 
string base_url = 'https://cmsweb.cern.ch/dqm/relval/data/browse/ROOT/'
 
tuple file_list_re = re.compile(r"<a href='[-./\w]*'>([-./\w]*)<")
 
list file_res = [re.compile(r) for r in options.regexp.split(',') + [options.release]]
 Fetch the files, using multi-processing. More...
 
tuple filedir_html = auth_wget(filedir_url)
 
string filedir_url = base_url+relvaldir+'/'
 
string help = 'Fetch data relvals.'
 
tuple parser = OptionParser(usage='usage: %prog [options]')
 Define options. More...
 
tuple pool = Pool(options.mthreads)
 
tuple release = re.findall('(CMSSW_\d*_\d*_)\d*(?:_[\w\d]*)?', options.release)
 
list releasedir = release[0]
 
string relvaldir = "RelVal"
 Parse sys.argv. More...
 
list selected_files = [f for f in all_files if all([r.search(f) for r in file_res])]
 

Function Documentation

def fetchall_from_DQM_v2.auth_wget (   url,
  chunk_size = 1048576 
)
Returns the content of specified URL, which requires authentication.
If the content is bigger than 1MB, then save it to file.

Definition at line 39 of file fetchall_from_DQM_v2.py.

References print().

39 
40 def auth_wget(url, chunk_size=1048576):
41  """Returns the content of specified URL, which requires authentication.
42  If the content is bigger than 1MB, then save it to file.
43  """
44  opener = build_opener(X509CertOpen())
45  url_file = opener.open(Request(url))
46  size = int(url_file.headers["Content-Length"])
47 
48  if size < 1048576: # if File size < 1MB
49  filename = basename(url) #still download
50  readed = url_file.read() ## and then check if its not an empty dir (parent directory)
51  if filename != '':
52  outfile = open(filename, 'wb') #then write File to local system
53  outfile.write(readed)
54  return readed
55 
56  filename = basename(url)
57  file_id = selected_files.index(filename)
58 
59  if isfile("./%s" % filename):
60  print('%d. Exsits on disk. Skipping.' % (file_id +1))
61  return
62 
63  print('%d. Downloading...' % (file_id +1))
64  file = open(filename, 'wb')
65  # progress = 0
66  chunk = url_file.read(chunk_size)
67  while chunk:
68  file.write(chunk)
69  # progress += chunk_size
70  chunk = url_file.read(chunk_size)
71  print('%d. Done.' % (file_id +1))
72  file.close()
73 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

Variable Documentation

tuple fetchall_from_DQM_v2.all_files = file_list_re.findall(filedir_html)

Definition at line 124 of file fetchall_from_DQM_v2.py.

string fetchall_from_DQM_v2.base_url = 'https://cmsweb.cern.ch/dqm/relval/data/browse/ROOT/'

Definition at line 116 of file fetchall_from_DQM_v2.py.

tuple fetchall_from_DQM_v2.file_list_re = re.compile(r"<a href='[-./\w]*'>([-./\w]*)<")

Definition at line 123 of file fetchall_from_DQM_v2.py.

list fetchall_from_DQM_v2.file_res = [re.compile(r) for r in options.regexp.split(',') + [options.release]]

Fetch the files, using multi-processing.

Definition at line 131 of file fetchall_from_DQM_v2.py.

tuple fetchall_from_DQM_v2.filedir_html = auth_wget(filedir_url)

Definition at line 118 of file fetchall_from_DQM_v2.py.

string fetchall_from_DQM_v2.filedir_url = base_url+relvaldir+'/'

Definition at line 117 of file fetchall_from_DQM_v2.py.

string fetchall_from_DQM_v2.help = 'Fetch data relvals.'

Definition at line 77 of file fetchall_from_DQM_v2.py.

tuple fetchall_from_DQM_v2.parser = OptionParser(usage='usage: %prog [options]')

Define options.

Definition at line 75 of file fetchall_from_DQM_v2.py.

tuple fetchall_from_DQM_v2.pool = Pool(options.mthreads)

Definition at line 140 of file fetchall_from_DQM_v2.py.

tuple fetchall_from_DQM_v2.release = re.findall('(CMSSW_\d*_\d*_)\d*(?:_[\w\d]*)?', options.release)

Definition at line 111 of file fetchall_from_DQM_v2.py.

Referenced by XMLConfigReader.buildGP(), ConfigurationDBHandler.cvt2String(), cms::xerces.dispose(), edm::Worker.doWorkAsync(), SaxToDom.error(), SaxToDom2.error(), L1GtTriggerMenuXmlParser.findXMLChild(), XMLDOMBlock.getNewDocument(), XMLConfigReader.getPatternsVersion(), L1GtTriggerMenuXmlParser.getXMLAttribute(), L1GtTriggerMenuXmlParser.getXMLTextValue(), edm::ConcurrentHadronizerFilter< HAD, DEC >.globalEndRunProduce(), edm::ConcurrentGeneratorFilter< HAD, DEC >.globalEndRunProduce(), MonitorXMLParser.handleElement(), cond::XMLAuthenticationService::XMLAuthenticationService.initialize(), L1GtTriggerMenuXmlParser.initXML(), MonitorXMLParser.load(), MonitorXMLParser.MonitorXMLParser(), MuonAlignmentInputXML.newAlignableMuon(), XMLDOMBlock.parse(), L1GtTriggerMenuXmlParser.parseConditions(), MuonAlignmentInputXML.parseDouble(), cond::XMLAuthenticationService::XMLAuthenticationService.processFile(), CalibrationXML.readAttribute(), XMLConfigReader.readConfig(), l1t::XmlConfigParser.readContext(), l1t::XmlConfigParser.readHwDescription(), XMLConfigReader.readPatterns(), edm::RepeatingCachedRootSource.RepeatingCachedRootSource(), XMLProcessor.serializeDOM(), SaxToDom.startElement(), SaxToDom2.startElement(), cscdqm::XMLFileErrorHandler.warning(), L1GtTriggerMenuXmlParser.workXML(), CalibrationXML.writeAttribute(), xMLCh2String(), XMLDOMBlock.XMLDOMBlock(), ConfigurationDBHandler.~ConfigurationDBHandler(), LutXml.~LutXml(), MonitorXMLParser.~MonitorXMLParser(), MuonAlignmentInputXML.~MuonAlignmentInputXML(), edm::SingleConsumerQ::OperateBuffer< T >.~OperateBuffer(), TagNames.~TagNames(), lhef::XMLSimpleStr.~XMLSimpleStr(), lhef::XMLUniStr.~XMLUniStr(), and XStr.~XStr().

list fetchall_from_DQM_v2.releasedir = release[0]

Definition at line 114 of file fetchall_from_DQM_v2.py.

string fetchall_from_DQM_v2.relvaldir = "RelVal"

Parse sys.argv.

Check for option errors Use options

Definition at line 107 of file fetchall_from_DQM_v2.py.

list fetchall_from_DQM_v2.selected_files = [f for f in all_files if all([r.search(f) for r in file_res])]

Definition at line 132 of file fetchall_from_DQM_v2.py.