ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
python.TrigValSteering.CheckSteps.RefComparisonStep Class Reference
Inheritance diagram for python.TrigValSteering.CheckSteps.RefComparisonStep:
Collaboration diagram for python.TrigValSteering.CheckSteps.RefComparisonStep:

Public Member Functions

def __init__ (self, name)
 
def configure (self, test)
 

Public Attributes

 reference
 
 ref_test_name
 
 input_file
 
 explicit_reference
 

Detailed Description

Base class for steps comparing a file to a reference

Definition at line 19 of file CheckSteps.py.

Constructor & Destructor Documentation

◆ __init__()

def python.TrigValSteering.CheckSteps.RefComparisonStep.__init__ (   self,
  name 
)

Reimplemented in python.TrigValSteering.CheckSteps.RootCompStep, python.TrigValSteering.CheckSteps.RegTestStep, and python.TrigValSteering.CheckSteps.ChainCompStep.

Definition at line 22 of file CheckSteps.py.

22  def __init__(self, name):
23  super(RefComparisonStep, self).__init__(name)
24  self.reference = None
25  self.ref_test_name = None
26  self.input_file = None
27  self.explicit_reference = False # True if reference doesn't exist at configuration time
28 

Member Function Documentation

◆ configure()

def python.TrigValSteering.CheckSteps.RefComparisonStep.configure (   self,
  test 
)

Reimplemented in python.TrigValSteering.CheckSteps.ChainCompStep, python.TrigValSteering.CheckSteps.RootCompStep, and python.TrigValSteering.CheckSteps.RegTestStep.

Definition at line 29 of file CheckSteps.py.

29  def configure(self, test):
30  if self.reference and self.ref_test_name:
31  self.misconfig_abort('Both options "reference" and "ref_test_name" used. Use at most one of them.')
32 
33  if not self.reference and not self.ref_test_name:
34  self.ref_test_name = test.name
35 
36  if self.reference is not None:
37  # Do nothing if the reference will be produced later
38  if self.explicit_reference:
39  return super(RefComparisonStep, self).configure(test)
40  # Do nothing if the reference exists
41  if os.path.isfile(self.reference):
42  return super(RefComparisonStep, self).configure(test)
43  # Try to find the file in DATAPATH
44  full_path = subprocess.check_output('find_data.py {}'.format(self.reference), shell=True).decode('utf-8').strip()
45  if os.path.isfile(full_path):
46  self.log.debug('%s using reference %s', self.name, full_path)
47  self.reference = full_path
48  return super(RefComparisonStep, self).configure(test)
49  else:
50  self.log.warning(
51  '%s failed to find reference %s - wrong path?',
52  self.name, self.reference)
53  return super(RefComparisonStep, self).configure(test)
54 
55  if self.input_file is None:
56  self.misconfig_abort('input_file not specified')
57 
58  branch = os.environ.get('AtlasBuildBranch') # Available after asetup
59  if branch:
60  branch = branch.split('--')[0] # experimental nightlies, e.g. main--mainGAUDI
61  if not branch:
62  branch = os.environ.get('gitlabTargetBranch') # Available in CI
63  if not branch:
64  jobName = os.environ.get('JOB_NAME') # Available in nightly build system (ATR-21836)
65  if jobName:
66  branch = jobName.split('_')[0].split('--')[0]
67  if not branch:
68  msg = 'Cannot determine the branch name, all variables are empty: AtlasBuildBranch, gitlabTargetBranch, JOB_NAME'
69  if self.required:
70  self.misconfig_abort(msg)
71  else:
72  self.log.warning(msg)
73  branch = 'UNKNOWN_BRANCH'
74 
75  sub_path = '{}/ref/{}/test_{}/'.format(
76  test.package_name, branch, self.ref_test_name)
77  ref_eos = art_input_eos + sub_path + self.input_file
78  ref_cvmfs = art_input_cvmfs + sub_path + self.input_file
79  if os.path.isfile(ref_eos) and os.access(ref_eos, os.R_OK):
80  self.log.debug('%s using reference from EOS: %s',
81  self.name, ref_eos)
82  self.reference = ref_eos
83  elif os.path.isfile(ref_cvmfs) and os.access(ref_cvmfs, os.R_OK):
84  self.log.debug('%s using reference from CVMFS: %s',
85  self.name, ref_cvmfs)
86  self.reference = ref_cvmfs
87  else:
88  self.log.warning('%s failed to find reference %s in %s or %s',
89  self.name, sub_path + self.input_file,
90  art_input_eos, art_input_cvmfs)
91  self.reference = None
92 
93  return super(RefComparisonStep, self).configure(test)
94 
95 

Member Data Documentation

◆ explicit_reference

python.TrigValSteering.CheckSteps.RefComparisonStep.explicit_reference

Definition at line 27 of file CheckSteps.py.

◆ input_file

python.TrigValSteering.CheckSteps.RefComparisonStep.input_file

Definition at line 26 of file CheckSteps.py.

◆ ref_test_name

python.TrigValSteering.CheckSteps.RefComparisonStep.ref_test_name

Definition at line 25 of file CheckSteps.py.

◆ reference

python.TrigValSteering.CheckSteps.RefComparisonStep.reference

Definition at line 24 of file CheckSteps.py.


The documentation for this class was generated from the following file:
AtlasMcWeight::decode
double decode(number_type binnedWeight)
Convert weight from unsigned to double.
Definition: AtlasMcWeight.cxx:32
vtune_athena.format
format
Definition: vtune_athena.py:14
configure
bool configure(asg::AnaToolHandle< ITrigGlobalEfficiencyCorrectionTool > &tool, ToolHandleArray< IAsgElectronEfficiencyCorrectionTool > &electronEffToolsHandles, ToolHandleArray< IAsgElectronEfficiencyCorrectionTool > &electronSFToolsHandles, ToolHandleArray< CP::IMuonTriggerScaleFactors > &muonToolsHandles, ToolHandleArray< IAsgPhotonEfficiencyCorrectionTool > &photonEffToolsHandles, ToolHandleArray< IAsgPhotonEfficiencyCorrectionTool > &photonSFToolsHandles, const std::string &triggers, const std::map< std::string, std::string > &legsPerTool, unsigned long nToys, bool debug)
Definition: TrigGlobEffCorrValidation.cxx:514
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
Trk::split
@ split
Definition: LayerMaterialProperties.h:38