ATLAS Offline Software
Functions | Variables
validation Namespace Reference

Functions

def file_is_empty (path)
 
def getDAOD (list_DAOD)
 
def validate (testSampleDir, thisSampleName, testSamplePath, weight_database, outputSamples)
 

Variables

 parser = optparse.OptionParser(usage="%prog [options]")
 
 help
 
 dest
 
 default
 
 opts
 
 args
 
 f = open(opts.inputSamples)
 
list weight_database = []
 
 SampleName = line.split()[0]
 
 dsid = SampleName.split(".")[1]
 
 dictionary
 
 keys
 
 testSamplePath = None
 
 ofile = open(opts.outputSamples, 'a+')
 
string ruciolist = "rucio list-dids %s*DAOD* --filter type = CONTAINER --short > list_DAOD.txt" % (SampleName.split("_")[0] + '_' + SampleName.split("_")[1] + '_' + SampleName.split("_")[2])
 
 lfile = open('list_DAOD.txt', 'r')
 
 list_DAOD = lfile.readlines()
 
def shortDAOD = getDAOD(list_DAOD)
 
 d_list = list(element for element in list_DAOD if DAOD in element)
 
 thisSampleName = d_list[-1].split()[0]
 

Function Documentation

◆ file_is_empty()

def validation.file_is_empty (   path)

Definition at line 14 of file validation.py.

14 def file_is_empty(path):
15  return os.stat(path).st_size == 0
16 
17 

◆ getDAOD()

def validation.getDAOD (   list_DAOD)

Definition at line 18 of file validation.py.

18 def getDAOD(list_DAOD):
19  DAOD_types = []
20  for d in list_DAOD:
21  DAOD_types.append(d.split('.')[4])
22  short_DAOD = list(set(DAOD_types))
23  return short_DAOD
24 
25 

◆ validate()

def validation.validate (   testSampleDir,
  thisSampleName,
  testSamplePath,
  weight_database,
  outputSamples 
)

Definition at line 26 of file validation.py.

26 def validate(testSampleDir, thisSampleName, testSamplePath, weight_database, outputSamples):
27  for dirName in os.listdir(testSampleDir):
28  if thisSampleName.split(":")[1] in dirName:
29  testSamplePath = testSampleDir + "/" + dirName
30  if (testSamplePath is None):
31  print("[INFO] do not currently have a test sample for ", thisSampleName)
32  rucioCommand = "rucio download --nrandom 1 %s --dir %s " % (thisSampleName, opts.testSampleDir)
33  print("[INFO] --> downloading one using this command \n ", rucioCommand)
34  os.system(rucioCommand)
35  testSamplePath = testSampleDir + "/" + thisSampleName.split(":")[1]
36  if not os.path.exists(testSamplePath):
37  print("[ERROR INFO] No such directory: %s OR downloading Failed" % (testSamplePath))
38  return
39  if not os.listdir(testSamplePath):
40  print("[ERROR INFO] Downloading Failed for ", testSamplePath)
41  return
42  for fileName in os.listdir(testSamplePath):
43  if fileName.endswith('part'):
44  print("[ERROR INFO] Downloading Failed for ", testSamplePath)
45  rmdir = "rm -r %s" % (testSamplePath)
46  os.system(rmdir)
47  return
48  testSamplePath = testSamplePath + "/" + fileName
49  break
50  print("[SUCCESS] found test file ", testSamplePath)
51  athenaCommand = "athena --filesInput=%s --evtMax = 1 MyPackage/MyPackageAlgJobOptions.py" % (testSamplePath)
52  print("[INFO] running athena weight retrieving tool using \n", athenaCommand)
53  os.system(athenaCommand)
54  if not os.path.exists('weight.txt'):
55  print('[INFO] Athena Tool failed to retrieve weights')
56  return
57  wfile = open('weight.txt', 'r')
58  ofile = open(outputSamples, 'a+')
59  weightFile = wfile.read().splitlines()
60  if set(weight_database) == set(weightFile):
61  print('%s is Validated' % (thisSampleName))
62  ofile.write(thisSampleName.split(":")[1] + ' ' + 'PASSED' + '\n')
63  else:
64  print('%s is NOT Validated' % (thisSampleName))
65  ofile.write(thisSampleName.split(":")[1] + ' ' + 'FAILED')
66  wfile.close()
67  ofile.close()
68  rmcommand = "rm weight.txt"
69  os.system(rmcommand)
70  rmsample = "rm -r %s" % (testSampleDir + "/" + thisSampleName.split(":")[1])
71  os.system(rmsample)
72 
73 

Variable Documentation

◆ args

validation.args

Definition at line 78 of file validation.py.

◆ d_list

validation.d_list = list(element for element in list_DAOD if DAOD in element)

Definition at line 114 of file validation.py.

◆ default

validation.default

Definition at line 75 of file validation.py.

◆ dest

validation.dest

Definition at line 75 of file validation.py.

◆ dictionary

validation.dictionary

Definition at line 87 of file validation.py.

◆ dsid

validation.dsid = SampleName.split(".")[1]

Definition at line 86 of file validation.py.

◆ f

validation.f = open(opts.inputSamples)

Definition at line 81 of file validation.py.

◆ help

validation.help

Definition at line 75 of file validation.py.

◆ keys

validation.keys

Definition at line 87 of file validation.py.

◆ lfile

validation.lfile = open('list_DAOD.txt', 'r')

Definition at line 110 of file validation.py.

◆ list_DAOD

validation.list_DAOD = lfile.readlines()

Definition at line 111 of file validation.py.

◆ ofile

validation.ofile = open(opts.outputSamples, 'a+')

Definition at line 96 of file validation.py.

◆ opts

validation.opts

Definition at line 78 of file validation.py.

◆ parser

validation.parser = optparse.OptionParser(usage="%prog [options]")

Definition at line 74 of file validation.py.

◆ ruciolist

string validation.ruciolist = "rucio list-dids %s*DAOD* --filter type = CONTAINER --short > list_DAOD.txt" % (SampleName.split("_")[0] + '_' + SampleName.split("_")[1] + '_' + SampleName.split("_")[2])

Definition at line 103 of file validation.py.

◆ SampleName

validation.SampleName = line.split()[0]

Definition at line 85 of file validation.py.

◆ shortDAOD

def validation.shortDAOD = getDAOD(list_DAOD)

Definition at line 112 of file validation.py.

◆ testSamplePath

validation.testSamplePath = None

Definition at line 94 of file validation.py.

◆ thisSampleName

validation.thisSampleName = d_list[-1].split()[0]

Definition at line 116 of file validation.py.

◆ weight_database

validation.weight_database = []

Definition at line 83 of file validation.py.

validation.validate
def validate(testSampleDir, thisSampleName, testSamplePath, weight_database, outputSamples)
Definition: validation.py:26
validation.getDAOD
def getDAOD(list_DAOD)
Definition: validation.py:18
validation.file_is_empty
def file_is_empty(path)
Definition: validation.py:14
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
Trk::open
@ open
Definition: BinningType.h:40
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70