test
CMS 3D CMS Logo

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

Classes

class  BaseDataset
 
class  CMSDataset
 
class  Dataset
 
class  EOSDataset
 
class  IntegrityCheckError
 
class  LocalDataset
 
class  PrivateDataset
 

Functions

def createDataset
 
def createMyDataset
 if user == 'CMS': data = CMSDataset( dataset ) elif user == 'LOCAL': if basedir is None: basedir = os.environ['CMGLOCALBASEDIR'] data = LocalDataset( dataset, basedir, pattern ) else: data = Dataset( user, dataset, pattern ) More...
 
def getDatasetFromCache
 
def writeDatasetToCache
 

Variables

string action = 'store_true'
 
tuple data
 
tuple dataset = Dataset( datasetName )
 
string datasetName = '/MinimumBias/Run2012D-TkAlMinBias-v1/ALCARECO'
 
 default = False,
 
string end = "20121128"
 
string firstRun = "207800"
 
string help = 'print absolute path'
 
 info = notoptions.noinfo
 
tuple jsonFile
 
 jsonPath = jsonFile,
 
list name = args[0]
 
tuple parser = OptionParser()
 
tuple run_range = (options.min_run,options.max_run)
 
 user = options.user
 

Function Documentation

def dataset.createDataset (   user,
  dataset,
  pattern,
  readcache = False,
  basedir = None,
  run_range = None 
)

Definition at line 426 of file dataset.py.

References getDatasetFromCache(), and writeDatasetToCache().

Referenced by datasetToSource.datasetToSource(), production_tasks.CheckDatasetExists.run(), production_tasks.SourceCFG.run(), and writeDatasetToCache().

427  basedir = None, run_range = None):
428 
429 
430  def cacheFileName(data, user, pattern):
431  return '{user}%{name}%{pattern}.pck'.format( user = user, name = data.replace('/','_'), pattern = pattern)
432 
433  def writeCache(dataset):
434  writeDatasetToCache( cacheFileName(dataset.name, dataset.user, dataset.pattern), dataset )
435 
436  def readCache(data, user, pattern):
437  return getDatasetFromCache( cacheFileName(data, user, pattern) )
438 
439  if readcache:
440  try:
441  data = readCache(dataset, user, pattern)
442  except IOError:
443  readcache = False
444  if not readcache:
445  if user == 'CMS':
446  data = CMSDataset( dataset , run_range = run_range)
447  info = False
448  elif user == 'LOCAL':
449  data = LocalDataset( dataset, basedir, pattern)
450  info = False
451  elif user == 'EOS':
452  data = EOSDataset(dataset, basedir, pattern)
453  info = False
454  else:
455  data = Dataset( dataset, user, pattern)
writeCache(data)
def writeDatasetToCache
Definition: dataset.py:418
def getDatasetFromCache
Definition: dataset.py:412
def dataset.createMyDataset (   user,
  dataset,
  pattern,
  dbsInstance,
  readcache = False 
)

if user == 'CMS': data = CMSDataset( dataset ) elif user == 'LOCAL': if basedir is None: basedir = os.environ['CMGLOCALBASEDIR'] data = LocalDataset( dataset, basedir, pattern ) else: data = Dataset( user, dataset, pattern )

MM

Definition at line 467 of file dataset.py.

References join().

Referenced by datasetToSource.myDatasetToSource().

468 def createMyDataset( user, dataset, pattern, dbsInstance, readcache=False):
469 
470  cachedir = '/'.join( [os.environ['HOME'],'.cmgdataset'])
471 
472  def cacheFileName(data, user, dbsInstance, pattern):
473  cf = data.replace('/','_')
474  name = '{dir}/{user}%{dbsInstance}%{name}%{pattern}.pck'.format(
475  dir = cachedir,
476  user = user,
477  dbsInstance = dbsInstance,
478  name = cf,
479  pattern = pattern)
480  return name
481 
482  def writeCache(dataset):
483  if not os.path.exists(cachedir):
484  os.mkdir(cachedir)
485  cachename = cacheFileName(dataset.name,
486  dataset.user,
487  dataset.dbsInstance,
488  dataset.pattern)
489  pckfile = open( cachename, 'w')
490  pickle.dump(dataset, pckfile)
491 
492  def readCache(data, user, dbsInstance, pattern):
493  cachename = cacheFileName(data, user, dbsInstance, pattern)
494 
495  pckfile = open( cachename)
496  dataset = pickle.load(pckfile)
497  #print 'reading cache'
498  return dataset
499 
500  if readcache:
501  try:
502  data = readCache(dataset, user, dbsInstance, pattern)
503  except IOError:
504  readcache = False
505  if not readcache:
506  if user == 'PRIVATE':
507  data = PrivateDataset( dataset, dbsInstance )
508  info = False
509  writeCache(data)
return data
def createMyDataset
if user == 'CMS': data = CMSDataset( dataset ) elif user == 'LOCAL': if basedir is None: basedir = os...
Definition: dataset.py:467
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def dataset.getDatasetFromCache (   cachename)

Definition at line 412 of file dataset.py.

References join().

Referenced by createDataset().

413 def getDatasetFromCache( cachename ) :
414  cachedir = '/'.join( [os.environ['HOME'],'.cmgdataset'])
415  pckfile = open( cachedir + "/" + cachename )
416  dataset = pickle.load(pckfile)
417  return dataset
def getDatasetFromCache
Definition: dataset.py:412
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def dataset.writeDatasetToCache (   cachename,
  dataset 
)

Definition at line 418 of file dataset.py.

References createDataset(), and join().

Referenced by createDataset().

419 def writeDatasetToCache( cachename, dataset ):
420  cachedir = '/'.join( [os.environ['HOME'],'.cmgdataset'])
421  if not os.path.exists(cachedir):
422  os.mkdir(cachedir)
423  pckfile = open( cachedir + "/" + cachename, 'w')
424  pickle.dump(dataset, pckfile)
def writeDatasetToCache
Definition: dataset.py:418
static std::string join(char **cmd)
Definition: RemoteFile.cc:18

Variable Documentation

string dataset.action = 'store_true'

Definition at line 20 of file dataset.py.

tuple dataset.data
Initial value:
1 = createDataset(user, name,
2  fnmatch.translate( options.wildcard ),
3  options.readcache,
4  options.basedir,
5  run_range=run_range)
def createDataset
Definition: dataset.py:426

Definition at line 49 of file dataset.py.

tuple dataset.dataset = Dataset( datasetName )

Definition at line 922 of file dataset.py.

string dataset.datasetName = '/MinimumBias/Run2012D-TkAlMinBias-v1/ALCARECO'

Definition at line 918 of file dataset.py.

dataset.default = False,

Definition at line 21 of file dataset.py.

string dataset.end = "20121128"

Definition at line 925 of file dataset.py.

string dataset.firstRun = "207800"

Definition at line 924 of file dataset.py.

Referenced by TkModuleGroupSelector.createModuleGroups(), SiPixelDcsInfo.dqmEndLuminosityBlock(), edm::SetRunHelper.setForcedRunOffset(), and SiPixelDcsInfo.SiPixelDcsInfo().

string dataset.help = 'print absolute path'

Definition at line 22 of file dataset.py.

dataset.info = notoptions.noinfo

Definition at line 46 of file dataset.py.

tuple dataset.jsonFile
Initial value:
1 = ( '/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/'
2  'Collisions12/8TeV/Prompt/'
3  'Cert_190456-207898_8TeV_PromptReco_Collisions12_JSON.txt' )

Definition at line 919 of file dataset.py.

dataset.jsonPath = jsonFile,

Definition at line 927 of file dataset.py.

list dataset.name = args[0]

Definition at line 45 of file dataset.py.

tuple dataset.parser = OptionParser()

Definition at line 14 of file dataset.py.

tuple dataset.run_range = (options.min_run,options.max_run)

Definition at line 48 of file dataset.py.

dataset.user = options.user

Definition at line 44 of file dataset.py.