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
if yamlConfig
is not None else None]
134 yamlConfig, yamlBasePath = CPBaseRunner.findRepoPathYamlConfig(self.
args.text_config)
137 from AthenaCommon.Utils.unixtools
import find_datafile
138 yamlConfig = find_datafile(self.
args.text_config)
139 if yamlConfig
is None:
141 yamlConfig = Path(yamlConfig)
142 return yamlConfig, [yamlConfig.parent]
144 if len(yamlConfig) > 1:
145 raise FileExistsError(
146 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))
148 return yamlConfig[0], [yamlBasePath[0]]
163 Search for the file up to two levels deep within the first DATAPATH entry.
164 First, check directly under the analysis repository (depth 0).
165 Then, check immediate subdirectories (depth 1), looking for the file inside each.
166 Returns a list of all matches found and a list of packages/base paths.
170 analysisRepoPath = Path(environ.get(
"DATAPATH",
"").
split(pathsep)[0])
172 searchPath = analysisRepoPath / textConfigPath
173 if searchPath.is_file():
174 matches.append(searchPath)
175 basePaths.append(analysisRepoPath
if searchPath.parent == analysisRepoPath
else analysisRepoPath / Path(textConfigPath).parts[0])
177 for subdir
in analysisRepoPath.iterdir():
178 if not subdir.is_dir():
180 candidate = analysisRepoPath / subdir / textConfigPath
181 if candidate.is_file():
182 matches.append(candidate)
183 basePaths.append(analysisRepoPath / subdir)
184 return matches, basePaths