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
38 if self.explicit_reference:
39 return super(RefComparisonStep, self).
configure(test)
40
41 if os.path.isfile(self.reference):
42 return super(RefComparisonStep, self).
configure(test)
43
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')
59 if branch:
60 branch = branch.split('--')[0]
61 if not branch:
62 branch = os.environ.get('gitlabTargetBranch')
63 if not branch:
64 jobName = os.environ.get('JOB_NAME')
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
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)
std::vector< std::string > split(const std::string &s, const std::string &t=":")