CMS 3D CMS Logo

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.
tuple filedir_html = auth_wget(filedir_url)
string filedir_url = '/'
string help = 'Fetch data relvals.'
tuple parser = OptionParser(usage='usage: %prog [options]')
 Define options.
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.
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.

00040                                       :
00041     """Returns the content of specified URL, which requires authentication.
00042     If the content is bigger than 1MB, then save it to file.
00043     """
00044     opener = build_opener(X509CertOpen())
00045     url_file = opener.open(Request(url))
00046     size = int(url_file.headers["Content-Length"])
00047 
00048     if size < 1048576:
00049         return url_file.read()
00050 
00051     filename = basename(url)
00052     file_id = selected_files.index(filename)
00053 
00054     if isfile("./%s" % filename):
00055         print '%d. Exsits on disk. Skipping.' % (file_id +1)
00056         return
00057 
00058     print '%d. Downloading...' % (file_id +1)
00059     file = open(filename, 'wb')
00060     # progress = 0
00061     chunk = url_file.read(chunk_size)
00062     while chunk:
00063         file.write(chunk)
00064         # progress += chunk_size
00065         chunk = url_file.read(chunk_size)
00066     print '%d.  Done.' % (file_id +1)
00067     file.close()
00068 


Variable Documentation

tuple fetchall_from_DQM_v2::all_files = file_list_re.findall(filedir_html)

Definition at line 116 of file fetchall_from_DQM_v2.py.

Referenced by ContentReader::give_files().

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

Definition at line 111 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 115 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 123 of file fetchall_from_DQM_v2.py.

Definition at line 113 of file fetchall_from_DQM_v2.py.

Definition at line 112 of file fetchall_from_DQM_v2.py.

string fetchall_from_DQM_v2::help = 'Fetch data relvals.'

Definition at line 72 of file fetchall_from_DQM_v2.py.

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

Define options.

Definition at line 70 of file fetchall_from_DQM_v2.py.

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

Definition at line 106 of file fetchall_from_DQM_v2.py.

Referenced by stor::XHTMLMaker::addNode(), stor::XHTMLMaker::addText(), ConfigurationDBHandler::cvt2String(), L1GtTriggerMenuXmlParser::findXMLChild(), XMLDOMBlock::getNewDocument(), L1GtTriggerMenuXmlParser::getXMLAttribute(), L1GtTriggerMenuXmlParser::getXMLTextValue(), MonitorXMLParser::handleElement(), cond::XMLAuthenticationService::XMLAuthenticationService::initialize(), L1GtTriggerMenuXmlParser::initXML(), MonitorXMLParser::load(), MonitorXMLParser::MonitorXMLParser(), MuonAlignmentInputXML::newAlignableMuon(), stor::XHTMLMaker::out(), XMLDOMBlock::parse(), L1GtTriggerMenuXmlParser::parseConditions(), MuonAlignmentInputXML::parseDouble(), SummaryPlotXmlParser::parseXML(), cond::XMLAuthenticationService::XMLAuthenticationService::processFile(), CalibrationXML::readAttribute(), evf::IPCMethod::releaseResources(), edm::RootFile::RootFile(), XMLProcessor::serializeDOM(), stor::XHTMLMaker::start(), cscdqm::XMLFileErrorHandler::warning(), L1GtTriggerMenuXmlParser::workXML(), CalibrationXML::writeAttribute(), stor::XHTMLMaker::XHTMLMaker(), xMLCh2String(), XMLDOMBlock::XMLDOMBlock(), ConfigurationDBHandler::~ConfigurationDBHandler(), LutXml::~LutXml(), MonitorXMLParser::~MonitorXMLParser(), MuonAlignmentInputXML::~MuonAlignmentInputXML(), edm::EventBuffer::OperateBuffer< T >::~OperateBuffer(), edm::SingleConsumerQ::OperateBuffer< T >::~OperateBuffer(), ora::Serializer::~Serializer(), StrX::~StrX(), TagNames::~TagNames(), cscdqm::XercesStringTranscoder::~XercesStringTranscoder(), lhef::XMLSimpleStr::~XMLSimpleStr(), XMLSimpleStr::~XMLSimpleStr(), XMLUniStr::~XMLUniStr(), lhef::XMLUniStr::~XMLUniStr(), and XStr::~XStr().

Definition at line 109 of file fetchall_from_DQM_v2.py.

Parse sys.argv.

Check for option errors Use options

Definition at line 102 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 124 of file fetchall_from_DQM_v2.py.