75 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
76 flags = initConfigFlags()
78 flags.Exec.MaxEvents = self.
args.max_events
79 flags.Exec.SkipEvents = self.
args.skip_n_events
80 flags.Exec.EventPrintoutInterval = 10000
103 with yaml_path.open(
"r", encoding=
"utf-8")
as cfg_file:
105 config_data = yaml.safe_load(cfg_file)
106 from AnalysisAlgorithmsConfig.ConfigText
import combineConfigFiles
107 combined = combineConfigFiles(config_data, yaml_paths, fragment_key=
"include")
109 with open(
"merged_config.yaml",
"w")
as cfg:
110 cfg.write(yaml.dump(config_data))
111 self.
logger.info(
"Merged included fragments into main config.")
112 return config_data, combined
130 if local
and ((yamlConfig := CPBaseRunner.findLocalPathYamlConfig(self.
args.text_config))
is not None):
131 return yamlConfig, [yamlConfig.parent]
134 yamlConfig, yamlBasePath = CPBaseRunner.findRepoPathYamlConfig(self.
args.text_config)
137 from AthenaCommon.Utils.unixtools
import find_datafile
138 return find_datafile(self.
args.text_config)
140 if len(yamlConfig) > 1:
141 raise FileExistsError(
142 f
'Multiple files named \"{self.args.text_config}\" found in the analysis repository. Please provide a more specific path to the config file.\nMatches found:\n' +
'\n'.join(yamlConfig))
144 return yamlConfig[0], [yamlBasePath[0]]
159 Search for the file up to two levels deep within the first DATAPATH entry.
160 First, check directly under the analysis repository (depth 0).
161 Then, check immediate subdirectories (depth 1), looking for the file inside each.
162 Returns a list of all matches found and a list of packages/base paths.
166 analysisRepoPath = Path(environ.get(
"DATAPATH",
"").
split(pathsep)[0])
168 searchPath = analysisRepoPath / textConfigPath
169 if searchPath.is_file():
170 matches.append(searchPath)
171 basePaths.append(analysisRepoPath
if searchPath.parent == analysisRepoPath
else analysisRepoPath / Path(textConfigPath).parts[0])
173 for subdir
in analysisRepoPath.iterdir():
174 if not subdir.is_dir():
176 candidate = analysisRepoPath / subdir / textConfigPath
177 if candidate.is_file():
178 matches.append(candidate)
179 basePaths.append(analysisRepoPath / subdir)
180 return matches, basePaths