CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
production_tasks.BaseDataset Class Reference
Inheritance diagram for production_tasks.BaseDataset:
production_tasks.Task

Public Member Functions

def __init__
 
def addOption
 
def query
 
def run
 
- Public Member Functions inherited from production_tasks.Task
def __init__
 
def addOption
 
def getname
 
def run
 

Additional Inherited Members

- Public Attributes inherited from production_tasks.Task
 dataset
 
 instance
 
 name
 
 options
 
 user
 

Detailed Description

Query DAS to find dataset name in DBS - see https://cmsweb.cern.ch/das/

Definition at line 113 of file production_tasks.py.

Constructor & Destructor Documentation

def production_tasks.BaseDataset.__init__ (   self,
  dataset,
  user,
  options 
)

Definition at line 115 of file production_tasks.py.

116  def __init__(self, dataset, user, options):
Task.__init__(self,'BaseDataset', dataset, user, options)

Member Function Documentation

def production_tasks.BaseDataset.addOption (   self,
  parser 
)

Definition at line 117 of file production_tasks.py.

118  def addOption(self, parser):
parser.add_option("-n", "--name", dest="name", default=None,help='The name of the dataset in DAS. Will be guessed if not specified')
def production_tasks.BaseDataset.query (   self,
  dataset 
)
Query DAS to find out how many events are in the dataset

Definition at line 119 of file production_tasks.py.

References DDVectorGetter.check(), CalibratedPatElectronProducer.dataset, production_tasks.Task.dataset, CalibratedElectronProducer.dataset, edmIntegrityCheck.IntegrityCheck.dataset, and genericValidation.GenericValidationData.dataset.

Referenced by production_tasks.BaseDataset.run().

120  def query(self, dataset):
121  """Query DAS to find out how many events are in the dataset"""
122 
123  host = self.options.host
124  debug = self.options.verbose
125  idx = self.options.idx
126  limit = self.options.limit
127 
128  def check(ds):
129  query = 'dataset=%s' % ds
130  result = Das.get_data(host, query, idx, limit, debug)
131  result = result.replace('null','None')
132  result = result.replace('true','True')
133  result = result.replace('false','False')
134  data = eval(result)
135  if data['status'] != 'ok':
136  raise Exception("Das query failed: Output is '%s'" % data)
137  return (data['data'],data)
138 
139  data = None
140  exists = False
141 
142  if self.options.name is None:
143  #guess the dataset name in DBS
144  tokens = [t for t in dataset.split(os.sep) if t]
145  if len(tokens) >= 3:
146  #DBS names always have three entries
147  ds = os.sep + os.sep.join(tokens[0:3])
148  if ds:
149  exists, data = check(ds)
150  self.options.name = ds
151  else:
152  exists, data = check(self.options.name)
153  if not exists:
154  raise Exception("Specified dataset '%s' not found in Das. Please check." % self.options.name)
155 
156  if data is None:
157  raise Exception("Dataset '%s' not found in Das. Please check." % self.dataset)
158  return data
bool check(const std::string &)
def production_tasks.BaseDataset.run (   self,
  input 
)

Definition at line 159 of file production_tasks.py.

References CalibratedPatElectronProducer.dataset, production_tasks.Task.dataset, CalibratedElectronProducer.dataset, edmIntegrityCheck.IntegrityCheck.dataset, genericValidation.GenericValidationData.dataset, FileExportPlugin.FileExportPlugin.options, cmsswPreprocessor.CmsswPreprocessor.options, DOTExport.DotProducer.options, confdb.HLTProcess.options, production_tasks.Task.options, edmIntegrityCheck.IntegrityCheck.options, DbQuery.query, edmIntegrityCheck.IntegrityCheck.query(), confdbOfflineConverter.OfflineConverter.query(), production_tasks.BaseDataset.query(), ora::QueryableVector< Tp >.query(), and upload_popcon.HTTP.query().

160  def run(self, input):
161  output = {}
162  if (hasattr(self.options,'check') and self.options.check) or not hasattr(self.options,'check'):
163  output = self.query(self.dataset)
164  return {'Name':self.options.name,'Das':output}