in benchmarking/run_bench.py [0:0]
def _updateArgsWithBenchmarkOverrides(self, args):
unknowns = self._getUnknownArgs()
# Attempt to find benchmark_file flag in unknowns
# It might not be there depending on what type of
# run this is
benchmark_file = None
if "--benchmark_file" in unknowns:
benchmark_file = unknowns["--benchmark_file"]
if not benchmark_file and "-b" in unknowns:
benchmark_file = unknowns["-b"]
# Remove later when adhoc is moved to seperated infrastructure
if "--adhoc" in unknowns:
configName = unknowns["--adhoc"]
if configName is None:
configName = "generic"
adhoc_path, success = unpackAdhocFile(configName)
if success:
benchmark_file = adhoc_path
else:
getLogger().error(
"Could not find specified adhoc config: {}".format(configName)
)
if not benchmark_file:
return
# Try to load the benchmark_file and it's default_args section
if not os.path.isfile(benchmark_file):
return
benchmark = {}
with open(benchmark_file, "r") as f:
benchmark = json.load(f)
defaults = {}
if "default_args" in benchmark:
defaults = benchmark["default_args"]
if len(defaults) == 0:
return
# Remove args which are further overidden via cli flags
for arg in unknowns:
if arg in defaults:
del defaults[arg]
# Override args with default_overrides
args.update(defaults)