CMS 3D CMS Logo

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__ (self, dataset, user, options)
 
def addOption (self, parser)
 
def query (self, dataset)
 
def run (self, input)
 
- Public Member Functions inherited from production_tasks.Task
def __init__ (self, name, dataset, user, options, instance=None)
 
def addOption (self, parser)
 
def getname (self)
 
def run (self, input)
 

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 117 of file production_tasks.py.

Constructor & Destructor Documentation

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

Definition at line 119 of file production_tasks.py.

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

Member Function Documentation

def production_tasks.BaseDataset.addOption (   self,
  parser 
)

Definition at line 121 of file production_tasks.py.

121  def addOption(self, parser):
122  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 123 of file production_tasks.py.

References trackerTree.check(), production_tasks.Task.dataset, edmIntegrityCheck.IntegrityCheck.dataset, and genericValidation.GenericValidationData.dataset.

Referenced by production_tasks.BaseDataset.run().

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