in benchmarking/lab_driver.py [0:0]
def run(self):
if (
not self.args.lab
and not self.args.remote
and not "--adhoc" not in self.args
):
assert self.args.benchmark_file, "--benchmark_file (-b) must be specified"
if self.args.benchmark_file and not self.args.remote:
getLogger().info("Checking benchmark files to download")
dbench = DownloadBenchmarks(self.args, getLogger())
dbench.run(self.args.benchmark_file)
if self.args.remote:
unique_args = [
"--app_id",
self.args.app_id,
"--token",
self.args.token,
]
if self.args.benchmark_file:
unique_args.extend(
[
"--benchmark_file",
self.args.benchmark_file,
]
)
if self.args.pre_built_binary:
unique_args.extend(
[
"--pre_built_binary",
self.args.pre_built_binary,
]
)
if self.args.user_string:
unique_args.extend(
[
"--user_string",
self.args.user_string,
]
)
if self.args.buck_target:
unique_args.extend(
[
"--buck_target",
self.args.buck_target,
]
)
# hack to remove --repo from the argument list since python2
# argparse doesn't support allow_abbrev to be False, and it is
# the prefix of --repo_dir
if "--repo" in self.unknowns:
index = self.unknowns.index("--repo")
new_unknowns = self.unknowns[:index]
new_unknowns.extend(self.unknowns[index + 2 :])
self.unknowns = new_unknowns
app_class = RunRemote
elif self.args.lab:
unique_args = [
"--app_id",
self.args.app_id,
"--token",
self.args.token,
]
if self.args.rt_logging:
unique_args.extend(
[
"--rt_logging",
"--rt_logging_interval",
str(self.args.rt_logging_interval),
]
)
app_class = RunLab
elif self.args.custom_binary or self.args.pre_built_binary:
if self.args.custom_binary:
binary = self.args.custom_binary
else:
binary = self.args.pre_built_binary
repo_info = {
"treatment": {"program": binary, "commit": "-1", "commit_time": 0}
}
unique_args = [
"--info '",
json.dumps(repo_info) + "'",
"--benchmark_file",
self.args.benchmark_file,
]
app_class = BenchmarkDriver
else:
if self.args.user_string:
usr_string = self.args.user_string
else:
usr_string = os.environ["USER"]
unique_args = [
"--benchmark_file",
self.args.benchmark_file,
"--user_string",
usr_string,
]
app_class = OSS_RepoDriver
raw_args = []
raw_args.extend(unique_args)
raw_args.extend(["--root_model_dir", self.args.root_model_dir])
raw_args.extend(["--logger_level", self.args.logger_level])
raw_args.extend(self.unknowns)
getLogger().info("Running {} with raw_args {}".format(app_class, raw_args))
app = app_class(raw_args=raw_args)
res = app.run()
if res:
return res